Added PromptLayer over ResponseArea
This commit is contained in:
parent
115c96a3aa
commit
8a193c6d0b
3 changed files with 65 additions and 7 deletions
|
@ -49,7 +49,7 @@ public class DashboardController implements Initializable {
|
|||
@FXML
|
||||
private ComboBox<String> httpMethodBox;
|
||||
@FXML
|
||||
private VBox responseBox, loadingLayer;
|
||||
private VBox responseBox, loadingLayer, promptLayer;
|
||||
@FXML
|
||||
private HBox responseDetails;
|
||||
@FXML
|
||||
|
@ -91,6 +91,7 @@ public class DashboardController implements Initializable {
|
|||
|
||||
addressField.setText("https://api.chucknorris.io/jokes/random");
|
||||
responseBox.getChildren().remove(0);
|
||||
promptLayer.setVisible(true);
|
||||
httpMethodBox.getItems().addAll(httpMethods);
|
||||
httpMethodBox.getSelectionModel().select(1);
|
||||
|
||||
|
@ -101,8 +102,11 @@ public class DashboardController implements Initializable {
|
|||
|
||||
@FXML
|
||||
private void sendAction() {
|
||||
if (responseBox.getChildren().size() == 2)
|
||||
promptLayer.setVisible(false);
|
||||
if (responseBox.getChildren().size() == 2) {
|
||||
responseBox.getChildren().remove(0);
|
||||
responseArea.clear();
|
||||
}
|
||||
try {
|
||||
String address = addressField.getText();
|
||||
if (address.equals("")) {
|
||||
|
@ -192,8 +196,10 @@ public class DashboardController implements Initializable {
|
|||
default:
|
||||
loadingLayer.setVisible(false);
|
||||
}
|
||||
} catch (MalformedURLException ex) {
|
||||
} catch (MalformedURLException MURLE) {
|
||||
snackBar.show("Invalid address. Please verify and try again.", 3000);
|
||||
} catch (Exception E) {
|
||||
snackBar.show("Something went wrong. Couldn't process request.", 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,4 +217,11 @@ public class DashboardController implements Initializable {
|
|||
"-fx-font-size: " + Settings.responseAreaFontSize;
|
||||
responseArea.setStyle(responseAreaCSS);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void clearResponseArea() {
|
||||
responseBox.getChildren().remove(0);
|
||||
responseArea.clear();
|
||||
promptLayer.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,10 @@
|
|||
-fx-background-color: #1b1b1b;
|
||||
}
|
||||
|
||||
#clearResponseAreaButton {
|
||||
-fx-background-color: #454545;
|
||||
}
|
||||
|
||||
.text-area {
|
||||
-fx-font-family: "Liberation Mono";
|
||||
-fx-text-fill: #a1a1a1;
|
||||
|
@ -58,6 +62,10 @@
|
|||
-fx-background-color: #bf8829;
|
||||
}
|
||||
|
||||
#promptLayer {
|
||||
-fx-background-color: #273154;
|
||||
}
|
||||
|
||||
#cancelButton {
|
||||
-fx-background-color: black;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,8 @@
|
|||
<children>
|
||||
<HBox alignment="CENTER_LEFT" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label fx:id="statusCode" text="404" textFill="WHITE">
|
||||
<Label fx:id="statusCode" text="404" textFill="WHITE"
|
||||
HBox.hgrow="ALWAYS">
|
||||
<font>
|
||||
<Font name="System Bold" size="35.0"/>
|
||||
</font>
|
||||
|
@ -101,14 +102,15 @@
|
|||
</HBox.margin>
|
||||
</Label>
|
||||
<Label fx:id="statusCodeDescription" text="Not Found"
|
||||
textFill="WHITE">
|
||||
textFill="WHITE" HBox.hgrow="ALWAYS">
|
||||
<font>
|
||||
<Font size="30.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</HBox>
|
||||
<Label fx:id="responseTime" text="151 ms" textFill="WHITE">
|
||||
<Label fx:id="responseTime" text="151 ms" textFill="WHITE"
|
||||
HBox.hgrow="ALWAYS">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0"/>
|
||||
</HBox.margin>
|
||||
|
@ -117,11 +119,30 @@
|
|||
</font>
|
||||
</Label>
|
||||
<Label fx:id="responseSize" layoutX="1187.0" layoutY="23.0" text="1998 B"
|
||||
textFill="WHITE">
|
||||
textFill="WHITE" HBox.hgrow="ALWAYS">
|
||||
<font>
|
||||
<Font name="Liberation Mono" size="20.0"/>
|
||||
</font>
|
||||
<HBox.margin>
|
||||
<Insets right="30.0"/>
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<JFXButton fx:id="clearResponseAreaButton" buttonType="RAISED"
|
||||
onAction="#clearResponseArea" ripplerFill="WHITE" text=" CLEAR"
|
||||
textFill="WHITE" HBox.hgrow="ALWAYS">
|
||||
<graphic>
|
||||
<ImageView fitHeight="15.0" fitWidth="15.0" pickOnBounds="true"
|
||||
preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../../assets/CrossMark.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
<tooltip>
|
||||
<Tooltip autoHide="true"
|
||||
text="Clears this bar and the response body below."/>
|
||||
</tooltip>
|
||||
</JFXButton>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/>
|
||||
|
@ -161,6 +182,22 @@
|
|||
</JFXButton>
|
||||
</children>
|
||||
</VBox>
|
||||
<VBox fx:id="promptLayer" alignment="CENTER" prefHeight="200.0"
|
||||
prefWidth="100.0" visible="false">
|
||||
<children>
|
||||
<Label text="Enter an address, select a method and hit send."
|
||||
textFill="WHITE">
|
||||
<font>
|
||||
<Font size="32.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="It's not rocket science." textFill="#9e9e9e">
|
||||
<font>
|
||||
<Font name="System Italic" size="27.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
|
|
Loading…
Reference in a new issue