Skip to content

Commit f5aab10

Browse files
committed
added save progress indicator
1 parent 3b693e8 commit f5aab10

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/main/java/com/esri/samples/map/create_and_save_map/CreateAndSaveMapController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import javafx.scene.control.Dialog;
4242
import javafx.scene.control.ListCell;
4343
import javafx.scene.control.ListView;
44+
import javafx.scene.control.ProgressIndicator;
4445
import javafx.scene.control.SelectionMode;
4546
import javafx.scene.control.TextArea;
4647
import javafx.scene.control.TextField;
@@ -57,6 +58,7 @@ public class CreateAndSaveMapController {
5758
@FXML private ListView<Basemap> basemapList;
5859
@FXML private ListView<Layer> layersList;
5960
@FXML private Button saveButton;
61+
@FXML private ProgressIndicator progress;
6062

6163
private ArcGISMap map;
6264
private Portal portal;
@@ -184,6 +186,7 @@ protected void updateItem(Layer layer, boolean empty) {
184186
*/
185187
@FXML
186188
private void saveMap() {
189+
progress.setVisible(true);
187190
try {
188191
ListenableFuture<PortalItem> result = map.saveAsAsync(portal, folderList.getSelectionModel().getSelectedItem(),
189192
title.getText(), Arrays.asList(tags.getText().split(",")), description.getText(), null, true);
@@ -194,9 +197,12 @@ private void saveMap() {
194197
portalItem.getItemId(), Alert.AlertType.INFORMATION);
195198
} catch (InterruptedException | ExecutionException e) {
196199
showMessage("Save Unscuccessful", e.getCause().getMessage(), Alert.AlertType.ERROR);
200+
} finally {
201+
progress.setVisible(false);
197202
}
198203
});
199204
} catch (Exception e) {
205+
progress.setVisible(false);
200206
showMessage("Could not save map", e.getMessage(), Alert.AlertType.ERROR);
201207
}
202208
}

src/main/resources/fxml/create_and_save_map.fxml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<?import javafx.scene.control.Button?>
2525
<?import javafx.scene.layout.HBox?>
2626
<?import javafx.scene.control.ComboBox?>
27+
<?import javafx.scene.control.ProgressIndicator?>
2728
<StackPane fx:controller="com.esri.samples.map.create_and_save_map.CreateAndSaveMapController" xmlns:fx="http://javafx.com/fxml"
2829
stylesheets="/css/style.css">
2930
<MapView fx:id="mapView"/>
@@ -56,5 +57,6 @@
5657
<Button fx:id="saveButton" text="Save" onAction="#saveMap" disable="true"/>
5758
</HBox>
5859
</VBox>
60+
<ProgressIndicator fx:id="progress" maxWidth="30" maxHeight="30" visible="false"/>
5961
</StackPane>
6062

0 commit comments

Comments
 (0)