Skip to content

Commit 78c8b30

Browse files
author
john0005
committed
Fix VBox to show checkbox dialog.
Get rid of exception when disposing mapview
1 parent 98c51cc commit 78c8b30

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/main/java/com/esri/samples/featurelayers/statistical_query/StatisticalQuerySample.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void start(Stage stage) throws Exception {
7373

7474
// create a service feature table using the URL
7575
String featureServiceURL = "https://sampleserver6.arcgisonline" +
76-
".com/arcgis/rest/services/SampleWorldCities/MapServer/0";
76+
".com/arcgis/rest/services/SampleWorldCities/MapServer/0";
7777
final ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceURL);
7878

7979
// create a feature layer from the service feature table and add it to the map
@@ -87,8 +87,8 @@ public void start(Stage stage) throws Exception {
8787
// create static definitions for all the statistics we want to query on
8888
// here we specify all statistic types for the "POP" (population) field
8989
List<StatisticDefinition> statisticDefinitions = Stream.of(StatisticType.values())
90-
.map(type -> new StatisticDefinition("POP", type, null))
91-
.collect(Collectors.toList());
90+
.map(type -> new StatisticDefinition("POP", type, null))
91+
.collect(Collectors.toList());
9292

9393
// create a button to perform the statistical query
9494
Button queryButton = new Button("Get Statistics");
@@ -114,11 +114,9 @@ public void start(Stage stage) throws Exception {
114114
try {
115115
StatisticsQueryResult result = query.get();
116116
StringBuilder statistics = new StringBuilder();
117-
for (Iterator<StatisticRecord> it = result.iterator(); it.hasNext(); ) {
117+
for (Iterator<StatisticRecord> it = result.iterator(); it.hasNext();) {
118118
StatisticRecord record = it.next();
119-
record.getStatistics().forEach((key, value) ->
120-
statistics.append("\n").append(key).append(": ").append(value)
121-
);
119+
record.getStatistics().forEach((key, value) -> statistics.append("\n").append(key).append(": ").append(value));
122120
}
123121
Alert alert = new Alert(Alert.AlertType.INFORMATION, statistics.toString());
124122
alert.setHeaderText("Statistics");
@@ -133,8 +131,11 @@ public void start(Stage stage) throws Exception {
133131
// layout the controls
134132
VBox controlsBox = new VBox(6);
135133
controlsBox.setAlignment(Pos.CENTER);
136-
controlsBox.setMaxSize(200, 120);
134+
controlsBox.setMaxSize(220, Double.MIN_VALUE);
137135
controlsBox.getStyleClass().add("panel-region");
136+
currentExtentFilterToggle.setMaxWidth(Double.MAX_VALUE);
137+
populationFilterToggle.setMaxWidth(Double.MAX_VALUE);
138+
queryButton.setMaxWidth(Double.MAX_VALUE);
138139
controlsBox.getChildren().addAll(currentExtentFilterToggle, populationFilterToggle, queryButton);
139140

140141
// add the map view and control panel to stack pane
@@ -152,7 +153,7 @@ public void start(Stage stage) throws Exception {
152153
* Stops and releases all resources used in application.
153154
*/
154155
@Override
155-
public void stop() throws Exception {
156+
public void stop() {
156157

157158
if (mapView != null) {
158159
mapView.dispose();

0 commit comments

Comments
 (0)