Added Session and Controller Abstract Class
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,6 @@
|
|||||||
package seng202.group9.Controller;
|
package seng202.group9.Controller;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.*;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
@@ -15,7 +14,7 @@ import javafx.scene.layout.AnchorPane;
|
|||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import seng202.group9.GUI.MenuController;
|
import seng202.group9.GUI.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main Application frame of the Flight Data Analyser.
|
* Main Application frame of the Flight Data Analyser.
|
||||||
@@ -27,6 +26,7 @@ public class App extends Application
|
|||||||
private Dataset currentDataset = null;
|
private Dataset currentDataset = null;
|
||||||
private Stage primaryStage = null;
|
private Stage primaryStage = null;
|
||||||
private VBox mainContainer;
|
private VBox mainContainer;
|
||||||
|
private Session session;
|
||||||
|
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ public class App extends Application
|
|||||||
primaryStage.sizeToScene();
|
primaryStage.sizeToScene();
|
||||||
MenuController menuController = (MenuController) loader.getController();
|
MenuController menuController = (MenuController) loader.getController();
|
||||||
menuController.setApp(this);
|
menuController.setApp(this);
|
||||||
//replaceSceneContent("flight_raw_data.fxml");//replace this to check your fxml file
|
in.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -62,11 +62,12 @@ public class App extends Application
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
AirlineFilter filter = new AirlineFilter(currentDataset.getAirlines());
|
AirlineFilter filter = new AirlineFilter(currentDataset.getAirlines());
|
||||||
filter.filterName("NZ");
|
filter.filterName("NZ");
|
||||||
filter.filterAlias("flight");
|
filter.filterAlias("flight");
|
||||||
filter.printFilter();
|
filter.printFilter();
|
||||||
/*
|
|
||||||
//testout single route adding
|
//testout single route adding
|
||||||
try {
|
try {
|
||||||
currentDataset.addRoute("D2", "MAC", "WIN", "Y", "0", "NOW");
|
currentDataset.addRoute("D2", "MAC", "WIN", "Y", "0", "NOW");
|
||||||
@@ -110,18 +111,85 @@ public class App extends Application
|
|||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}*/
|
}*/
|
||||||
|
//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();
|
||||||
|
Controller controller = (Controller) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.load();
|
||||||
|
controller.loadOnce();/*
|
||||||
|
if (session.getSceneDisplayed() == SceneCode.AIRLINE_RAW_DATA){
|
||||||
|
Controller controller = (Controller) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.load();
|
||||||
|
}else if (session.getSceneDisplayed() == SceneCode.AIRLINE_SUMMARY){
|
||||||
|
Controller controller = (Controller) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.load();
|
||||||
|
}else if (session.getSceneDisplayed() == SceneCode.AIRPORT_RAW_DATA){
|
||||||
|
AirportRDController controller = (AirportRDController) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.loadTables();
|
||||||
|
}else if (session.getSceneDisplayed() == SceneCode.AIRPORT_SUMMARY){
|
||||||
|
AirportSummaryController controller = (AirportSummaryController) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.loadTables();
|
||||||
|
}else if (session.getSceneDisplayed() == SceneCode.ROUTE_RAW_DATA){
|
||||||
|
RouteRDController controller = (RouteRDController) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.loadTables();
|
||||||
|
}else if (session.getSceneDisplayed() == SceneCode.ROUTE_RAW_DATA){
|
||||||
|
RouteSummaryController controller = (RouteSummaryController) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.loadTables();
|
||||||
|
}else if (session.getSceneDisplayed() == SceneCode.FLIGHT_RAW_DATA){
|
||||||
|
FlightRawDataController controller = (FlightRawDataController) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.loadTables();
|
||||||
|
}else if (session.getSceneDisplayed() == SceneCode.FLIGHT_SUMMARY){
|
||||||
|
FlightSummaryController controller = (FlightSummaryController) replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
controller.setApp(this);
|
||||||
|
controller.flightPathListView();
|
||||||
|
}*/
|
||||||
|
objectIn.close();
|
||||||
|
fileIn.close();
|
||||||
|
}catch(IOException e){
|
||||||
|
session = new Session();
|
||||||
|
e.printStackTrace();
|
||||||
|
}catch(ClassNotFoundException e){
|
||||||
|
System.out.println("Missing Session Class");
|
||||||
|
System.exit(1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the exiting session
|
||||||
|
*/
|
||||||
|
public void stop(){
|
||||||
|
try{
|
||||||
|
FileOutputStream fileOut = new FileOutputStream("res/session.ser");
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(fileOut);
|
||||||
|
out.writeObject(session);
|
||||||
|
out.close();
|
||||||
|
fileOut.close();
|
||||||
|
System.out.println("Session has been serialised for next load");
|
||||||
|
}catch(IOException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Replace Scene Content with fxml file code from oracle.
|
* Replace Scene Content with fxml file code from oracle.
|
||||||
* @param fxml
|
* @param fxml
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public Initializable replaceSceneContent(String fxml) throws Exception {
|
public Initializable replaceSceneContent(SceneCode fxml) throws Exception {
|
||||||
FXMLLoader loader = new FXMLLoader();
|
FXMLLoader loader = new FXMLLoader();
|
||||||
InputStream in = getClass().getClassLoader().getResourceAsStream(fxml);
|
InputStream in = getClass().getClassLoader().getResourceAsStream(fxml.getFilePath());
|
||||||
Parent page;
|
Parent page;
|
||||||
try {
|
try {
|
||||||
page = (Parent) loader.load(in);
|
page = (Parent) loader.load(in);
|
||||||
@@ -132,6 +200,8 @@ public class App extends Application
|
|||||||
mainContainer.getChildren().remove(1);
|
mainContainer.getChildren().remove(1);
|
||||||
}
|
}
|
||||||
mainContainer.getChildren().add(page);
|
mainContainer.getChildren().add(page);
|
||||||
|
//change session code to fit with the serialisation
|
||||||
|
session.setSceneDisplayed(fxml);
|
||||||
return (Initializable) loader.getController();
|
return (Initializable) loader.getController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package seng202.group9.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by fwy13 on 16/09/16.
|
||||||
|
*/
|
||||||
|
public enum SceneCode {
|
||||||
|
INITIAL(""), AIRLINE_SUMMARY("airline_summary.fxml"), AIRLINE_RAW_DATA("airline_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"),
|
||||||
|
FLIGHT_RAW_DATA("flight_raw_data.fxml");
|
||||||
|
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
SceneCode(String filePath){
|
||||||
|
this.filePath = filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilePath(){
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package seng202.group9.Controller;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by fwy13 on 16/09/16.
|
||||||
|
*/
|
||||||
|
public class Session implements Serializable {
|
||||||
|
private SceneCode sceneDisplayed;
|
||||||
|
|
||||||
|
public Session(){
|
||||||
|
//blank constructor
|
||||||
|
this.sceneDisplayed = SceneCode.INITIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Session(SceneCode scene){
|
||||||
|
this.sceneDisplayed = scene;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSceneDisplayed(SceneCode sceneDisplayed) {
|
||||||
|
this.sceneDisplayed = sceneDisplayed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SceneCode getSceneDisplayed() {
|
||||||
|
return sceneDisplayed;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,16 +3,20 @@ package seng202.group9.GUI;
|
|||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import seng202.group9.Controller.App;
|
import seng202.group9.Controller.App;
|
||||||
import seng202.group9.Controller.Dataset;
|
import seng202.group9.Controller.Dataset;
|
||||||
import seng202.group9.Core.Airline;
|
import seng202.group9.Core.Airline;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Sunguin on 2016/09/13.
|
* Created by Sunguin on 2016/09/13.
|
||||||
*/
|
*/
|
||||||
public class AirlineRDController extends MenuController {
|
public class AirlineRDController extends Controller {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Airline> tableView;
|
private TableView<Airline> tableView;
|
||||||
@@ -48,32 +52,8 @@ public class AirlineRDController extends MenuController {
|
|||||||
//private TextField airlActiveBox;
|
//private TextField airlActiveBox;
|
||||||
private ComboBox<String> airlActiveCBox;
|
private ComboBox<String> airlActiveCBox;
|
||||||
|
|
||||||
|
|
||||||
App parent;
|
|
||||||
|
|
||||||
public void setApp(App parent){
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dataset theDataSet = null;
|
private Dataset theDataSet = null;
|
||||||
|
|
||||||
public void loadTables() {
|
|
||||||
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
|
|
||||||
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
|
||||||
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO"));
|
|
||||||
//Need to check IATA and ICAO
|
|
||||||
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
|
||||||
airlICAOcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
|
|
||||||
airlCallsigncol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign"));
|
|
||||||
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
|
|
||||||
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
|
||||||
|
|
||||||
theDataSet = this.parent.getCurrentDataset();
|
|
||||||
tableView.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
|
|
||||||
//ObservableList<String> activeOptions= FXCollections.observableArrayList("Y", "N");
|
|
||||||
airlActiveCBox.getItems().addAll("Y", "N");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Dummy function to test the add button.
|
//Dummy function to test the add button.
|
||||||
//Will edit when ID is added automatically.
|
//Will edit when ID is added automatically.
|
||||||
public void addAirlineSingle() {
|
public void addAirlineSingle() {
|
||||||
@@ -102,4 +82,22 @@ public class AirlineRDController extends MenuController {
|
|||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
|
||||||
|
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
||||||
|
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO"));
|
||||||
|
//Need to check IATA and ICAO
|
||||||
|
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
||||||
|
airlICAOcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
|
||||||
|
airlCallsigncol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign"));
|
||||||
|
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
|
||||||
|
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
||||||
|
|
||||||
|
theDataSet = getParent().getCurrentDataset();
|
||||||
|
tableView.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
|
||||||
|
//ObservableList<String> activeOptions= FXCollections.observableArrayList("Y", "N");
|
||||||
|
airlActiveCBox.getItems().addAll("Y", "N");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,19 @@ package seng202.group9.GUI;
|
|||||||
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import seng202.group9.Controller.App;
|
import seng202.group9.Controller.App;
|
||||||
import seng202.group9.Controller.Dataset;
|
import seng202.group9.Controller.Dataset;
|
||||||
|
import seng202.group9.Controller.SceneCode;
|
||||||
import seng202.group9.Core.Airline;
|
import seng202.group9.Core.Airline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by michael on 14/09/2016.
|
* Created by michael on 14/09/2016.
|
||||||
*/
|
*/
|
||||||
public class AirlineSummaryController extends MenuController{
|
public class AirlineSummaryController extends Controller{
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Airline> tableView;
|
private TableView<Airline> tableView;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -28,63 +30,26 @@ public class AirlineSummaryController extends MenuController{
|
|||||||
|
|
||||||
private Dataset currentData = null;
|
private Dataset currentData = null;
|
||||||
|
|
||||||
App parent;
|
public void load() {
|
||||||
|
|
||||||
public void setApp(App parent){
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadTables() {
|
|
||||||
columnName.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
columnName.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
||||||
columnAlias.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
columnAlias.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
||||||
columnCountry.setCellValueFactory(new PropertyValueFactory<Airline, String>("Country"));
|
columnCountry.setCellValueFactory(new PropertyValueFactory<Airline, String>("Country"));
|
||||||
columnIATA.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
|
columnIATA.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
|
||||||
columnActive.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
columnActive.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
||||||
currentData = this.parent.getCurrentDataset();
|
currentData = getParent().getCurrentDataset();
|
||||||
tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines()));
|
tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void airlineRawDataButton() {
|
public void airlineRawDataButton() {
|
||||||
try {
|
replaceSceneContent(SceneCode.AIRLINE_RAW_DATA);
|
||||||
AirlineRDController rawDataController = (AirlineRDController)
|
|
||||||
parent.replaceSceneContent("airline_raw_data.fxml");
|
|
||||||
rawDataController.setApp(parent);
|
|
||||||
rawDataController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void flightSummaryButton() {
|
public void flightSummaryButton() {
|
||||||
try {
|
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||||
FlightSummaryController summaryController = (FlightSummaryController)
|
|
||||||
parent.replaceSceneContent("flight_data_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.flightPathListView();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void airportSummaryButton() {
|
public void airportSummaryButton() {
|
||||||
try {
|
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||||
AirportSummaryController summaryController = (AirportSummaryController)
|
|
||||||
parent.replaceSceneContent("airport_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void routeSummaryButton() {
|
public void routeSummaryButton() {
|
||||||
try {
|
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
||||||
RouteSummaryController summaryController = (RouteSummaryController)
|
|
||||||
parent.replaceSceneContent("routes_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import seng202.group9.Core.Country;
|
|||||||
/**
|
/**
|
||||||
* Created by Sunguin on 2016/09/13.
|
* Created by Sunguin on 2016/09/13.
|
||||||
*/
|
*/
|
||||||
public class AirportRDController extends MenuController{
|
public class AirportRDController extends Controller{
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Airport> tableViewAirportRD;
|
private TableView<Airport> tableViewAirportRD;
|
||||||
@@ -74,16 +74,9 @@ public class AirportRDController extends MenuController{
|
|||||||
@FXML
|
@FXML
|
||||||
private TextField airpTzBox;
|
private TextField airpTzBox;
|
||||||
|
|
||||||
|
|
||||||
private Dataset theDataSet = null;
|
private Dataset theDataSet = null;
|
||||||
|
|
||||||
App parent;
|
public void load() {
|
||||||
|
|
||||||
public void setApp(App parent){
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadTables() {
|
|
||||||
airpIDcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ID"));
|
airpIDcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ID"));
|
||||||
airpNamecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
airpNamecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
||||||
airpCitycol.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
|
airpCitycol.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
|
||||||
@@ -114,7 +107,7 @@ public class AirportRDController extends MenuController{
|
|||||||
// return timeZoneCell;
|
// return timeZoneCell;
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
theDataSet = this.parent.getCurrentDataset();
|
theDataSet = getParent().getCurrentDataset();
|
||||||
tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
|
tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
|
||||||
|
|
||||||
airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U");
|
airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U");
|
||||||
|
|||||||
@@ -7,12 +7,13 @@ import javafx.scene.control.TableView;
|
|||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import seng202.group9.Controller.App;
|
import seng202.group9.Controller.App;
|
||||||
import seng202.group9.Controller.Dataset;
|
import seng202.group9.Controller.Dataset;
|
||||||
|
import seng202.group9.Controller.SceneCode;
|
||||||
import seng202.group9.Core.Airport;
|
import seng202.group9.Core.Airport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by michael on 14/09/2016.
|
* Created by michael on 14/09/2016.
|
||||||
*/
|
*/
|
||||||
public class AirportSummaryController extends MenuController{
|
public class AirportSummaryController extends Controller{
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Airport> tableView;
|
private TableView<Airport> tableView;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -28,64 +29,27 @@ public class AirportSummaryController extends MenuController{
|
|||||||
|
|
||||||
private Dataset currentData = null;
|
private Dataset currentData = null;
|
||||||
|
|
||||||
App parent;
|
public void airportRawDataButton() {
|
||||||
|
replaceSceneContent(SceneCode.AIRLINE_RAW_DATA);
|
||||||
public void setApp(App parent){
|
}
|
||||||
this.parent = parent;
|
public void flightSummaryButton() {
|
||||||
|
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||||
|
}
|
||||||
|
public void routeSummaryButton() {
|
||||||
|
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
||||||
|
}
|
||||||
|
public void airlineSummaryButton() {
|
||||||
|
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadTables() {
|
public void load() {
|
||||||
currentData = this.parent.getCurrentDataset();
|
currentData = getParent().getCurrentDataset();
|
||||||
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
||||||
columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("City"));
|
columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("City"));
|
||||||
columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("Country"));
|
columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("Country"));
|
||||||
columnIATA.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA"));
|
columnIATA.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA"));
|
||||||
columnAltitude.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
|
columnAltitude.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
|
||||||
currentData = this.parent.getCurrentDataset();
|
currentData = getParent().getCurrentDataset();
|
||||||
tableView.setItems(FXCollections.observableArrayList(currentData.getAirports()));
|
tableView.setItems(FXCollections.observableArrayList(currentData.getAirports()));
|
||||||
}
|
}
|
||||||
public void airportRawDataButton() {
|
|
||||||
try {
|
|
||||||
AirportRDController rawDataController = (AirportRDController)
|
|
||||||
parent.replaceSceneContent("airport_raw_data.fxml");
|
|
||||||
rawDataController.setApp(parent);
|
|
||||||
rawDataController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void flightSummaryButton() {
|
|
||||||
try {
|
|
||||||
FlightSummaryController summaryController = (FlightSummaryController)
|
|
||||||
parent.replaceSceneContent("flight_data_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.flightPathListView();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void routeSummaryButton() {
|
|
||||||
try {
|
|
||||||
RouteSummaryController summaryController = (RouteSummaryController)
|
|
||||||
parent.replaceSceneContent("routes_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void airlineSummaryButton() {
|
|
||||||
try {
|
|
||||||
AirlineSummaryController summaryController = (AirlineSummaryController)
|
|
||||||
parent.replaceSceneContent("airline_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package seng202.group9.GUI;
|
||||||
|
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import seng202.group9.Controller.App;
|
||||||
|
import seng202.group9.Controller.SceneCode;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Gondr on 16/09/2016.
|
||||||
|
*/
|
||||||
|
public abstract class Controller implements Initializable{
|
||||||
|
private App parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set Parent app
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
|
public void setApp(App parent){
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get parent App
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public App getParent(){
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* functions to load
|
||||||
|
*/
|
||||||
|
public abstract void load();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces content and does normal loading
|
||||||
|
* @param scene
|
||||||
|
*/
|
||||||
|
public void replaceSceneContent(SceneCode scene){
|
||||||
|
try {
|
||||||
|
Controller controller = (Controller)
|
||||||
|
parent.replaceSceneContent(scene);
|
||||||
|
controller.setApp(parent);
|
||||||
|
controller.load();
|
||||||
|
controller.loadOnce();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Functions here will only load once and after the load function.
|
||||||
|
*/
|
||||||
|
public void loadOnce(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize statement before anything loads.
|
||||||
|
* @param location
|
||||||
|
* @param resources
|
||||||
|
*/
|
||||||
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,19 +22,13 @@ import java.util.ResourceBundle;
|
|||||||
* Controller for the Flights Raw Data Scene.
|
* Controller for the Flights Raw Data Scene.
|
||||||
* Created by Liam Beckett on 13/09/2016.
|
* Created by Liam Beckett on 13/09/2016.
|
||||||
*/
|
*/
|
||||||
public class FlightRDController implements Initializable {
|
|
||||||
|
public class FlightRDController extends Controller {
|
||||||
|
|
||||||
private Dataset theDataSet = null;
|
private Dataset theDataSet = null;
|
||||||
private int currentPathId = 0;
|
private int currentPathId = 0;
|
||||||
private int currentPathIndex = 0;
|
private int currentPathIndex = 0;
|
||||||
|
|
||||||
App parent;
|
|
||||||
public void setApp(App parent){
|
|
||||||
this.parent = parent;
|
|
||||||
theDataSet = parent.getCurrentDataset();
|
|
||||||
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<FlightPoint> flightTableView;
|
private TableView<FlightPoint> flightTableView;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -123,7 +117,9 @@ public class FlightRDController implements Initializable {
|
|||||||
/**
|
/**
|
||||||
* Function used to load the table for the Flight points initially from the MenuController
|
* Function used to load the table for the Flight points initially from the MenuController
|
||||||
*/
|
*/
|
||||||
public void loadTables() {
|
public void load() {
|
||||||
|
theDataSet = getParent().getCurrentDataset();
|
||||||
|
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
|
||||||
flightIdCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("ID"));
|
flightIdCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("ID"));
|
||||||
flightNameCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Name"));
|
flightNameCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Name"));
|
||||||
flightTypeCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Type"));
|
flightTypeCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Type"));
|
||||||
@@ -135,8 +131,6 @@ public class FlightRDController implements Initializable {
|
|||||||
flightLegDisCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Leg_Dist"));
|
flightLegDisCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Leg_Dist"));
|
||||||
flightTotDisCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Tot_Dist"));
|
flightTotDisCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Tot_Dist"));
|
||||||
|
|
||||||
theDataSet = this.parent.getCurrentDataset();
|
|
||||||
|
|
||||||
ArrayList<FlightPath> flightPaths;
|
ArrayList<FlightPath> flightPaths;
|
||||||
flightPaths = theDataSet.getFlightPaths();
|
flightPaths = theDataSet.getFlightPaths();
|
||||||
//int firstID = flightPaths.get(0).getID();
|
//int firstID = flightPaths.get(0).getID();
|
||||||
@@ -181,8 +175,9 @@ public class FlightRDController implements Initializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
@Override
|
||||||
// TODO Auto-generated method stub
|
public void loadOnce(){
|
||||||
|
flightPathListView();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -8,6 +8,7 @@ import javafx.scene.control.Button;
|
|||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import seng202.group9.Controller.App;
|
import seng202.group9.Controller.App;
|
||||||
import seng202.group9.Controller.Dataset;
|
import seng202.group9.Controller.Dataset;
|
||||||
|
import seng202.group9.Controller.SceneCode;
|
||||||
import seng202.group9.Core.FlightPath;
|
import seng202.group9.Core.FlightPath;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@@ -18,15 +19,10 @@ import java.util.ResourceBundle;
|
|||||||
* Controller for the Flights Summary Scene.
|
* Controller for the Flights Summary Scene.
|
||||||
* Created by Liam Beckett on 13/09/2016.
|
* Created by Liam Beckett on 13/09/2016.
|
||||||
*/
|
*/
|
||||||
public class FlightSummaryController implements Initializable {
|
public class FlightSummaryController extends Controller {
|
||||||
|
|
||||||
private Dataset theDataSet = null;
|
private Dataset theDataSet = null;
|
||||||
|
|
||||||
App parent;
|
|
||||||
public void setApp(App parent){
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button flightRawData;
|
private Button flightRawData;
|
||||||
|
|
||||||
@@ -35,11 +31,25 @@ public class FlightSummaryController implements Initializable {
|
|||||||
final ObservableList<String> flightList = FXCollections.observableArrayList();
|
final ObservableList<String> flightList = FXCollections.observableArrayList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the Flight paths into the List View and is called from the MenuController.
|
* Changes to the Flight Raw Data Scene when the Raw Data Button is clicked
|
||||||
*/
|
*/
|
||||||
public void flightPathListView() {
|
public void handleRawDataButton() {
|
||||||
|
replaceSceneContent(SceneCode.FLIGHT_RAW_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void airportSummaryButton() {
|
||||||
|
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||||
|
}
|
||||||
|
public void routeSummaryButton() {
|
||||||
|
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
||||||
|
}
|
||||||
|
public void airlineSummaryButton() {
|
||||||
|
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
try {
|
try {
|
||||||
theDataSet = this.parent.getCurrentDataset();
|
theDataSet = getParent().getCurrentDataset();
|
||||||
ArrayList<FlightPath> flightPaths = new ArrayList();
|
ArrayList<FlightPath> flightPaths = new ArrayList();
|
||||||
flightPaths = theDataSet.getFlightPaths();
|
flightPaths = theDataSet.getFlightPaths();
|
||||||
for(int i = 0; i<flightPaths.size(); i++ ){
|
for(int i = 0; i<flightPaths.size(); i++ ){
|
||||||
@@ -55,60 +65,5 @@ public class FlightSummaryController implements Initializable {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes to the Flight Raw Data Scene when the Raw Data Button is clicked
|
|
||||||
*/
|
|
||||||
public void handleRawDataButton() {
|
|
||||||
try {
|
|
||||||
FlightRDController rawDataController = (FlightRDController)
|
|
||||||
parent.replaceSceneContent("flight_raw_data.fxml");
|
|
||||||
rawDataController.setApp(parent);
|
|
||||||
rawDataController.loadTables();
|
|
||||||
rawDataController.flightPathListView();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void airportSummaryButton() {
|
|
||||||
try {
|
|
||||||
AirportSummaryController summaryController = (AirportSummaryController)
|
|
||||||
parent.replaceSceneContent("airport_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void routeSummaryButton() {
|
|
||||||
try {
|
|
||||||
RouteSummaryController summaryController = (RouteSummaryController)
|
|
||||||
parent.replaceSceneContent("routes_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void airlineSummaryButton() {
|
|
||||||
try {
|
|
||||||
AirlineSummaryController summaryController = (AirlineSummaryController)
|
|
||||||
parent.replaceSceneContent("airline_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,9 @@ import javax.swing.JOptionPane;
|
|||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
|
||||||
import seng202.group9.Controller.App;
|
import seng202.group9.Controller.App;
|
||||||
|
import seng202.group9.Controller.SceneCode;
|
||||||
|
|
||||||
public class MenuController implements Initializable{
|
public class MenuController extends Controller{
|
||||||
|
|
||||||
App parent;
|
|
||||||
|
|
||||||
public void importAirports(){
|
public void importAirports(){
|
||||||
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
|
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
|
||||||
@@ -33,98 +32,46 @@ public class MenuController implements Initializable{
|
|||||||
* Load Airline Raw Data Function.
|
* Load Airline Raw Data Function.
|
||||||
*/
|
*/
|
||||||
public void viewAirlineRawData() {
|
public void viewAirlineRawData() {
|
||||||
try {
|
replaceSceneContent(SceneCode.AIRPORT_RAW_DATA);
|
||||||
AirlineRDController summaryController = (AirlineRDController) parent.replaceSceneContent("airline_raw_data.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void viewAirportRawData() {
|
public void viewAirportRawData() {
|
||||||
try {
|
replaceSceneContent(SceneCode.AIRPORT_RAW_DATA);
|
||||||
AirportRDController summaryController = (AirportRDController) parent.replaceSceneContent("airport_raw_data.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void viewRouteRawData() {
|
public void viewRouteRawData() {
|
||||||
try {
|
replaceSceneContent(SceneCode.ROUTE_RAW_DATA);
|
||||||
RouteRDController summaryController = (RouteRDController) parent.replaceSceneContent("route_raw_data.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void viewAirlineSummary() {
|
public void viewAirlineSummary() {
|
||||||
try {
|
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||||
AirlineSummaryController summaryController = (AirlineSummaryController) parent.replaceSceneContent("airline_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void viewAirportSummary() {
|
public void viewAirportSummary() {
|
||||||
try {
|
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||||
AirportSummaryController summaryController = (AirportSummaryController) parent.replaceSceneContent("airport_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void viewRouteSummary() {
|
public void viewRouteSummary() {
|
||||||
try {
|
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
||||||
RouteSummaryController summaryController = (RouteSummaryController) parent.replaceSceneContent("routes_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApp(App parent){
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Flight Summary Function.
|
* Load Flight Summary Function.
|
||||||
*/
|
*/
|
||||||
public void viewFlightSummary() {
|
public void viewFlightSummary() {
|
||||||
try {
|
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||||
FlightSummaryController summaryController = (FlightSummaryController) parent.replaceSceneContent("flight_data_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.flightPathListView();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Flight Raw Data Function.
|
* Load Flight Raw Data Function.
|
||||||
*/
|
*/
|
||||||
public void viewFlightRawData() {
|
public void viewFlightRawData() {
|
||||||
try {
|
replaceSceneContent(SceneCode.FLIGHT_RAW_DATA);
|
||||||
FlightRDController rawDataController = (FlightRDController)
|
|
||||||
parent.replaceSceneContent("flight_raw_data.fxml");
|
|
||||||
rawDataController.setApp(parent);
|
|
||||||
rawDataController.loadTables();
|
|
||||||
rawDataController.flightPathListView();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
//nothing to load
|
||||||
|
}
|
||||||
|
|
||||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import seng202.group9.Core.Route;
|
|||||||
/**
|
/**
|
||||||
* Created by Sunguin on 2016/09/14.
|
* Created by Sunguin on 2016/09/14.
|
||||||
*/
|
*/
|
||||||
public class RouteRDController extends MenuController {
|
public class RouteRDController extends Controller {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Route> tableViewRouteRD;
|
private TableView<Route> tableViewRouteRD;
|
||||||
@@ -47,32 +47,8 @@ public class RouteRDController extends MenuController {
|
|||||||
@FXML
|
@FXML
|
||||||
private TextField rEquipmentBox;
|
private TextField rEquipmentBox;
|
||||||
|
|
||||||
|
|
||||||
App parent;
|
|
||||||
|
|
||||||
public void setApp(App parent){
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dataset theDataSet = null;
|
private Dataset theDataSet = null;
|
||||||
|
|
||||||
public void loadTables() {
|
|
||||||
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
|
|
||||||
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
|
|
||||||
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
|
||||||
rSourceIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("SourceID"));
|
|
||||||
rDestCol.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
|
|
||||||
rDestIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DestID"));
|
|
||||||
rCodeshareCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Code"));
|
|
||||||
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
|
|
||||||
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
|
|
||||||
|
|
||||||
theDataSet = this.parent.getCurrentDataset();
|
|
||||||
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
|
|
||||||
|
|
||||||
rCodeshareCBox.getItems().addAll("Y", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addRouteSingle() {
|
public void addRouteSingle() {
|
||||||
try {
|
try {
|
||||||
theDataSet.addRoute(
|
theDataSet.addRoute(
|
||||||
@@ -98,4 +74,21 @@ public class RouteRDController extends MenuController {
|
|||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
|
||||||
|
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
|
||||||
|
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
||||||
|
rSourceIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("SourceID"));
|
||||||
|
rDestCol.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
|
||||||
|
rDestIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DestID"));
|
||||||
|
rCodeshareCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Code"));
|
||||||
|
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
|
||||||
|
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
|
||||||
|
|
||||||
|
theDataSet = getParent().getCurrentDataset();
|
||||||
|
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
|
||||||
|
|
||||||
|
rCodeshareCBox.getItems().addAll("Y", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,13 @@ import javafx.scene.control.TableView;
|
|||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import seng202.group9.Controller.App;
|
import seng202.group9.Controller.App;
|
||||||
import seng202.group9.Controller.Dataset;
|
import seng202.group9.Controller.Dataset;
|
||||||
|
import seng202.group9.Controller.SceneCode;
|
||||||
import seng202.group9.Core.Route;
|
import seng202.group9.Core.Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by michael on 14/09/2016.
|
* Created by michael on 14/09/2016.
|
||||||
*/
|
*/
|
||||||
public class RouteSummaryController extends MenuController{
|
public class RouteSummaryController extends Controller{
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Route> tableView;
|
private TableView<Route> tableView;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -28,64 +29,26 @@ public class RouteSummaryController extends MenuController{
|
|||||||
|
|
||||||
private Dataset currentData = null;
|
private Dataset currentData = null;
|
||||||
|
|
||||||
App parent;
|
public void load() {
|
||||||
|
|
||||||
public void setApp(App parent){
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadTables() {
|
|
||||||
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("Airline"));
|
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("Airline"));
|
||||||
columnDepart.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
columnDepart.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
||||||
columnArrive.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
|
columnArrive.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
|
||||||
columnStops.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
|
columnStops.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
|
||||||
columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
|
columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
|
||||||
currentData = this.parent.getCurrentDataset();
|
currentData = getParent().getCurrentDataset();
|
||||||
tableView.setItems(FXCollections.observableArrayList(currentData.getRoutes()));
|
tableView.setItems(FXCollections.observableArrayList(currentData.getRoutes()));
|
||||||
}
|
}
|
||||||
public void routeRawDataButton() {
|
public void routeRawDataButton() {
|
||||||
try {
|
replaceSceneContent(SceneCode.ROUTE_RAW_DATA);
|
||||||
RouteRDController rawDataController = (RouteRDController)
|
|
||||||
parent.replaceSceneContent("route_raw_data.fxml");
|
|
||||||
rawDataController.setApp(parent);
|
|
||||||
rawDataController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void flightSummaryButton() {
|
public void flightSummaryButton() {
|
||||||
try {
|
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||||
FlightSummaryController summaryController = (FlightSummaryController)
|
|
||||||
parent.replaceSceneContent("flight_data_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.flightPathListView();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void airportSummaryButton() {
|
public void airportSummaryButton() {
|
||||||
try {
|
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||||
AirportSummaryController summaryController = (AirportSummaryController)
|
|
||||||
parent.replaceSceneContent("airport_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void airlineSummaryButton() {
|
public void airlineSummaryButton() {
|
||||||
try {
|
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||||
AirlineSummaryController summaryController = (AirlineSummaryController)
|
|
||||||
parent.replaceSceneContent("airline_summary.fxml");
|
|
||||||
summaryController.setApp(parent);
|
|
||||||
summaryController.loadTables();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user