Added loading animation on Dashboard while request is processing
This commit is contained in:
parent
68332f93b6
commit
107a8e1266
3 changed files with 29 additions and 3 deletions
|
@ -45,7 +45,7 @@ public class DashboardController implements Initializable {
|
|||
@FXML
|
||||
private VBox responseBox;
|
||||
@FXML
|
||||
private HBox responseDetails;
|
||||
private HBox responseDetails, loadingLayer;
|
||||
@FXML
|
||||
private TextArea responseArea;
|
||||
@FXML
|
||||
|
@ -77,7 +77,14 @@ public class DashboardController implements Initializable {
|
|||
case "GET":
|
||||
GETRequest getRequest = new GETRequest(addressField.getText());
|
||||
requestManager = new GETRequestManager(getRequest);
|
||||
requestManager.setOnSucceeded(e -> updateDashboard(requestManager.getValue()));
|
||||
requestManager.setOnRunning(e -> {
|
||||
responseArea.clear();
|
||||
loadingLayer.setVisible(true);
|
||||
});
|
||||
requestManager.setOnSucceeded(e -> {
|
||||
updateDashboard(requestManager.getValue());
|
||||
loadingLayer.setVisible(false);
|
||||
});
|
||||
new Thread(requestManager).start();
|
||||
break;
|
||||
default:
|
||||
|
|
BIN
src/main/resources/assets/LoadingCircle_BlackOnGrey.gif
Normal file
BIN
src/main/resources/assets/LoadingCircle_BlackOnGrey.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
|
@ -89,7 +89,26 @@
|
|||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/>
|
||||
</padding>
|
||||
</HBox>
|
||||
<TextArea fx:id="responseArea" editable="false" wrapText="true" VBox.vgrow="ALWAYS"/>
|
||||
<StackPane VBox.vgrow="ALWAYS">
|
||||
<children>
|
||||
<TextArea fx:id="responseArea" editable="false" wrapText="true"/>
|
||||
<HBox fx:id="loadingLayer" alignment="CENTER" visible="false">
|
||||
<children>
|
||||
<ImageView fitHeight="150.0" fitWidth="100.0" pickOnBounds="true"
|
||||
preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../assets/LoadingCircle_BlackOnGrey.gif"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
<Label text="LOADING">
|
||||
<font>
|
||||
<Font size="70.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
|
|
Loading…
Reference in a new issue