updated comment, increased vbox size, removed unnecessary done loading listeners
@@ -56,7 +56,7 @@ public class QueryMapImageSublayerSample extends Application {
public void start(Stage stage) throws Exception {
try {
- // create a border pane and application scene
+ // create a stack pane and application scene
StackPane stackPane = new StackPane();
Scene scene = new Scene(stackPane);
scene.getStylesheets().add(getClass().getResource("/css/style.css").toExternalForm());
@@ -95,7 +95,7 @@ public class QueryMapImageSublayerSample extends Application {
// create a vbox to hold the controls
VBox vBoxControl = new VBox(6);
- vBoxControl.setMaxSize(160, 100);
+ vBoxControl.setMaxSize(170, 100);
vBoxControl.getStyleClass().add("panel-region");
// create a spinner to input the population filter
@@ -136,7 +136,6 @@ public class QueryMapImageSublayerSample extends Application {
.getTargetGeometry());
// query each sublayer's feature table with the query parameters and display the result features as graphics
- citiesSublayer.addDoneLoadingListener(() -> {
if (citiesSublayer.getLoadStatus() == LoadStatus.LOADED) {
ServiceFeatureTable citiesTable = citiesSublayer.getTable();
ListenableFuture<FeatureQueryResult> citiesQuery = citiesTable.queryFeaturesAsync(populationQuery);
@@ -152,9 +151,7 @@ public class QueryMapImageSublayerSample extends Application {
}
});
}
- });
- statesSublayer.addDoneLoadingListener(() -> {
if (statesSublayer.getLoadStatus() == LoadStatus.LOADED) {
ServiceFeatureTable statesTable = statesSublayer.getTable();
ListenableFuture<FeatureQueryResult> statesQuery = statesTable.queryFeaturesAsync(populationQuery);
@@ -170,9 +167,7 @@ public class QueryMapImageSublayerSample extends Application {
}
});
}
- });
- countiesSublayer.addDoneLoadingListener(() -> {
if (countiesSublayer.getLoadStatus() == LoadStatus.LOADED) {
ServiceFeatureTable countiesTable = countiesSublayer.getTable();
ListenableFuture<FeatureQueryResult> countiesQuery = countiesTable.queryFeaturesAsync(populationQuery);
@@ -188,8 +183,10 @@ public class QueryMapImageSublayerSample extends Application {
}
});
}
+
});
- });
+ } else {
+ new Alert(Alert.AlertType.ERROR, imageLayer.getLoadError().getMessage()).show();
}
});
