Added basic UI elements to Dashboard

This commit is contained in:
Rohit Awate 2018-01-18 22:23:57 +05:30
parent f11856e4bb
commit 40b55c8c54
6 changed files with 143 additions and 2 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
nb-configuration.xml
/target/

View file

@ -10,4 +10,12 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.jfoenix/jfoenix -->
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,64 @@
/*
* Copyright 2018 Rohit Awate.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rohitawate.restaurant.dashboard;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
/**
* FXML Controller class
*
* @author Rohit Awate
*/
public class DashboardController implements Initializable {
@FXML
private TextField addressField;
@FXML
private ComboBox<String> httpMethodBox;
@FXML
private TextArea responseArea;
private final String[] httpMethods = {"GET", "POST", "PUT", "DELETE", "PATCH"};
@Override
public void initialize(URL url, ResourceBundle rb) {
httpMethodBox.getItems().addAll(httpMethods);
httpMethodBox.setValue("GET");
responseArea.wrapTextProperty().set(true);
}
@FXML
private void sendAction() {
}
}

View file

@ -15,12 +15,27 @@
*/
package com.rohitawate.restaurant.main;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author Rohit Awate
*/
public class Main {
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Parent dashboard = FXMLLoader.load(getClass().getResource("/fxml/Dashboard.fxml"));
Stage dashboardStage = new Stage();
dashboardStage.setScene(new Scene(dashboard));
dashboardStage.setTitle("RESTaurant");
dashboardStage.show();
}
public static void main(String args[]) {
launch(args);
}
}

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="720.0" prefWidth="1280.0" stylesheets="@../styles/dashboard.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.rohitawate.restaurant.dashboard.DashboardController">
<center>
<VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER">
<children>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
<children>
<TextField fx:id="addressField" maxWidth="500.0" promptText="URL" HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets right="20.0" />
</HBox.margin>
</TextField>
<ComboBox fx:id="httpMethodBox" prefWidth="150.0">
<HBox.margin>
<Insets right="20.0" />
</HBox.margin>
</ComboBox>
<JFXButton fx:id="sendButton" buttonType="RAISED" defaultButton="true" onAction="#sendAction" prefWidth="100.0" text="SEND" textFill="WHITE">
<padding>
<Insets bottom="10.0" left="20.0" right="20.0" top="10.0" />
</padding>
</JFXButton>
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</HBox>
<TextArea fx:id="responseArea" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</VBox>
</center>
</BorderPane>

View file

@ -0,0 +1,7 @@
#sendButton {
-fx-background-color: lightslategray;
}
#responseArea {
-fx-font-family: 'Liberation Mono';
}