Liam Beckett 9 years ago
commit d43fd1bdd6

Binary file not shown.

@ -27,6 +27,7 @@ public class App extends Application
private Stage primaryStage = null;
private VBox mainContainer;
private Session session;
private MenuController menuController;
public static void main( String[] args )
{
@ -53,7 +54,7 @@ public class App extends Application
primaryStage.setResizable(false);
primaryStage.setScene(scene);
primaryStage.sizeToScene();
MenuController menuController = (MenuController) loader.getController();
menuController = (MenuController) loader.getController();
menuController.setApp(this);
in.close();
} catch (Exception e) {
@ -180,6 +181,10 @@ public class App extends Application
return (Initializable) loader.getController();
}
public MenuController getMenuController() {
return menuController;
}
public Dataset getCurrentDataset(){
return currentDataset;
}

@ -8,13 +8,15 @@ import seng202.group9.Controller.AirlineFilter;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.Airline;
import javax.swing.*;
/**
* The GUI controller class for airline_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/13.
* Created by Sunguin
*/
public class AirlineRDController extends Controller {
//Setting up the table from the FXML file
@FXML
private TableView<Airline> tableViewAirlineRD;
@FXML
@ -34,6 +36,7 @@ public class AirlineRDController extends Controller {
@FXML
private TableColumn<Airline, String> airlActivecol;
//Setting up text fields for adding data
@FXML
private TextField airlNameBox;
@FXML
@ -49,6 +52,7 @@ public class AirlineRDController extends Controller {
@FXML
private ComboBox<String> airlActiveCBox;
//Setting up text fields for filtering data
@FXML
private TextField airlNameFilter;
@FXML
@ -64,6 +68,7 @@ public class AirlineRDController extends Controller {
@FXML
private TextField airlActiveFilter;
//Set an empty Dataset to be assigned later.
private Dataset theDataSet = null;
/**
@ -71,6 +76,7 @@ public class AirlineRDController extends Controller {
* Also sets up the dropdown menu options.
*/
public void load() {
//Sets up the table columns to be ready for use for Airline data
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
@ -80,9 +86,11 @@ public class AirlineRDController extends Controller {
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
//Assigning the Dataset to the current Dataset's airlines and displaying it in a table
theDataSet = getParent().getCurrentDataset();
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
//Initializes the value for the drop-down menu for Active for adding a new Airline
airlActiveCBox.setValue("Y");
airlActiveCBox.getItems().addAll("Y", "N");
}
@ -93,6 +101,8 @@ public class AirlineRDController extends Controller {
* @see Dataset
*/
public void addAirlineSingle() {
//Tries to add a new airline and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addAirline(
airlNameBox.getText(),
@ -126,6 +136,7 @@ public class AirlineRDController extends Controller {
* @see Dataset
*/
public void deleteAirline() {
//Gets an airline from the table and deletes it before updating the table
Airline toDelete = tableViewAirlineRD.getSelectionModel().getSelectedItem();
theDataSet.deleteAirline(toDelete);
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
@ -138,6 +149,7 @@ public class AirlineRDController extends Controller {
* @see AirlineFilter
*/
public void filterAirlines() {
//The filter function also operates like a search function
AirlineFilter filter = new AirlineFilter(theDataSet.getAirlines());
if (airlNameFilter.getText() != null) {
filter.filterName(airlNameFilter.getText());
@ -160,6 +172,15 @@ public class AirlineRDController extends Controller {
if (airlActiveFilter.getText() != null) {
filter.filterActive(airlActiveFilter.getText());
}
//Sets the data according to the criteria specified by the user.
tableViewAirlineRD.setItems(FXCollections.<Airline>observableArrayList(filter.getFilteredData()));
}
/**
* Analyses the current data and creates a graph based on the data.
* Currently not implemented yet.
*/
public void analyse_Button() {
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
}
}

@ -14,10 +14,10 @@ import static javafx.collections.FXCollections.observableArrayList;
/**
* The GUI controller class for airport_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/13.
* Created by Sunguin
*/
public class AirportRDController extends Controller{
//Setting up the table from the FXML file
@FXML
private TableView<Airport> tableViewAirportRD;
@FXML
@ -45,6 +45,7 @@ public class AirportRDController extends Controller{
@FXML
private TableColumn<Airport, String> airpTzcol;
//Setting up text fields for adding data
@FXML
private TextField airpNameBox;
@FXML
@ -68,6 +69,7 @@ public class AirportRDController extends Controller{
@FXML
private TextField airpTzBox;
//Setting up text fields for filtering data
@FXML
private TextField airpNameFilter;
@FXML
@ -91,6 +93,7 @@ public class AirportRDController extends Controller{
@FXML
private TextField airpTzFilter;
//Set an empty Dataset to be assigned later
private Dataset theDataSet = null;
/**
@ -98,6 +101,7 @@ public class AirportRDController extends Controller{
* Also sets up the dropdown menu options.
*/
public void load() {
//Sets up the table columns to be ready for use for Airport data
airpIDcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ID"));
airpNamecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
airpCitycol.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
@ -111,10 +115,12 @@ public class AirportRDController extends Controller{
airpDSTcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("DST"));
airpTzcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Tz"));
//Assigning the Dataset to the current Dataset's airports and displaying it in a table
theDataSet = getParent().getCurrentDataset();
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
airpDSTCBox.setValue("E");
airpDSTCBox.setValue("E");//Initializes the value for the drop-down menu for DST for adding a new Airport
airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U");
}
@ -124,6 +130,8 @@ public class AirportRDController extends Controller{
* @see Dataset
*/
public void addAirportSingle() {
//Tries to add a new airport and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addAirport(
airpNameBox.getText(),
@ -158,16 +166,13 @@ public class AirportRDController extends Controller{
}
}
public void airportAnalyserButton() {
replaceSceneContent(SceneCode.AIRPORT_ANALYSER);
}
/**
* Deletes a single selected airport entry from the database.
* Updates the GUI accordingly.
* @see Dataset
*/
public void deleteAirport(){
//Gets an airport from the table and deletes it before updating the table
Airport toDelete = tableViewAirportRD.getSelectionModel().getSelectedItem();
theDataSet.deleteAirport(toDelete);
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
@ -180,6 +185,7 @@ public class AirportRDController extends Controller{
* @see AirportFilter
*/
public void filterAirports() {
//The filter function also operates like a search function
AirportFilter filter = new AirportFilter(theDataSet.getAirports());
if (airpNameFilter.getText() != null) {
filter.filterName(airpNameFilter.getText());
@ -214,6 +220,13 @@ public class AirportRDController extends Controller{
if (airpTzFilter.getText() != null) {
filter.filterOlson(airpTzFilter.getText());
}
//Sets the data according to the criteria specified by the user
tableViewAirportRD.setItems(FXCollections.<Airport>observableArrayList(filter.getFilteredData()));
}
/**
* Analyses the current data and creates a graph based on the data.
* @see AirportAnalyser
*/
public void analyse_Button(){ replaceSceneContent(SceneCode.AIRPORT_ANALYSER);}
}

@ -40,7 +40,7 @@ public class AirportSummaryController extends Controller{
private Map map;
public void airportRawDataButton() {
replaceSceneContent(SceneCode.AIRLINE_RAW_DATA);
replaceSceneContent(SceneCode.AIRPORT_RAW_DATA);
}
public void flightSummaryButton() {
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
@ -55,8 +55,8 @@ public class AirportSummaryController extends Controller{
public void load() {
currentData = getParent().getCurrentDataset();
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("City"));
columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("Country"));
columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("CountryName"));
columnIATA.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA"));
columnAltitude.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
currentData = getParent().getCurrentDataset();

@ -30,26 +30,38 @@ public class Importer{
if (scene == SceneCode.AIRLINE_RAW_DATA) {
try {
showSuccessAlert(parent.getCurrentDataset().importAirline(file.getPath()));
parent.getMenuController().replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
} catch (DataException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
} else if (scene == SceneCode.AIRPORT_RAW_DATA) {
try {
showSuccessAlert(parent.getCurrentDataset().importAirport(file.getPath()));
parent.getMenuController().replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
} catch (DataException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
} else if (scene == SceneCode.ROUTE_RAW_DATA) {
try {
showSuccessAlert(parent.getCurrentDataset().importRoute(file.getPath()));
parent.getMenuController().replaceSceneContent(SceneCode.ROUTE_SUMMARY);
} catch (DataException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
} else if (scene == SceneCode.FLIGHT_RAW_DATA) {
try {
showSuccessAlert(parent.getCurrentDataset().importFlight(file.getPath()));
parent.getMenuController().replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
} catch (DataException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -12,10 +12,10 @@ import seng202.group9.Core.Route;
/**
* The GUI controller class for route_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/14.
* Created by Sunguin
*/
public class RouteRDController extends Controller {
//Setting up the table from the FXML file
@FXML
private TableView<Route> tableViewRouteRD;
@FXML
@ -37,6 +37,7 @@ public class RouteRDController extends Controller {
@FXML
private TableColumn<Route, String> rEquipmentCol;
//Setting up text fields for adding data
@FXML
private TextField rAirlineBox;
@FXML
@ -50,6 +51,7 @@ public class RouteRDController extends Controller {
@FXML
private TextField rEquipmentBox;
//Setting up text fields for filtering data
@FXML
private TextField rAirlineFilter;
@FXML
@ -63,6 +65,7 @@ public class RouteRDController extends Controller {
@FXML
private TextField rEquipmentFilter;
//Set an empty Dataset to be assigned later
private Dataset theDataSet = null;
/**
@ -70,6 +73,7 @@ public class RouteRDController extends Controller {
* Also sets up the dropdown menu options.
*/
public void load() {
//Sets up the table columns to be ready for use for Route data
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
@ -80,9 +84,11 @@ public class RouteRDController extends Controller {
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
//Assigning the Dataset to the current Dataset's routes and displaying it in a table
theDataSet = getParent().getCurrentDataset();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
//Initializes the value for the drop-down menu for Codeshare for adding a new Route
rCodeshareCBox.setValue("");
rCodeshareCBox.getItems().addAll("Y", "");
}
@ -93,6 +99,8 @@ public class RouteRDController extends Controller {
* @see Dataset
*/
public void addRouteSingle() {
//Tries to add a new route and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addRoute(
rAirlineBox.getText(),
@ -125,6 +133,7 @@ public class RouteRDController extends Controller {
* @see Dataset
*/
public void deleteRoute(){
//Gets a route from the table and deletes it before updating the table
Route toDelete = tableViewRouteRD.getSelectionModel().getSelectedItem();
theDataSet.deleteRoute(toDelete);
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
@ -137,6 +146,7 @@ public class RouteRDController extends Controller {
* @see RouteFilter
*/
public void filterRoutes(){
//The filter function also operates like a search function
RouteFilter filter = new RouteFilter(theDataSet.getRoutes());
if (rAirlineFilter.getText() != null) {
filter.filterAirline(rAirlineFilter.getText());
@ -156,9 +166,14 @@ public class RouteRDController extends Controller {
if (rEquipmentFilter.getText() != null) {
filter.filterEquipment(rEquipmentFilter.getText());
}
//Sets the data according to the criteria specified by the user
tableViewRouteRD.setItems(FXCollections.<Route>observableArrayList(filter.getFilteredData()));
}
/**
* Analyses the current data and creates a graph based on the data.
* @see RouteAnalyser
*/
public void analyse_Button() {
replaceSceneContent(SceneCode.ROUTE_ANALYSER);
}

@ -33,7 +33,7 @@
<Font size="29.0" />
</font>
</Label>
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" onAction="#analyse_Button" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="654.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirlineSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="14.0" layoutY="57.0" prefHeight="340.0" prefWidth="765.0">
<children>

@ -28,7 +28,8 @@
<Pane layoutX="15.0" layoutY="60.0" prefHeight="403.0" prefWidth="772.0">
<children>
<PieChart fx:id="pieGraph" prefHeight="400.0" prefWidth="772.0" title="Airports per country" />
</children></Pane>
</children>
</Pane>
</children>
</Pane>
</children>

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.chart.BarChart?>
<?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.RouteAnalyser">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="457.0" minHeight="10.0" prefHeight="403.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="457.0" minHeight="10.0" prefHeight="403.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane prefHeight="510.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowSpan="2">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Route Analyser">
<font>
<Font size="29.0" />
</font>
</Label>
<Pane layoutX="16.0" layoutY="53.0" prefHeight="403.0" prefWidth="765.0">
<children>
<BarChart fx:id="analyserGraph" prefHeight="403.0" prefWidth="740.0" title="Routes Arriving at or Departing from each Airport">
<xAxis>
<CategoryAxis label="Airports" side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis label="Number" side="LEFT" />
</yAxis>
</BarChart>
</children>
</Pane>
</children>
</Pane>
</children>
</GridPane>

@ -93,7 +93,7 @@
</Pane>
</content>
</ScrollPane>
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" onAction="#analyse_Button" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="653.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirportSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="15.0" layoutY="60.0" prefHeight="342.0" prefWidth="764.0">
<children>

Loading…
Cancel
Save