2727import javafx .scene .control .Accordion ;
2828import javafx .scene .control .Alert ;
2929import javafx .scene .control .ListView ;
30+ import javafx .scene .control .ProgressIndicator ;
3031import javafx .scene .control .TitledPane ;
3132import javafx .scene .input .MouseButton ;
3233import javafx .scene .layout .StackPane ;
4344import com .esri .arcgisruntime .geometry .Point ;
4445import com .esri .arcgisruntime .layers .FeatureLayer ;
4546import com .esri .arcgisruntime .mapping .ArcGISMap ;
47+ import com .esri .arcgisruntime .mapping .view .DrawStatus ;
4648import com .esri .arcgisruntime .mapping .view .MapView ;
4749
4850public class ListRelatedFeaturesSample extends Application {
@@ -64,6 +66,11 @@ public void start(Stage stage) {
6466 stage .setScene (scene );
6567 stage .show ();
6668
69+ // show a progress indicator while the map loads
70+ ProgressIndicator progressIndicator = new ProgressIndicator ();
71+ progressIndicator .setProgress (ProgressIndicator .INDETERMINATE_PROGRESS );
72+ progressIndicator .setMaxSize (25 , 25 );
73+
6774 // create an accordion view for displaying the related features according to their feature table
6875 Accordion accordion = new Accordion ();
6976 accordion .setMaxSize (200 , 300 );
@@ -75,6 +82,13 @@ public void start(Stage stage) {
7582 mapView = new MapView ();
7683 mapView .setMap (map );
7784
85+ // hide the progress indicator when the layer is done drawing
86+ mapView .addDrawStatusChangedListener (drawStatusChangedEvent -> {
87+ if (drawStatusChangedEvent .getDrawStatus () == DrawStatus .COMPLETED ) {
88+ progressIndicator .setVisible (false );
89+ }
90+ });
91+
7892 // wait until the map is done loading
7993 map .addDoneLoadingListener (() -> {
8094 // get the first feature layer for querying
@@ -152,9 +166,9 @@ public void start(Stage stage) {
152166 });
153167
154168 // add the map view and accordion view to stack pane
155- stackPane .getChildren ().addAll (mapView , accordion );
169+ stackPane .getChildren ().addAll (mapView , accordion , progressIndicator );
156170 StackPane .setAlignment (accordion , Pos .TOP_LEFT );
157-
171+ StackPane . setAlignment ( progressIndicator , Pos . CENTER );
158172 } catch (Exception e ) {
159173 // on any error, display the stack trace.
160174 e .printStackTrace ();
0 commit comments