Added a controller and a fxml file for getting started.
This commit is contained in:
@@ -50,6 +50,23 @@ public class App extends Application
|
|||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
this.primaryStage = primaryStage;
|
this.primaryStage = primaryStage;
|
||||||
|
//after all loading then load the previous session
|
||||||
|
try{
|
||||||
|
FileInputStream fileIn = new FileInputStream("res/session.ser");
|
||||||
|
ObjectInputStream objectIn = new ObjectInputStream(fileIn);
|
||||||
|
session = (Session) objectIn.readObject();
|
||||||
|
objectIn.close();
|
||||||
|
fileIn.close();
|
||||||
|
}catch(IOException e){
|
||||||
|
session = new Session();
|
||||||
|
System.out.println("New Session File Created");
|
||||||
|
}catch(ClassNotFoundException e){
|
||||||
|
System.out.println("Missing Session Class");
|
||||||
|
System.exit(1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
session = new Session();
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
//load the menu and the first container
|
//load the menu and the first container
|
||||||
try {
|
try {
|
||||||
FXMLLoader loader = new FXMLLoader();
|
FXMLLoader loader = new FXMLLoader();
|
||||||
@@ -61,6 +78,9 @@ public class App extends Application
|
|||||||
primaryStage.sizeToScene();
|
primaryStage.sizeToScene();
|
||||||
menuController = (MenuController) loader.getController();
|
menuController = (MenuController) loader.getController();
|
||||||
menuController.setApp(this);
|
menuController.setApp(this);
|
||||||
|
|
||||||
|
menuController.replaceSceneContent(SceneCode.INITIAL);
|
||||||
|
|
||||||
in.close();
|
in.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -78,25 +98,13 @@ public class App extends Application
|
|||||||
}catch (DataException e){
|
}catch (DataException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
//after all loading then load the previous session
|
Controller controller = null;
|
||||||
try{
|
try {
|
||||||
FileInputStream fileIn = new FileInputStream("res/session.ser");
|
controller = (Controller) replaceSceneContent(session.getSceneDisplayed());
|
||||||
ObjectInputStream objectIn = new ObjectInputStream(fileIn);
|
|
||||||
session = (Session) objectIn.readObject();
|
|
||||||
Controller controller = (Controller) replaceSceneContent(session.getSceneDisplayed());
|
|
||||||
controller.setApp(this);
|
controller.setApp(this);
|
||||||
controller.load();
|
controller.load();
|
||||||
controller.loadOnce();
|
controller.loadOnce();
|
||||||
objectIn.close();
|
|
||||||
fileIn.close();
|
|
||||||
}catch(IOException e){
|
|
||||||
session = new Session();
|
|
||||||
System.out.println("New Session File Created");
|
|
||||||
}catch(ClassNotFoundException e){
|
|
||||||
System.out.println("Missing Session Class");
|
|
||||||
System.exit(1);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
session = new Session();
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package seng202.group9.Controller;
|
|||||||
* SceneCode enum is used for Serialization of sessions as well as changing the GUI state from one to the other.
|
* SceneCode enum is used for Serialization of sessions as well as changing the GUI state from one to the other.
|
||||||
*/
|
*/
|
||||||
public enum SceneCode {
|
public enum SceneCode {
|
||||||
INITIAL(""), AIRLINE_SUMMARY("airline_summary.fxml"), AIRLINE_RAW_DATA("airline_raw_data.fxml"),
|
INITIAL("getting_started.fxml"), AIRLINE_SUMMARY("airline_summary.fxml"), AIRLINE_RAW_DATA("airline_raw_data.fxml"),
|
||||||
AIRPORT_SUMMARY("airport_summary.fxml"), AIRPORT_RAW_DATA("airport_raw_data.fxml"),
|
AIRPORT_SUMMARY("airport_summary.fxml"), AIRPORT_RAW_DATA("airport_raw_data.fxml"),
|
||||||
ROUTE_SUMMARY("routes_summary.fxml"), ROUTE_RAW_DATA("route_raw_data.fxml"), FLIGHT_SUMMARY("flight_data_summary.fxml"),
|
ROUTE_SUMMARY("routes_summary.fxml"), ROUTE_RAW_DATA("route_raw_data.fxml"), FLIGHT_SUMMARY("flight_data_summary.fxml"),
|
||||||
FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.fxml"),
|
FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.fxml"),
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package seng202.group9.GUI;
|
||||||
|
|
||||||
|
import seng202.group9.Controller.SceneCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by spe76 on 26/09/16.
|
||||||
|
*/
|
||||||
|
public class GettingStartedController extends Controller {
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void importAirlines() {
|
||||||
|
Importer importer = new Importer(SceneCode.AIRLINE_RAW_DATA, getParent(), getParent().getPrimaryStage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void importAirports() {
|
||||||
|
Importer importer = new Importer(SceneCode.AIRPORT_RAW_DATA, getParent(), getParent().getPrimaryStage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void importRoutes() {
|
||||||
|
Importer importer = new Importer(SceneCode.ROUTE_RAW_DATA, getParent(), getParent().getPrimaryStage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void importFlightData() {
|
||||||
|
Importer importer = new Importer(SceneCode.FLIGHT_RAW_DATA, getParent(), getParent().getPrimaryStage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goToAirlineSummary() {
|
||||||
|
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -74,6 +74,10 @@ public class MenuController extends Controller{
|
|||||||
replaceSceneContent(SceneCode.FLIGHT_RAW_DATA);
|
replaceSceneContent(SceneCode.FLIGHT_RAW_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void goToGettingStarted() {
|
||||||
|
replaceSceneContent(SceneCode.INITIAL);
|
||||||
|
}
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
//nothing to load
|
//nothing to load
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.GettingStartedController">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="160.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints maxHeight="453.0" minHeight="0.0" prefHeight="444.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints maxHeight="505.0" minHeight="10.0" prefHeight="150.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints maxHeight="293.0" minHeight="10.0" prefHeight="100.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
|
<children>
|
||||||
|
<Button mnemonicParsing="false" onAction="#importAirlines" text="Import Airlines" GridPane.halignment="CENTER" GridPane.rowIndex="2">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</Button>
|
||||||
|
<Button mnemonicParsing="false" onAction="#importAirports" text="Import Airports" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</Button>
|
||||||
|
<Button mnemonicParsing="false" onAction="#importRoutes" text="Import Routes" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="2">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</Button>
|
||||||
|
<Button mnemonicParsing="false" onAction="#importFlightData" text="Import Flights" GridPane.columnIndex="3" GridPane.halignment="CENTER" GridPane.rowIndex="2">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</Button>
|
||||||
|
<Label text="Welcome to this screen!" GridPane.columnSpan="5" GridPane.halignment="CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="36.0" />
|
||||||
|
</font>
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets left="15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</Label>
|
||||||
|
<Label prefHeight="31.0" prefWidth="489.0" text="To get started, select which type of data you" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="TOP">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
<font>
|
||||||
|
<Font size="20.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<Button mnemonicParsing="false" onAction="#goToAirlineSummary" text="Blank Dataset" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="2">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</Button>
|
||||||
|
<Label layoutX="185.0" layoutY="427.0" prefHeight="31.0" prefWidth="489.0" text="wish to import or start from a blank dataset." GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="20.0" />
|
||||||
|
</font>
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="15.0" left="15.0" right="15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
<padding>
|
||||||
|
<Insets top="15.0" />
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
<?import javafx.scene.control.Menu?>
|
<?import javafx.scene.control.Menu?>
|
||||||
<?import javafx.scene.control.MenuBar?>
|
<?import javafx.scene.control.MenuBar?>
|
||||||
<?import javafx.scene.control.MenuItem?>
|
<?import javafx.scene.control.MenuItem?>
|
||||||
<?import javafx.scene.control.SeparatorMenuItem?>
|
<?import javafx.scene.control.SeparatorMenuItem?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.MenuController">
|
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.MenuController">
|
||||||
<children>
|
<children>
|
||||||
<MenuBar>
|
<MenuBar>
|
||||||
<menus>
|
<menus>
|
||||||
@@ -49,6 +52,11 @@
|
|||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false" onAction="#veiwDistCalc" text="Calculate distance between Airports" />
|
<MenuItem mnemonicParsing="false" onAction="#veiwDistCalc" text="Calculate distance between Airports" />
|
||||||
</items></Menu>
|
</items></Menu>
|
||||||
|
<Menu mnemonicParsing="false" text="Help">
|
||||||
|
<items>
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#goToGettingStarted" text="Getting Started" />
|
||||||
|
</items>
|
||||||
|
</Menu>
|
||||||
</menus>
|
</menus>
|
||||||
</MenuBar>
|
</MenuBar>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.ContextMenu?>
|
<?import javafx.scene.control.ContextMenu?>
|
||||||
@@ -13,7 +18,7 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<GridPane alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.RouteRDController">
|
<GridPane alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.RouteRDController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
@@ -80,5 +85,18 @@
|
|||||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Label text="Note: Airline, source airport and destination airports" GridPane.columnIndex="1" GridPane.valignment="TOP">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets />
|
||||||
|
</GridPane.margin>
|
||||||
|
<padding>
|
||||||
|
<Insets top="5.0" />
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
|
<Label text="are in either IATA or ICAO code." GridPane.columnIndex="1">
|
||||||
|
<padding>
|
||||||
|
<Insets top="5.0" />
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
|||||||
Reference in New Issue
Block a user