Merge remote-tracking branch 'origin/master'

Conflicts:
	src/main/java/seng202/group9/Controller/SceneCode.java
	src/main/java/seng202/group9/Controller/Session.java
	src/main/java/seng202/group9/GUI/AirportAnalyser.java
	src/main/java/seng202/group9/GUI/RouteAnalyser.java
main
Michael 9 years ago
commit a666eeef83

1
.gitignore vendored

@ -6,3 +6,4 @@ SENG202.iml
.settings/ .settings/
doc/ doc/
res/session.ser res/session.ser
res/userdb.db

@ -16,6 +16,9 @@ Run java -jar seng202_2016_team9_phase2.jar
Necessary Files: Necessary Files:
/res/userdb.db /res/userdb.db
To not have userdb.db clash problems run:
git update-index --assume-unchanged res/userdb.db
Getting started: Getting started:
The application is shipped with all the example data files pre loaded into the database. If the user wants add more data The application is shipped with all the example data files pre loaded into the database. If the user wants add more data
from a file then they can select a file to import using File -> Import <data> where data is the type of data you are from a file then they can select a file to import using File -> Import <data> where data is the type of data you are

@ -51,6 +51,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

Binary file not shown.

@ -1,6 +1,8 @@
package seng202.group9.Controller; package seng202.group9.Controller;
import java.io.*; import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -13,10 +15,12 @@ import javafx.fxml.Initializable;
import javafx.fxml.JavaFXBuilderFactory; import javafx.fxml.JavaFXBuilderFactory;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Menu; import javafx.scene.control.Menu;
import javafx.scene.layout.AnchorPane; 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.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
import seng202.group9.Core.FlightPath; import seng202.group9.Core.FlightPath;
import seng202.group9.GUI.*; import seng202.group9.GUI.*;
@ -50,6 +54,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();
@ -72,32 +93,26 @@ public class App extends Application
} catch (Exception e){ } catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
//testing out dataset if (session.getCurrentDataset() != null){
try { for (int i = 0; i < datasets.size(); i ++) {
currentDataset = new Dataset("test's", Dataset.getExisting); if (datasets.get(i).getName().equals(session.getCurrentDataset())) {
}catch (DataException e){ currentDataset = datasets.get(i);
e.printStackTrace(); }
}
} }
//after all loading then load the previous session //after all loading then load the previous session
try{ if (session.getSceneDisplayed() != null) {
FileInputStream fileIn = new FileInputStream("res/session.ser"); menuController.replaceSceneContent(session.getSceneDisplayed());
ObjectInputStream objectIn = new ObjectInputStream(fileIn); }else{
session = (Session) objectIn.readObject(); menuController.replaceSceneContent(SceneCode.INITIAL);
Controller controller = (Controller) replaceSceneContent(session.getSceneDisplayed()); }
controller.setApp(this); //check if there is internet connectivity
controller.load(); if (!testInet("maps.google.com")){
controller.loadOnce(); Alert alert = new Alert(Alert.AlertType.WARNING);
objectIn.close(); alert.setTitle("No Internet Connection.");
fileIn.close(); alert.setHeaderText("Unable to Connect to Google Maps");
}catch(IOException e){ alert.setContentText("As we are unable to connect to Google Maps all applications which are supposed to display maps may not work as intended.");
session = new Session(); alert.showAndWait();
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();
} }
} }
@ -139,6 +154,7 @@ public class App extends Application
c.close(); c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
e.printStackTrace();
} }
} }
@ -196,6 +212,7 @@ public class App extends Application
*/ */
public void setCurrentDataset(int index){ public void setCurrentDataset(int index){
currentDataset = datasets.get(index); currentDataset = datasets.get(index);
session.setCurrentDataset(currentDataset.getName());
} }
/** /**
@ -204,6 +221,7 @@ public class App extends Application
*/ */
public void setCurrentDataset(Dataset dataset){ public void setCurrentDataset(Dataset dataset){
currentDataset = dataset; currentDataset = dataset;
session.setCurrentDataset(currentDataset.getName());
} }
/** /**
@ -240,4 +258,23 @@ public class App extends Application
} }
} }
} }
/**
* Inet test to check if there internet connectivity
* @param site
* @return
*/
public boolean testInet(String site){
Socket sock = new Socket();
InetSocketAddress addr = new InetSocketAddress(site,80);
try {
sock.connect(addr,3000);
return true;
} catch (IOException e) {
return false;
} finally {
try {sock.close();}
catch (IOException e) {}
}
}
} }

@ -2,7 +2,9 @@ package seng202.group9.Controller;
import javafx.scene.chart.PieChart; import javafx.scene.chart.PieChart;
import javafx.scene.control.Alert;
import seng202.group9.Core.*; import seng202.group9.Core.*;
import sun.awt.image.ImageWatched;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
@ -23,12 +25,14 @@ public class Dataset {
private ArrayList<FlightPath> flightPaths; private ArrayList<FlightPath> flightPaths;
private ArrayList<Country> countries; private ArrayList<Country> countries;
private ArrayList<City> cities; private ArrayList<City> cities;
private LinkedHashMap<String, Airline> airlineDictionary; private LinkedHashMap<String, Airline> airlineDictionary;//key name
private LinkedHashMap<String, Airport> airportDictionary; private LinkedHashMap<String, Airport> airportDictionary;//key name
private LinkedHashMap<String, Route> routeDictionary; private LinkedHashMap<String, Route> routeDictionary;//key routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
private LinkedHashMap<Integer, FlightPath> flightPathDictionary; private LinkedHashMap<Integer, FlightPath> flightPathDictionary;//key path id
private LinkedHashMap<String, Country> countryDictionary; private LinkedHashMap<String, Country> countryDictionary;//key name
private LinkedHashMap<String, City> cityDictionary; private LinkedHashMap<String, City> cityDictionary;//key city name
private LinkedHashMap<Integer, FlightPoint> flightPointDictionary;//key point id
private LinkedHashMap<String, Equipment> equipmentDictionary;
/** /**
* *
@ -50,6 +54,8 @@ public class Dataset {
this.countryDictionary = new LinkedHashMap<String, Country>();; this.countryDictionary = new LinkedHashMap<String, Country>();;
this.cityDictionary = new LinkedHashMap<String, City>();; this.cityDictionary = new LinkedHashMap<String, City>();;
this.flightPathDictionary = new LinkedHashMap<Integer, FlightPath>(); this.flightPathDictionary = new LinkedHashMap<Integer, FlightPath>();
this.flightPointDictionary = new LinkedHashMap<Integer, FlightPoint>();
this.equipmentDictionary = new LinkedHashMap<>();
if (action == getExisting){ if (action == getExisting){
updateDataset(); updateDataset();
//after this make connections. ie filling in the country.cities airports.routes etc //after this make connections. ie filling in the country.cities airports.routes etc
@ -204,9 +210,11 @@ public class Dataset {
double flightPtTotDist = rs.getDouble("Tot_Dist"); double flightPtTotDist = rs.getDouble("Tot_Dist");
double flightPtLatitude = rs.getDouble("Latitude"); double flightPtLatitude = rs.getDouble("Latitude");
double flightPtLongitude = rs.getDouble("Longitude"); double flightPtLongitude = rs.getDouble("Longitude");
flightPaths.get(i).addFlightPoint(new FlightPoint(flightPtName, flightPtID, flightPtInd FlightPoint flightPoint = new FlightPoint(flightPtName, flightPtID, flightPtInd
, flightPtType, flightPtVia, flightPtheading, flightPtAltitude, flightPtLegDistance, flightPtTotDist, , flightPtType, flightPtVia, flightPtheading, flightPtAltitude, flightPtLegDistance, flightPtTotDist,
flightPtLatitude, flightPtLongitude)); flightPtLatitude, flightPtLongitude);
flightPaths.get(i).addFlightPoint(flightPoint);
flightPointDictionary.put(flightPtID, flightPoint);
} }
rs.close(); rs.close();
stmt.close(); stmt.close();
@ -375,7 +383,7 @@ public class Dataset {
ArrayList<Airline> airlinesToImport = parser.getResult(); ArrayList<Airline> airlinesToImport = parser.getResult();
//check for dup //check for dup
int numOfDuplicates = 0; int numOfDuplicates = 0;
int nextID = -1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
@ -448,7 +456,7 @@ public class Dataset {
ArrayList<Country> countriesToImport = parser.getCountryResult(); ArrayList<Country> countriesToImport = parser.getCountryResult();
//check for dup //check for dup
int numOfDuplicates = 0; int numOfDuplicates = 0;
int nextID = -1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
@ -463,7 +471,6 @@ public class Dataset {
while (IDResult.next()) { while (IDResult.next()) {
nextID = Integer.parseInt(IDResult.getString("seq")) + 1;//for some reason sqlite3 stores incremental values as a string... nextID = Integer.parseInt(IDResult.getString("seq")) + 1;//for some reason sqlite3 stores incremental values as a string...
} }
System.out.println(nextID);
stmt.close(); stmt.close();
stmt = c.createStatement(); stmt = c.createStatement();
String insertAirportQuery = "INSERT INTO `" + this.name + "_Airport` (`Name`, `City`, `Country`, `IATA/FFA`," + String insertAirportQuery = "INSERT INTO `" + this.name + "_Airport` (`Name`, `City`, `Country`, `IATA/FFA`," +
@ -580,7 +587,7 @@ public class Dataset {
ArrayList<Route> routesToImport = parser.getResult(); ArrayList<Route> routesToImport = parser.getResult();
//check for dup //check for dup
int numOfDuplicates = 0; int numOfDuplicates = 0;
int nextID = -1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
@ -654,7 +661,7 @@ public class Dataset {
String message = parser.parse(); String message = parser.parse();
ArrayList<FlightPoint> flightPointsToImport = parser.getResult(); ArrayList<FlightPoint> flightPointsToImport = parser.getResult();
//check for dup //check for dup
int nextID = -1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
@ -662,15 +669,15 @@ public class Dataset {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
stmt = c.createStatement(); stmt = c.createStatement();
String queryName = this.name.replace("'", "''"); String queryName = this.name.replace("\"", "\"\"");
String IDQuery = "SELECT * FROM `sqlite_sequence` WHERE `name` = '"+queryName+"_Flight_Points' LIMIT 1;"; String IDQuery = "SELECT * FROM `sqlite_sequence` WHERE `name` = \""+queryName+"_Flight_Points\" LIMIT 1;";
ResultSet IDResult = stmt.executeQuery(IDQuery); ResultSet IDResult = stmt.executeQuery(IDQuery);
while(IDResult.next()){ while(IDResult.next()){
nextID = Integer.parseInt(IDResult.getString("seq")) + 1;//for some reason sqlite3 stores incremental values as a string... nextID = Integer.parseInt(IDResult.getString("seq")) + 1;//for some reason sqlite3 stores incremental values as a string...
} }
stmt.close(); stmt.close();
stmt = c.createStatement(); stmt = c.createStatement();
//ADDED
String firstPt = flightPointsToImport.get(0).getName(); String firstPt = flightPointsToImport.get(0).getName();
String lastPt = flightPointsToImport.get(flightPointsToImport.size() - 1).getName(); String lastPt = flightPointsToImport.get(flightPointsToImport.size() - 1).getName();
FlightPath flightPathToAdd = new FlightPath(firstPt, lastPt); FlightPath flightPathToAdd = new FlightPath(firstPt, lastPt);
@ -680,7 +687,7 @@ public class Dataset {
stmt.execute(insertFlightPathQuery); stmt.execute(insertFlightPathQuery);
stmt.close(); stmt.close();
stmt = c.createStatement(); stmt = c.createStatement();
int flightPathId = 0; int flightPathId = 1;
String getLastestIndex = "SELECT * FROM `sqlite_sequence` WHERE `name` = \"" + this.name.replace("\"", "\"\"") + String getLastestIndex = "SELECT * FROM `sqlite_sequence` WHERE `name` = \"" + this.name.replace("\"", "\"\"") +
"_Flight_Path\" LIMIT 1;"; "_Flight_Path\" LIMIT 1;";
ResultSet lastestIdResult = stmt.executeQuery(getLastestIndex); ResultSet lastestIdResult = stmt.executeQuery(getLastestIndex);
@ -691,7 +698,7 @@ public class Dataset {
lastestIdResult.close(); lastestIdResult.close();
stmt = c.createStatement(); stmt = c.createStatement();
flightPathToAdd.setID(flightPathId); flightPathToAdd.setID(flightPathId);
//ADDED
String insertFlightPointQuery = "INSERT INTO `" + this.name + "_Flight_Points` (`Index_ID`, `Name`, `Type`," + String insertFlightPointQuery = "INSERT INTO `" + this.name + "_Flight_Points` (`Index_ID`, `Name`, `Type`," +
" `Altitude`, `Latitude`, `Longitude`, `Order`) VALUES "; " `Altitude`, `Latitude`, `Longitude`, `Order`) VALUES ";
int numOfFlights = 0; int numOfFlights = 0;
@ -706,7 +713,7 @@ public class Dataset {
double flightLatitude = flightPointsToImport.get(i).getLatitude(); double flightLatitude = flightPointsToImport.get(i).getLatitude();
double flightLongitude = flightPointsToImport.get(i).getLongitude(); double flightLongitude = flightPointsToImport.get(i).getLongitude();
//insert import into database //insert import into database
if (numOfFlights > 0){ if (numOfFlights > 0) {
insertFlightPointQuery += ","; insertFlightPointQuery += ",";
} }
insertFlightPointQuery += "(" + flightPathId +", \""+ flightName +"\", \"" + flightType + "\", "+ flightAltitude + ", " + insertFlightPointQuery += "(" + flightPathId +", \""+ flightName +"\", \"" + flightType + "\", "+ flightAltitude + ", " +
@ -717,6 +724,7 @@ public class Dataset {
//this is placed after incase the database messes up //this is placed after incase the database messes up
flightPathToAdd.addFlightPoint(flightPointsToImport.get(i)); flightPathToAdd.addFlightPoint(flightPointsToImport.get(i));
//routeDictionary.put(routeIdentifier, flightsToImport.get(i)); //routeDictionary.put(routeIdentifier, flightsToImport.get(i));
flightPointDictionary.put(nextID, flightPointsToImport.get(i));
nextID++; nextID++;
numOfFlights++; numOfFlights++;
//} //}
@ -732,6 +740,7 @@ public class Dataset {
flightPathDictionary.put(flightPathToAdd.getID(), flightPathToAdd); flightPathDictionary.put(flightPathToAdd.getID(), flightPathToAdd);
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
e.printStackTrace();
System.exit(0); System.exit(0);
} }
createDataLinks(); createDataLinks();
@ -755,7 +764,6 @@ public class Dataset {
//create Airline country link //create Airline country link
for (Airline airline: airlines){ for (Airline airline: airlines){
airlineByIATA.put(airline.getIATA(), airline); airlineByIATA.put(airline.getIATA(), airline);
//System.out.println(airline.getAlias());
airline.setRoutes(new ArrayList<Route>()); airline.setRoutes(new ArrayList<Route>());
airline.setCountry(countryDictionary.get(airline.getCountryName())); airline.setCountry(countryDictionary.get(airline.getCountryName()));
Country country = countryDictionary.get(airline.getCountryName()); Country country = countryDictionary.get(airline.getCountryName());
@ -778,17 +786,43 @@ public class Dataset {
airport.setDepartureRoutes(new ArrayList<Route>()); airport.setDepartureRoutes(new ArrayList<Route>());
airport.setArrivalRoutes(new ArrayList<Route>()); airport.setArrivalRoutes(new ArrayList<Route>());
} }
equipmentDictionary = new LinkedHashMap<>();
//set Airport variables for route //set Airport variables for route
for (Route route: routes){ for (Route route: routes){
String[] equipment = route.getEquipment().split(" ");
for (String equip: equipment){
if (equip != "" && equip != null){
Equipment equipment1 = equipmentDictionary.get(equip);
if (equipment1 != null){
equipment1.addRoute(route);
}else{
equipment1 = new Equipment(equip);
equipment1.addRoute(route);
equipmentDictionary.put(equip, equipment1);
}
}
}
if (route.getDepartureAirport().length() > 3){ if (route.getDepartureAirport().length() > 3){
route.setSourceAirport(airportsByICAO.get(route.getDepartureAirport())); route.setSourceAirport(airportsByICAO.get(route.getDepartureAirport()));
if (airportsByICAO.get(route.getDepartureAirport()) != null) {
airportsByICAO.get(route.getDepartureAirport()).addDepartureRoutes(route);
}
}else{ }else{
route.setSourceAirport(airportsByIATA.get(route.getDepartureAirport())); route.setSourceAirport(airportsByIATA.get(route.getDepartureAirport()));
if (airportsByIATA.get(route.getDepartureAirport()) != null){
airportsByIATA.get(route.getDepartureAirport()).addDepartureRoutes(route);
}
} }
if (route.getArrivalAirport().length() > 3){ if (route.getArrivalAirport().length() > 3){
route.setDestinationAirport(airportsByICAO.get(route.getArrivalAirport())); route.setDestinationAirport(airportsByICAO.get(route.getArrivalAirport()));
if (airportsByICAO.get(route.getArrivalAirport()) != null) {
airportsByICAO.get(route.getArrivalAirport()).addArrivalRoutes(route);
}
}else{ }else{
route.setDestinationAirport(airportsByIATA.get(route.getArrivalAirport())); route.setDestinationAirport(airportsByIATA.get(route.getArrivalAirport()));
if (airportsByIATA.get(route.getArrivalAirport()) != null) {
airportsByIATA.get(route.getArrivalAirport()).addArrivalRoutes(route);
}
} }
route.setAirline(airlineByIATA.get(route.getAirlineName())); route.setAirline(airlineByIATA.get(route.getAirlineName()));
Airline airline = airlineByIATA.get(route.getAirlineName()); Airline airline = airlineByIATA.get(route.getAirlineName());
@ -1148,21 +1182,22 @@ public class Dataset {
String insertPathQuery = "INSERT INTO `" + this.name + "_Flight_Path` (`Path_ID`, `Source_Airport`, " + String insertPathQuery = "INSERT INTO `" + this.name + "_Flight_Path` (`Path_ID`, `Source_Airport`, " +
"`Destination_Airport`) VALUES ("+pathID+", \""+sourceAirport+"\", \""+destAirport+"\" )"; "`Destination_Airport`) VALUES ("+pathID+", \""+sourceAirport+"\", \""+destAirport+"\" )";
stmt.execute(insertPathQuery); stmt.execute(insertPathQuery);
} catch (Exception e){
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0);
}
newPath.setID(pathID); newPath.setID(pathID);
flightPathDictionary.put(pathID, newPath); flightPathDictionary.put(pathID, newPath);
flightPaths.add(newPath); flightPaths.add(newPath);
FlightPoint sourcePoint = new FlightPoint(sourceAirport, pathID); FlightPoint sourcePoint = new FlightPoint(sourceAirport, pathID);
FlightPoint destinationPoint = new FlightPoint(sourceAirport, pathID); FlightPoint destinationPoint = new FlightPoint(destAirport, pathID);
try{
addFlightPointToPath(sourcePoint); addFlightPointToPath(sourcePoint);
addFlightPointToPath(destinationPoint); addFlightPointToPath(destinationPoint);
updateFlightPath(newPath);
} catch (DataException e){ } catch (DataException e){
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0); System.exit(0);
}catch (Exception e){
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0);
} }
} }
@ -1171,22 +1206,14 @@ public class Dataset {
* @param id * @param id
* @param name * @param name
* @param type * @param type
* @param via
* @param altitude * @param altitude
* @param latitude * @param latitude
* @param longitude * @param longitude
* @param heading
* @param legDist
* @param totDist
*/ */
public void addFlightPointToPath(int id, String name, String type, String via, String altitude, String latitude, String longitude, public void addFlightPointToPath(int id, String name, String type, String altitude, String latitude, String longitude, int index) throws DataException{
String heading, String legDist, String totDist , int index) throws DataException{
double altitudeVal = 0.0; double altitudeVal = 0.0;
double latitudeVal = 0.0; double latitudeVal = 0.0;
double longitudeVal = 0.0; double longitudeVal = 0.0;
int headingVal = 0;
double legDistVal = 0.0;
double totalDistVal = 0.0;
try{ try{
altitudeVal = Double.parseDouble(altitude); altitudeVal = Double.parseDouble(altitude);
@ -1203,20 +1230,8 @@ public class Dataset {
}catch (NumberFormatException e){ }catch (NumberFormatException e){
throw new DataException("Longitude must be a double value"); throw new DataException("Longitude must be a double value");
} }
try{ if (index == -1){
headingVal = Integer.parseInt(heading); index = flightPathDictionary.get(id).getFlightPoints().size();
}catch (NumberFormatException e){
throw new DataException("Heading must be a integer value");
}
try{
legDistVal = Double.parseDouble(legDist);
}catch (NumberFormatException e){
throw new DataException("Leg DIstance must be a double value");
}
try{
totalDistVal = Double.parseDouble(totDist);
}catch (NumberFormatException e){
throw new DataException("Total Distance must be a double value");
} }
Connection c = null; Connection c = null;
Statement stmt; Statement stmt;
@ -1225,21 +1240,20 @@ public class Dataset {
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
stmt = c.createStatement(); stmt = c.createStatement();
String flightPointIDQuery = "SELECT * FROM `sqlite_sequence` WHERE `name` = \""+this.name+"_Flight_Points\" LIMIT 1;"; String flightPointIDQuery = "SELECT * FROM `sqlite_sequence` WHERE `name` = \"" + this.name + "_Flight_Points\" LIMIT 1;";
ResultSet pointIDRes= stmt.executeQuery(flightPointIDQuery); ResultSet pointIDRes = stmt.executeQuery(flightPointIDQuery);
while (pointIDRes.next()){ while (pointIDRes.next()) {
pointID = Integer.parseInt(pointIDRes.getString("seq")); pointID = Integer.parseInt(pointIDRes.getString("seq"));
} }
stmt.close(); stmt.close();
stmt = c.createStatement(); stmt = c.createStatement();
String insertFlightPointQuery = "INSERT INTO `" + this.name + "_Flight_Points` (`Index_ID`, `Name`, `Type`," + String insertFlightPointQuery = "INSERT INTO `" + this.name + "_Flight_Points` (`Index_ID`, `Name`, `Type`," +
" `Altitude`, `Latitude`, `Longitude`, `Heading`, `Tot_Dist`, `Leg_Dist`, `Via`, `Order`) VALUES "; " `Altitude`, `Latitude`, `Longitude`, `Order`) VALUES ";
String flightType = type.replace("\"", "\"\""); String flightType = type.replace("\"", "\"\"");
String flightName = name.replace("\"", "\"\""); String flightName = name.replace("\"", "\"\"");
insertFlightPointQuery += "(" + id +", \""+ flightName +"\", \"" + flightType + "\", "+ altitudeVal + ", " + insertFlightPointQuery += "(" + id +", \""+ flightName +"\", \"" + flightType + "\", "+ altitudeVal + ", " +
"" + latitudeVal + ", " + longitudeVal + ", " + headingVal + ", " + totalDistVal + ", " + legDistVal + "" + latitudeVal + ", " + longitudeVal + ", "+index+")";
", \"" + via + "\", "+index+")";
stmt.execute(insertFlightPointQuery); stmt.execute(insertFlightPointQuery);
stmt.close(); stmt.close();
//move all the points after this forward //move all the points after this forward
@ -1258,7 +1272,6 @@ public class Dataset {
String query = "UPDATE `"+this.name+"_Flight_Path` SET `Source_Airport` = \""+flightName+"\" " + String query = "UPDATE `"+this.name+"_Flight_Path` SET `Source_Airport` = \""+flightName+"\" " +
"WHERE `Path_ID` = "+flightPath.getID(); "WHERE `Path_ID` = "+flightPath.getID();
stmt.execute(query); stmt.execute(query);
c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
} }
@ -1269,7 +1282,6 @@ public class Dataset {
String query = "UPDATE `"+this.name+"_Flight_Path` SET `Destination_Airport` = \""+flightName+"\" " + String query = "UPDATE `"+this.name+"_Flight_Path` SET `Destination_Airport` = \""+flightName+"\" " +
"WHERE `Path_ID` = "+flightPath.getID(); "WHERE `Path_ID` = "+flightPath.getID();
stmt.execute(query); stmt.execute(query);
c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
} }
@ -1281,10 +1293,10 @@ public class Dataset {
System.exit(0); System.exit(0);
} }
FlightPoint pointToAdd = new FlightPoint(name, pointID+1, id, type, via, headingVal, altitudeVal, legDistVal, FlightPoint pointToAdd = new FlightPoint(type, pointID+1, id, name, altitudeVal, latitudeVal, longitudeVal);
totalDistVal,latitudeVal, longitudeVal);
updateFlightPointInfo(flightPathDictionary.get(Integer.valueOf(id)));
flightPathDictionary.get(Integer.valueOf(id)).addFlightPoint(pointToAdd, index); flightPathDictionary.get(Integer.valueOf(id)).addFlightPoint(pointToAdd, index);
flightPointDictionary.put(pointID + 1, pointToAdd);
updateFlightPointInfo(flightPathDictionary.get(Integer.valueOf(id)));
} }
/*** /***
@ -1294,9 +1306,8 @@ public class Dataset {
* @throws DataException * @throws DataException
*/ */
public void addFlightPointToPath(FlightPoint point, int index) throws DataException{ public void addFlightPointToPath(FlightPoint point, int index) throws DataException{
addFlightPointToPath(point.getIndex(), point.getName(), point.getType(), point.getVia(), String.valueOf(point.getAltitude()), addFlightPointToPath(point.getIndex(), point.getName(), point.getType(), String.valueOf(point.getAltitude()),
String.valueOf( point.getLatitude()),String.valueOf(point.getLongitude()), String.valueOf( point.getLatitude()),String.valueOf(point.getLongitude()), index);
String.valueOf(point.getHeading()), String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), index);
} }
/*** /***
* Adds a single flight Point to an Existing FLight Path appended on the end of the list. * Adds a single flight Point to an Existing FLight Path appended on the end of the list.
@ -1304,9 +1315,8 @@ public class Dataset {
* @throws DataException * @throws DataException
*/ */
public void addFlightPointToPath(FlightPoint point) throws DataException{ public void addFlightPointToPath(FlightPoint point) throws DataException{
addFlightPointToPath(point.getIndex(), point.getName(), point.getType(), point.getVia(), String.valueOf(point.getAltitude()), addFlightPointToPath(point.getIndex(), point.getName(), point.getType(), String.valueOf(point.getAltitude()),
String.valueOf( point.getLatitude()),String.valueOf(point.getLongitude()), String.valueOf( point.getLatitude()),String.valueOf(point.getLongitude()), -1);
String.valueOf(point.getHeading()), String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), -1);
} }
/** /**
@ -1314,19 +1324,14 @@ public class Dataset {
* @param id * @param id
* @param name * @param name
* @param type * @param type
* @param via
* @param altitude * @param altitude
* @param latitude * @param latitude
* @param longitude * @param longitude
* @param heading
* @param legDist
* @param totDist
* @throws DataException * @throws DataException
*/ */
public void addFlightPointToPath(int id, String name, String type, String via, String altitude, String latitude, String longitude, public void addFlightPointToPath(int id, String name, String type, String altitude, String latitude, String longitude) throws DataException{
String heading, String legDist, String totDist) throws DataException{ addFlightPointToPath(id, name, type, altitude, latitude, longitude, -1);
addFlightPointToPath(id, name, type, via, altitude, latitude, longitude, heading, legDist, totDist, -1);
} }
/** /**
* This is called in conjunction to the App deleteDataset DO NOT CALL UNLESS THROUGH APP.DELETEDATASET * This is called in conjunction to the App deleteDataset DO NOT CALL UNLESS THROUGH APP.DELETEDATASET
@ -1367,14 +1372,10 @@ public class Dataset {
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
//System.out.println(airline.getID()); String deleteQuery = "DELETE FROM `" + this.name + "_Airline` WHERE `Airline_ID` = " + airline.getID() + ";";
String deleteQuery = "DELETE FROM `"+this.name+"_Airline` WHERE `Airline_ID` = " + airline.getID() + ";";
stmt = c.createStatement(); stmt = c.createStatement();
//System.out.println("Airline deleted");
stmt.execute(deleteQuery); stmt.execute(deleteQuery);
//System.out.println("Airline deleted");
stmt.close(); stmt.close();
//System.out.println("Airline deleted");
stmt = c.createStatement(); stmt = c.createStatement();
//check if number of countries that contain airlines > 0 else delete the country //check if number of countries that contain airlines > 0 else delete the country
String countCountry = "SELECT COUNT(*) FROM `"+this.name+"_Airline` JOIN `"+this.name+"_Country` ON" + String countCountry = "SELECT COUNT(*) FROM `"+this.name+"_Airline` JOIN `"+this.name+"_Country` ON" +
@ -1546,7 +1547,12 @@ public class Dataset {
public void deleteFlightPath(FlightPath flightPath){ public void deleteFlightPath(FlightPath flightPath){
//delete all flight points with the id //delete all flight points with the id
while(flightPath.getFlightPoints().size() > 0){ while(flightPath.getFlightPoints().size() > 0){
deleteFlightPoint(flightPath.getFlightPoints().get(0), flightPath); try {
flightPointDictionary.remove(flightPath.getFlightPoints().get(0).getID());
flightPath.getFlightPoints().remove(0);
} catch (DataException e) {
e.printStackTrace();
}
} }
//drop the entries //drop the entries
Connection c = null; Connection c = null;
@ -1587,21 +1593,41 @@ public class Dataset {
* @param flightPoint * @param flightPoint
*/ */
public void deleteFlightPoint(FlightPoint flightPoint, FlightPath flightPath){ public void deleteFlightPoint(FlightPoint flightPoint, FlightPath flightPath){
if (flightPath.getFlightPoints().size() > 2){
//drop the tables //drop the tables
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
String deleteQuery = "DELETE FROM `"+this.name+"_Flight_Points` WHERE `Point_ID` = " + flightPoint.getID() + ";"; String deleteQuery = "DELETE FROM `" + this.name + "_Flight_Points` WHERE `Point_ID` = " + flightPoint.getID() + ";";
stmt = c.createStatement(); stmt = c.createStatement();
stmt.execute(deleteQuery); stmt.execute(deleteQuery);
stmt = c.createStatement();
String updatePointOrderQuery = "";
for (int i = 0; i < flightPath.getFlightPoints().size(); i++) {
updatePointOrderQuery = "UPDATE `" + this.name + "_Flight_Points` SET `Order` = " + i + " WHERE `Point_ID` = " + flightPath.getFlightPoints().get(i).getID() + ";";
stmt.execute(updatePointOrderQuery);
}
stmt.close();
c.close(); c.close();
} catch ( Exception e ) { } catch (Exception e) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println(e.getClass().getName() + ": " + e.getMessage());
System.exit(0); System.exit(0);
} }
flightPath.getFlightPoints().remove(flightPoint); flightPath.getFlightPoints().remove(flightPoint);
flightPointDictionary.remove(flightPoint);
updateFlightPointInfo(flightPath);
updateFlightPath(flightPath);
}else{
Alert cannotDelete = new Alert(Alert.AlertType.ERROR);
cannotDelete.setTitle("Flight Path Error");
cannotDelete.setHeaderText("Cannot Delete Flight Point.");
cannotDelete.setContentText("You cannot have less than 2 Points in a Flight Path.");
cannotDelete.showAndWait();
}
} }
/** /**
@ -1693,6 +1719,15 @@ public class Dataset {
return flightPathDictionary; return flightPathDictionary;
} }
/**
* returns a flightpoint dictionary with the flights that are associated with this dataset.
*
* @return
*/
public LinkedHashMap<Integer, FlightPoint> getFlightPointDictionary() {
return flightPointDictionary;
}
/** /**
* returns a Country Dictionary with the COuntries that are associated with this dataset. * returns a Country Dictionary with the COuntries that are associated with this dataset.
* @return * @return
@ -1709,6 +1744,10 @@ public class Dataset {
return cityDictionary; return cityDictionary;
} }
public LinkedHashMap<String, Equipment> getEquipmentDictionary() {
return equipmentDictionary;
}
/** /**
* Edits Airline and commits them to the database. * Edits Airline and commits them to the database.
* @param index * @param index
@ -1739,9 +1778,10 @@ public class Dataset {
public void editAirline(Airline airline, String name, String alias, String IATA, String ICAO, String callsign, String country, String active ) throws DataException { public void editAirline(Airline airline, String name, String alias, String IATA, String ICAO, String callsign, String country, String active ) throws DataException {
//check the data errors //check the data errors
EntryParser parser = new EntryParser(); EntryParser parser = new EntryParser();
airlineDictionary.remove(airline);
parser.parseAirline(name, alias, IATA,ICAO, callsign, country, active); parser.parseAirline(name, alias, IATA,ICAO, callsign, country, active);
airline.setName(name); airline.setName(name);
airline.setAlias(name); airline.setAlias(alias);
airline.setIATA(IATA); airline.setIATA(IATA);
airline.setICAO(ICAO); airline.setICAO(ICAO);
airline.setCallSign(callsign); airline.setCallSign(callsign);
@ -1753,7 +1793,7 @@ public class Dataset {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
stmt = c.createStatement(); stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Airline` SET `Name` = \""+airline.getName().replace("\"", "\"\"")+"\", `Alias` = \""+airline.getActive().replace("\"", "\"\"")+"\", " + String query = "UPDATE `"+this.name+"_Airline` SET `Name` = \""+airline.getName().replace("\"", "\"\"")+"\", `Alias` = \""+airline.getAlias().replace("\"", "\"\"")+"\", " +
"`IATA` = \""+airline.getIATA().replace("\"", "\"\"")+"\", `ICAO` = \""+airline.getICAO().replace("\"", "\"\"")+"\" , `Callsign` = \""+airline.getCallSign().replace("\"", "\"\"")+"\", " + "`IATA` = \""+airline.getIATA().replace("\"", "\"\"")+"\", `ICAO` = \""+airline.getICAO().replace("\"", "\"\"")+"\" , `Callsign` = \""+airline.getCallSign().replace("\"", "\"\"")+"\", " +
"`Country` = \""+airline.getCountryName().replace("\"", "\"\"")+"\", `Active` = \""+airline.getActive().replace("\"", "\"\"")+"\" WHERE `Airline_ID` = "+airline.getID(); "`Country` = \""+airline.getCountryName().replace("\"", "\"\"")+"\", `Active` = \""+airline.getActive().replace("\"", "\"\"")+"\" WHERE `Airline_ID` = "+airline.getID();
stmt.execute(query); stmt.execute(query);
@ -1762,6 +1802,7 @@ public class Dataset {
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
} }
airlineDictionary.put(airline.getName(), airline);
createDataLinks(); createDataLinks();
} }
@ -1803,25 +1844,77 @@ public class Dataset {
*/ */
public void editAirport(Airport airport, String name, String city, String country, String IATA_FFA, String ICAO, String lat, String lng, String alt, String timezone, String DST, String olson) throws DataException { public void editAirport(Airport airport, String name, String city, String country, String IATA_FFA, String ICAO, String lat, String lng, String alt, String timezone, String DST, String olson) throws DataException {
EntryParser parser = new EntryParser(); EntryParser parser = new EntryParser();
airportDictionary.remove(airport.getName());
Airport newAirport = parser.parseAirport(name, city, country, IATA_FFA, ICAO, lat, lng, alt, timezone, DST, olson); Airport newAirport = parser.parseAirport(name, city, country, IATA_FFA, ICAO, lat, lng, alt, timezone, DST, olson);
airport.setName(name); airport.setName(name);
airport.setCityName(city); airport.setCityName(city);
airport.getCity().setName(city); //airport.getCity().setName(city);
airport.setCountryName(country); airport.setCountryName(country);
airport.getCountry().setName(country); //airport.getCountry().setName(country);
airport.setIATA_FFA(IATA_FFA); airport.setIATA_FFA(IATA_FFA);
airport.setICAO(ICAO); airport.setICAO(ICAO);
airport.setLatitude(newAirport.getLatitude()); airport.setLatitude(newAirport.getLatitude());
airport.setLongitude(newAirport.getLongitude()); airport.setLongitude(newAirport.getLongitude());
airport.setAltitude(newAirport.getAltitude());
airport.getCity().setTimezone(Double.parseDouble(timezone)); airport.getCity().setTimezone(Double.parseDouble(timezone));
airport.getCountry().setDST(DST); airport.getCountry().setDST(DST);
airport.getCity().setTimeOlson(olson); airport.getCity().setTimeOlson(olson);
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
/*
//UPDATE CITY AND COUNTRIES
*/
if (cityDictionary.containsKey(city) && cityDictionary.get(city) != null){
airport.setCity(cityDictionary.get(city));
airport.getCity().setCountry(country);
airport.getCity().setTimezone(Double.parseDouble(timezone));
airport.getCity().setTimeOlson(olson);
//update city in database
stmt = c.createStatement();
String updateCityQuery = "UPDATE `"+this.name+"_City` SET `Country_Name` = \""+country+"\", " +
"`Timezone` = "+timezone+", `Olson_Timezone` = \""+olson+"\" WHERE `City_Name` = \""+city+"\"";
stmt.execute(updateCityQuery);
stmt.close();
}else {
City newCity = new City(city, country, Double.parseDouble(timezone), olson);
airport.setCity(newCity);
airport.setCityName(city);
cities.add(newCity);
cityDictionary.put(city, newCity);
//add new City to database
stmt = c.createStatement();
String addNewCity = "INSERT INTO `"+this.name+"_City` (`City_Name`, `Country_name`, `Timezone`, `Olson_Timezone`) VALUES " +
"(\""+city+"\", \""+country+"\", "+timezone+", \""+olson+"\")";
stmt.execute(addNewCity);
stmt.close();
}
if (countryDictionary.containsKey(country) && countryDictionary.get(country) != null){
airport.setCountry(countryDictionary.get(country));
airport.getCountry().setDST(DST);
//update country in database
stmt = c.createStatement();
String updateCountryQuery = "UPDATE `"+this.name+"_Country` SET `DST` = "+DST+" WHERE `Country_Name` = \""+country+"\"";
stmt.execute(updateCountryQuery);
stmt.close();
}else{
Country newCountry = new Country(DST, name);
airport.setCountry(newCountry);
airport.setCountryName(country);
countries.add(newCountry);
countryDictionary.put(country, newCountry);
//add new COuntry to database
stmt = c.createStatement();
String createCountryQuery = "INSERT INTO `"+this.name+"_Country` (`Country_Name`, `DST`) VALUES (\""+country+"\", \""+DST+"\")";
stmt.execute(createCountryQuery);
stmt.close();
}
stmt = c.createStatement(); stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Airport` SET `Name` = \""+airport.getName().replace("\"", "\"\"")+"\", `City` = \""+airport.getCityName().replace("\"", "\"\"")+"\", " + String query = "UPDATE `"+this.name+"_Airport` SET `Name` = \""+airport.getName().replace("\"", "\"\"")+"\", `City` = \""+airport.getCityName().replace("\"", "\"\"")+"\", " +
"`Country` = \""+airport.getCountryName().replace("\"", "\"\"")+"\", `IATA/FFA` = \""+airport.getIATA_FFA().replace("\"", "\"\"")+"\", " + "`Country` = \""+airport.getCountryName().replace("\"", "\"\"")+"\", `IATA/FFA` = \""+airport.getIATA_FFA().replace("\"", "\"\"")+"\", " +
@ -1833,6 +1926,7 @@ public class Dataset {
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
} }
airportDictionary.put(airport.getName(), airport);
createDataLinks(); createDataLinks();
} }
@ -1864,6 +1958,8 @@ public class Dataset {
*/ */
public void editRoute(Route route, String airline, String source, String dest, String code, String stops, String equip) throws DataException { public void editRoute(Route route, String airline, String source, String dest, String code, String stops, String equip) throws DataException {
EntryParser entryParser = new EntryParser(); EntryParser entryParser = new EntryParser();
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
routeDictionary.remove(route.getAirlineName()+route.getDepartureAirport()+route.getArrivalAirport()+route.getCode()+route.getStops() + route.getEquipment());
Route newRoute = entryParser.parseRoute(airline, source, dest, code, stops, equip); Route newRoute = entryParser.parseRoute(airline, source, dest, code, stops, equip);
route.setAirlineName(newRoute.getAirlineName()); route.setAirlineName(newRoute.getAirlineName());
route.setDepartureAirport(newRoute.getDepartureAirport()); route.setDepartureAirport(newRoute.getDepartureAirport());
@ -1877,16 +1973,18 @@ public class Dataset {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
stmt = c.createStatement(); stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Routes` SET `Airline` = \""+route.getAirlineName().replace("\"", "\"\"")+"\", " + String query = "UPDATE `" + this.name + "_Routes` SET `Airline` = \"" + route.getAirlineName().replace("\"", "\"\"") + "\", " +
"`Source_Airport` = \""+route.getDepartureAirport().replace("\"", "\"\"")+"\", `Destination_Airport` = \""+route.getArrivalAirport().replace("\"", "\"\"")+"\", " + "`Source_Airport` = \"" + route.getDepartureAirport().replace("\"", "\"\"") + "\", `Destination_Airport` = \"" + route.getArrivalAirport().replace("\"", "\"\"") + "\", " +
"`Codeshare` = \""+route.getCode().replace("\"", "\"\"")+"\", `Stops` = "+route.getStops()+", `Equipment` = \""+route.getEquipment().replace("\"", "\"\"")+"\" " + "`Codeshare` = \"" + route.getCode().replace("\"", "\"\"") + "\", `Stops` = " + route.getStops() + ", `Equipment` = \"" + route.getEquipment().replace("\"", "\"\"") + "\" " +
"WHERE `Route_ID` = "+route.getID(); "WHERE `Route_ID` = " + route.getID();
stmt.execute(query); stmt.execute(query);
stmt.close(); stmt.close();
c.close(); c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
} }
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
routeDictionary.put(route.getAirlineName()+route.getDepartureAirport()+route.getArrivalAirport()+route.getCode()+route.getStops() + route.getEquipment(), route);
createDataLinks(); createDataLinks();
} }
@ -1915,14 +2013,14 @@ public class Dataset {
* @param longitude * @param longitude
* @throws DataException * @throws DataException
*/ */
public void editFlight(FlightPoint flightPoint, String name, String type, String altitude, String latitude, String longitude) throws DataException{ public void editFlight(FlightPoint flightPoint, String name, String type, String altitude, String latitude, String longitude) throws DataException {
EntryParser entryParser = new EntryParser(); EntryParser entryParser = new EntryParser();
FlightPoint flightPoint1 = entryParser.parsePoint(name, type, altitude, latitude, longitude); FlightPoint parsedFlightPoint = entryParser.parsePoint(name, type, altitude, latitude, longitude);
flightPoint.setName(flightPoint1.getName()); flightPoint.setName(parsedFlightPoint.getName());
flightPoint.setType(flightPoint1.getType()); flightPoint.setType(parsedFlightPoint.getType());
flightPoint.setAltitude(flightPoint1.getAltitude()); flightPoint.setAltitude(parsedFlightPoint.getAltitude());
flightPoint.setLatitude(flightPoint1.getLatitude()); flightPoint.setLatitude(parsedFlightPoint.getLatitude());
flightPoint.setLongitude(flightPoint1.getLongitude()); flightPoint.setLongitude(parsedFlightPoint.getLongitude());
Connection c = null; Connection c = null;
@ -1941,35 +2039,33 @@ public class Dataset {
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
} }
updateFlightPath(flightPathDictionary.get(flightPoint.getIndex()));
FlightPath flightPath = flightPathDictionary.get(flightPoint.getIndexID()); createDataLinks();
int indexOf = flightPath.getFlightPoints().indexOf(flightPoint);
if (indexOf == 0){
try {
stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Flight_Path` SET `Source_Airport` = \""+flightPoint.getName().replace("\"", "\"\"")+"\" " +
"WHERE `Path_ID` = "+flightPoint.getIndexID();
stmt.execute(query);
c.close();
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
} }
flightPath.setDepartureAirport(flightPoint.getName());
}else if (indexOf == flightPath.getFlightPoints().size() - 1){ /**
* Updates the flight path to the first Point and the last point
* @param flightPath
*/
private void updateFlightPath(FlightPath flightPath){
Connection c = null;
Statement stmt = null;
FlightPoint startPoint = flightPath.getFlightPoints().get(0);
FlightPoint endPoint = flightPath.getFlightPoints().get(flightPath.getFlightPoints().size() - 1);
try { try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
stmt = c.createStatement(); stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Flight_Path` SET `Destination_Airport` = \""+flightPoint.getName().replace("\"", "\"\"")+"\" " + String query= "UPDATE `"+this.name+"_Flight_Path` SET `Source_Airport` = \""+startPoint.getName().replace("\"", "\"\"")+"\", " +
"WHERE `Path_ID` = "+flightPoint.getIndexID(); "`Destination_Airport` = \""+endPoint.getName().replace("\"", "\"\"") + "\" " +
"WHERE `Path_ID` = "+startPoint.getIndex();
stmt.execute(query); stmt.execute(query);
c.close(); c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
} }
flightPath.setArrivalAirport(flightPoint.getName()); flightPath.setArrivalAirport(endPoint.getName());
} flightPath.setDepartureAirport(startPoint.getName());
updateFlightPointInfo(flightPath);
createDataLinks();
} }
/** /**
@ -1985,9 +2081,6 @@ public class Dataset {
int curIndex = flightPath.getFlightPoints().indexOf(flightPoint); int curIndex = flightPath.getFlightPoints().indexOf(flightPoint);
flightPath.getFlightPoints().remove(flightPoint); flightPath.getFlightPoints().remove(flightPoint);
int indexToAdd = index; int indexToAdd = index;
if (curIndex < index){
indexToAdd --;
}
flightPath.getFlightPoints().add(indexToAdd, flightPoint); flightPath.getFlightPoints().add(indexToAdd, flightPoint);
Connection c = null; Connection c = null;
@ -2002,30 +2095,7 @@ public class Dataset {
stmt.execute(updatePointOrderQuery); stmt.execute(updatePointOrderQuery);
} }
stmt.close(); stmt.close();
updateFlightPath(flightPath);
if (index == 0){
try {
stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Flight_Path` SET `Source_Airport` = \""+flightPoint.getName().replace("\"", "\"\"")+"\" " +
"WHERE `Path_ID` = "+flightPoint.getIndex();
stmt.execute(query);
c.close();
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
}
flightPath.setDepartureAirport(flightPoint.getName());
}else if (index == flightPath.getFlightPoints().size() - 1){
try {
stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Flight_Path` SET `Destination_Airport` = \""+flightPoint.getName().replace("\"", "\"\"")+"\" " +
"WHERE `Path_ID` = "+flightPoint.getIndex();
stmt.execute(query);
c.close();
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
}
flightPath.setArrivalAirport(flightPoint.getName());
}
c.close(); c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
@ -2060,4 +2130,12 @@ public class Dataset {
System.exit(0); System.exit(0);
} }
} }
/**
* Name of the dataset in the database
*/
@Override
public String toString(){
return this.name;
}
} }

@ -132,18 +132,26 @@ public class EntryParser {
} }
public FlightPoint parsePoint(String name, String type, String altitude, String latitude, String longitude) throws DataException{ public FlightPoint parsePoint(String name, String type, String altitude, String latitude, String longitude) throws DataException{
//(airport) name (first and last point) //name
name = name.toUpperCase();
if (!isLetter(name)) { if (!isLetter(name)) {
throw new DataException("Airport ICAO code must contain only letters"); throw new DataException("ICAO code (name field) must contain only letters");
}
if (name.length() != 4) {
throw new DataException("Aiport ICAO code must be of length four");
} }
//type //type
type = type.toUpperCase(); type = type.toUpperCase();
if (!type.equals("APT") && !type.equals("VOR") && !type.equals("FIX") && !type.equals("NDB") && !type.equals("LATLON")){ if (!type.equals("APT") && !type.equals("VOR") && !type.equals("FIX") && !type.equals("NDB") && !type.equals("LATLON")){
throw new DataException("Type of flight must be either APT, VOR, FIX, NDB or LATLON"); throw new DataException("Type of flight must be either APT, VOR, FIX, NDB or LATLON");
} }
//altitude
double alt;
try{
alt = Double.parseDouble(altitude);
}catch (NumberFormatException e){
throw new DataException ("Altitude must be a number");
}
if (alt < 0 || alt > 50000){
throw new DataException("Altitude must be between 0 and 50000ft inclusive.");
}
//latitude //latitude
double lat; double lat;
try{ try{
@ -164,13 +172,7 @@ public class EntryParser {
if (lng > 180 || lng < -180){ if (lng > 180 || lng < -180){
throw new DataException("Longitude must be between -180 and 180 inclusive."); throw new DataException("Longitude must be between -180 and 180 inclusive.");
} }
//altitude
double alt;
try{
alt = Double.parseDouble(altitude);
}catch (NumberFormatException e){
throw new DataException ("Altitude must be a number");
}
FlightPoint parseSuccess = new FlightPoint(type, name, alt, lat, lng); FlightPoint parseSuccess = new FlightPoint(type, name, alt, lat, lng);
return parseSuccess; return parseSuccess;
} }

@ -5,15 +5,18 @@ 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"),
AIRPORT_DIST_CALC("airport_dist_calc.fxml"), AIRLINE_ADD("airline_add_form.fxml"), AIRLINE_FILTER("airline_filter_form.fxml"), AIRPORT_DIST_CALC("airport_dist_calc.fxml"), AIRLINE_ADD("airline_add_form.fxml"), AIRLINE_FILTER("airline_filter_form.fxml"),
AIRPORT_ADD("airport_add_form.fxml"), AIRPORT_FILTER("airport_filter_form.fxml"), ROUTE_ADD("route_add_form.fxml"), AIRPORT_ADD("airport_add_form.fxml"), AIRPORT_FILTER("airport_filter_form.fxml"), ROUTE_ADD("route_add_form.fxml"),
ROUTE_FILTER("route_filter_form.fxml"),ANALYSER_TAB("analyser_main_page.fxml"), CHART_ERROR("too_many_options_pie.fxml"), ROUTE_FILTER("route_filter_form.fxml"), AIRLINE_EDIT("airline_edit_form.fxml"), AIRPORT_EDIT("airport_edit_form.fxml"),
ROUTE_EDIT("route_edit_form.fxml"), FLIGHT_EDITOR("flight_editor_form.fxml"), DATASET_CONTROLLER("dataset_editor.fxml"), HELP("help.fxml"),
FLIGHT_ADD("flight_add_form.fxml"), ROUTE_BY_AIRPORT("airport_map_routes.fxml"), ROUTE_BY_EQUIP("route_by_equip.fxml"), ANALYSER_TAB("analyser_main_page.fxml"), CHART_ERROR("too_many_options_pie.fxml"),
BAR_GRAPH_CHOOSER("bar_graph_chooser.fxml"), PIE_GRAPH_CHOOSER("pie_graph_chooser.fxml"); BAR_GRAPH_CHOOSER("bar_graph_chooser.fxml"), PIE_GRAPH_CHOOSER("pie_graph_chooser.fxml");
private String filePath; private String filePath;
/** /**

@ -1,8 +1,10 @@
package seng202.group9.Controller; package seng202.group9.Controller;
import javafx.collections.ObservableList;
import seng202.group9.Core.Airline; import seng202.group9.Core.Airline;
import seng202.group9.Core.FlightPoint;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -14,6 +16,9 @@ import java.util.HashMap;
public class Session implements Serializable { public class Session implements Serializable {
private SceneCode sceneDisplayed; private SceneCode sceneDisplayed;
private int currentFlightPointID;
private int currentFlightPathID;
private HashMap<Integer, String> filteredAirlines; private HashMap<Integer, String> filteredAirlines;
private HashMap<Integer, String> filteredAirports; private HashMap<Integer, String> filteredAirports;
private HashMap<Integer, String> filteredRoutes; private HashMap<Integer, String> filteredRoutes;
@ -63,6 +68,13 @@ public class Session implements Serializable {
this.usefilter = usefilter; this.usefilter = usefilter;
} }
private String airlineToEdit;
private String airportToEdit;
private String routeToEdit;
private String currentDataset;
/** /**
* Constructor for a new session * Constructor for a new session
*/ */
@ -79,6 +91,14 @@ public class Session implements Serializable {
this.sceneDisplayed = scene; this.sceneDisplayed = scene;
} }
public String getCurrentDataset(){
return this.currentDataset;
}
public void setCurrentDataset(String currentDataset){
this.currentDataset = currentDataset;
}
/** /**
* changes the serialized scene. * changes the serialized scene.
* @param sceneDisplayed * @param sceneDisplayed
@ -119,4 +139,60 @@ public class Session implements Serializable {
return filteredRoutes; return filteredRoutes;
} }
public void setAirlineToEdit(String name) {
this.airlineToEdit = name;
}
public String getAirlineToEdit() {
return airlineToEdit;
}
public String getAirportToEdit() {
return airportToEdit;
}
public void setAirportToEdit(String airport) {
this.airportToEdit = airport;
}
public String getRouteToEdit() {
return routeToEdit;
}
public void setRouteToEdit(String route) {
this.routeToEdit = route;
}
/**
* sets the current flight point
* @param currentFlightPointID
*/
public void setCurrentFlightPointID(int currentFlightPointID) {
this.currentFlightPointID = currentFlightPointID;
}
/**
* gets the current flight point
* @return
*/
public int getCurrentFlightPointID() {
return currentFlightPointID;
}
/**
* sets the current flight point
* @param currentFlightPathID
*/
public void setCurrentFlightPathtID(int currentFlightPathID) {
this.currentFlightPathID = currentFlightPathID;
}
/**
* gets the current flight point
* @return
*/
public int getCurrentFlightPathID() {
return currentFlightPathID;
}
} }

@ -278,7 +278,7 @@ public class Airline{
if (!this.ICAO.equals("") && this.ICAO.equals(airline.getICAO())){ if (!this.ICAO.equals("") && this.ICAO.equals(airline.getICAO())){
throw new DataException("This ICAO Code already Exists, Please Choose Another."); throw new DataException("This ICAO Code already Exists, Please Choose Another.");
} }
if (!this.alias.equals("") && this.alias.equals(airline.getAlias())){ if (!this.alias.equals("") && !this.alias.equals("\\N") && !this.alias.equals("\\n") && this.alias.equals(airline.getAlias())){
throw new DataException("This Alias already Exists, Please Choose Another."); throw new DataException("This Alias already Exists, Please Choose Another.");
} }
if (!this.callSign.equals("") && this.callSign.equals(airline.getCallSign())){ if (!this.callSign.equals("") && this.callSign.equals(airline.getCallSign())){

@ -426,6 +426,9 @@ public class Airport {
throw new DataException("Airport ICAO already Exists, Please Choose Another."); throw new DataException("Airport ICAO already Exists, Please Choose Another.");
} }
} }
public int getTotalRoutes(){
return departureRoutes.size() + arrivalRoutes.size();
}
/** /**
* Information of the airport returned in String format. * Information of the airport returned in String format.
*/ */

@ -0,0 +1,45 @@
package seng202.group9.Core;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by fwy13 on 2/10/16.
*/
public class Equipment {
private String name;
private HashMap<Integer, Route> routesUsed;
public Equipment(String name){
this.name = name;
routesUsed = new HashMap<>();
}
public void resetRoutes(){
routesUsed = new HashMap<>();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void addRoute(Route route){
routesUsed.put(routesUsed.size(), route);
}
public HashMap<Integer, Route> getRoutesUsed() {
return routesUsed;
}
public void setRoutesUsed(HashMap<Integer, Route> routesUsed) {
this.routesUsed = routesUsed;
}
public int getRouteNum(){
return routesUsed.size();
}
}

@ -28,7 +28,7 @@ public class FlightPath {
} }
/** /**
* COnstructor for FlightPath from dataset add later the ID needs to be set from database. * Constructor for FlightPath from dataset add later the ID needs to be set from database.
* @param departureAirport * @param departureAirport
* @param arrivalAirport * @param arrivalAirport
*/ */

@ -60,6 +60,24 @@ public class FlightPoint {
this.longitude = longitude; this.longitude = longitude;
} }
public FlightPoint(String type, int id, int index, String name, double altitude, double latitude, double longitude){
//extra calculations will have to be used to find heading, legdistance and total distance. If necessary
//Type 1 file the file the lecturers gave us
//indexID = flight path ID
//ID = unique Auto Increment value
this.name = name;
this.ID = id;
this.indexID = index;
this.type = type;
this.via = "";
this.heading = 0;
this.altitude = altitude;
this.legDistance = 0.0;
this.totalDistance = 0.0;
this.latitude = latitude;
this.longitude = longitude;
}
/** /**
* Constructor when getting points from the database. * Constructor when getting points from the database.
* @param name Name for the point. * @param name Name for the point.

@ -1,6 +1,5 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.Button; import javafx.scene.control.Button;
@ -9,10 +8,12 @@ import javafx.stage.Stage;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
/** /**
* Created by Sunguin on 2016/09/22. * The GUI controller class for airline_add_form.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin
*/ */
public class AirlineAddController extends Controller { public class AirlineAddController extends Controller {
//Setting up text fields for adding data //Setting up text fields for adding data.
@FXML @FXML
private TextField airlNameAdd; private TextField airlNameAdd;
@FXML @FXML
@ -30,8 +31,16 @@ public class AirlineAddController extends Controller {
@FXML @FXML
private Button addButton; private Button addButton;
//Set an empty Dataset to be assigned to the current dataset.
private Dataset theDataSet = null; private Dataset theDataSet = null;
/**
* Loads up the current dataset.
*/
public void load() {
theDataSet = getParent().getCurrentDataset();
}
/** /**
* Adds a single airline entry to the database. * Adds a single airline entry to the database.
* Takes in values from the GUI the user has typed in. * Takes in values from the GUI the user has typed in.
@ -58,26 +67,23 @@ public class AirlineAddController extends Controller {
airlCountryAdd.clear(); airlCountryAdd.clear();
airlActiveAdd.clear(); airlActiveAdd.clear();
//Saying to the user that the airline has successfully added.
Alert alert = new Alert(Alert.AlertType.INFORMATION); Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Airline Add Successful"); alert.setTitle("Airline Add Successful");
alert.setHeaderText("New Airline added!"); alert.setHeaderText("New Airline added!");
alert.setContentText("Your new airline has been successfully added into the database."); alert.setContentText("Your new airline has been successfully added into the database.");
alert.showAndWait(); alert.showAndWait();
//Closes the add form.
Stage stage = (Stage) addButton.getScene().getWindow(); Stage stage = (Stage) addButton.getScene().getWindow();
stage.close(); stage.close();
} catch (Exception e) { } catch (Exception e) {
//Tells the user what and where the error is.
Alert alert = new Alert(Alert.AlertType.ERROR); Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Airline Data Error"); alert.setTitle("Airline Data Error");
alert.setHeaderText("Error adding a custom airline entry."); alert.setHeaderText("Error adding a custom airline entry.");
alert.setContentText(e.getMessage()); alert.setContentText(e.getMessage());
alert.showAndWait(); alert.showAndWait();
} }
}
public void load() {
theDataSet = getParent().getCurrentDataset();
} }
} }

@ -0,0 +1,95 @@
package seng202.group9.GUI;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.EntryParser;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Airline;
/**
* The GUI controller class for airline_edit_form.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin
*/
public class AirlineEditController extends Controller {
//Setting up text fields for editing data.
@FXML
private TextField airlNameEdit;
@FXML
private TextField airlAliasEdit;
@FXML
private TextField airlIATAEdit;
@FXML
private TextField airlICAOEdit;
@FXML
private TextField airlCallsignEdit;
@FXML
private TextField airlCountryEdit;
@FXML
private TextField airlActiveEdit;
@FXML
private Button applyButton;
//Sets up an empty Dataset to be assigned to the current dataset.
private Dataset theDataSet = null;
//Sets up an empty session to be assigned to the current session.
private Session currentSession = null;
//Sets up an empty airline to be assigned to the airline being edited.
private Airline toEdit = null;
/**
* Loads up the current dataset and current session.
* Also gets the airline to be edited from the table.
* Sets the text fields as the airline selected.
*/
public void load() {
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
toEdit = theDataSet.getAirlineDictionary().get(currentSession.getAirlineToEdit());
airlNameEdit.setText(toEdit.getName());
airlAliasEdit.setText(toEdit.getAlias());
airlIATAEdit.setText(toEdit.getIATA());
airlICAOEdit.setText(toEdit.getICAO());
airlCallsignEdit.setText(toEdit.getCallSign());
airlCountryEdit.setText(toEdit.getCountryName());
airlActiveEdit.setText(toEdit.getActive());
}
/**
* Edits the current airline and closes the popup window.
* Takes in the values from the text fields.
* @see Dataset
*/
public void editAirline() {
//Tries to edit an airport and comes up with a popup if successful and exits the popup.
//Otherwise an error message will pop up with what is wrong.
try {
EntryParser parser = new EntryParser();
parser.parseAirline(airlNameEdit.getText(), airlAliasEdit.getText(), airlIATAEdit.getText(),
airlICAOEdit.getText(), airlCallsignEdit.getText(), airlCountryEdit.getText(), airlActiveEdit.getText());
theDataSet.editAirline(toEdit, airlNameEdit.getText(), airlAliasEdit.getText(), airlIATAEdit.getText(),
airlICAOEdit.getText(), airlCallsignEdit.getText(), airlCountryEdit.getText(), airlActiveEdit.getText());
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Airline Edit Successful");
alert.setHeaderText("Airline data edited!");
alert.setContentText("Your airline data has been successfully edited.");
alert.showAndWait();
Stage stage = (Stage) applyButton.getScene().getWindow();
stage.close();
} catch (DataException e) {
System.err.println("RIP Harambe: " + e.getMessage() + "IT WAS TOO SOON");
}
}
}

@ -17,7 +17,9 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
/** /**
* Created by Sunguin on 2016/09/22. * The GUI controller class for airline_filter_form.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin
*/ */
public class AirlineFilterController extends Controller { public class AirlineFilterController extends Controller {
@ -42,6 +44,14 @@ public class AirlineFilterController extends Controller {
private Dataset theDataSet = null; private Dataset theDataSet = null;
private Session currentSession = null; private Session currentSession = null;
/**
* Loads up the current dataset and current session.
*/
public void load() {
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
}
/** /**
* Filters airlines by any field. * Filters airlines by any field.
* These are specified by what the user has typed in the filter boxes. * These are specified by what the user has typed in the filter boxes.
@ -79,22 +89,17 @@ public class AirlineFilterController extends Controller {
alert.setContentText("Your airline data has been successfully filtered."); alert.setContentText("Your airline data has been successfully filtered.");
alert.showAndWait(); alert.showAndWait();
//currentSession.setFilteredAirlines(FXCollections.observableArrayList(filter.getFilteredData())); //Creates a new hashmap for airlines and fills it with airlines that fit the criteria specified by the user.
//Saves it into the current session.
HashMap<Integer, String> airlinesHM = new HashMap<Integer, String>(); HashMap<Integer, String> airlinesHM = new HashMap<Integer, String>();
ArrayList<Airline> airlines = filter.getFilteredData(); ArrayList<Airline> airlines = filter.getFilteredData();
//for (Airline airline: airlines) {
for (int index = 0; index < airlines.size(); index++) { for (int index = 0; index < airlines.size(); index++) {
airlinesHM.put(index, airlines.get(index).getName()); airlinesHM.put(index, airlines.get(index).getName());
} }
currentSession.setFilteredAirlines(airlinesHM); currentSession.setFilteredAirlines(airlinesHM);
//Closes the popup.
Stage stage = (Stage) applyButton.getScene().getWindow(); Stage stage = (Stage) applyButton.getScene().getWindow();
stage.close(); stage.close();
} }
public void load() {
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
}
} }

@ -49,6 +49,9 @@ public class AirlineRDController extends Controller {
* Also sets up the dropdown menu options. * Also sets up the dropdown menu options.
*/ */
public void load() { public void load() {
if (!checkDataset()){
return;
}
//Sets up the table columns to be ready for use for Airline data //Sets up the table columns to be ready for use for Airline data
airlIDCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID")); airlIDCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
airlNameCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name")); airlNameCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
@ -69,7 +72,7 @@ public class AirlineRDController extends Controller {
/** /**
* Opens the Airline add form. * Opens the Airline Add form.
*/ */
public void openAdd() { public void openAdd() {
createPopUpStage(SceneCode.AIRLINE_ADD, 600, 370); createPopUpStage(SceneCode.AIRLINE_ADD, 600, 370);
@ -82,11 +85,8 @@ public class AirlineRDController extends Controller {
public void openFilter() { public void openFilter() {
createPopUpStage(SceneCode.AIRLINE_FILTER, 600, 370); createPopUpStage(SceneCode.AIRLINE_FILTER, 600, 370);
ArrayList<Airline> d = new ArrayList(); ArrayList<Airline> d = new ArrayList();
for(int i = 0; i < theDataSet.getAirlines().size(); i++) { for (int key: currentSession.getFilteredAirlines().keySet()){
if (currentSession.getFilteredAirlines().containsValue(theDataSet.getAirlines().get(i).getName()) d.add(theDataSet.getAirlineDictionary().get(currentSession.getFilteredAirlines().get(key)));
&& currentSession.getFilteredAirlines().containsKey(i)) {
d.add(theDataSet.getAirlines().get(i));
}
} }
tableViewAirlineRD.setItems(FXCollections.observableArrayList(d)); tableViewAirlineRD.setItems(FXCollections.observableArrayList(d));
} }
@ -104,7 +104,6 @@ public class AirlineRDController extends Controller {
alert.setTitle("Airline Delete Confirmation"); alert.setTitle("Airline Delete Confirmation");
alert.setHeaderText("You are about to delete some data."); alert.setHeaderText("You are about to delete some data.");
alert.setContentText("Are you sure you want to delete the selected airline(s)?"); alert.setContentText("Are you sure you want to delete the selected airline(s)?");
//alert.showAndWait();
Optional<ButtonType> result = alert.showAndWait(); Optional<ButtonType> result = alert.showAndWait();
Airline air = null; Airline air = null;
if (result.isPresent() && result.get() == ButtonType.OK) { if (result.isPresent() && result.get() == ButtonType.OK) {
@ -116,6 +115,19 @@ public class AirlineRDController extends Controller {
} }
} }
/**
* Opens the Airline Edit form.
*/
public void editAirline() {
Airline toEdit = tableViewAirlineRD.getSelectionModel().getSelectedItem();
currentSession.setAirlineToEdit(toEdit.getName());
createPopUpStage(SceneCode.AIRLINE_EDIT, 600, 370);
System.out.println(toEdit.getName() + "," + toEdit.getAlias() + "," + toEdit.getIATA() + "," + toEdit.getICAO()
+ "," + toEdit.getCallSign() + "," + toEdit.getCountryName() + "," + toEdit.getActive());
tableViewAirlineRD.refresh();
}
/** /**
* Analyses the current data and creates a graph based on the data. * Analyses the current data and creates a graph based on the data.
@ -125,6 +137,9 @@ public class AirlineRDController extends Controller {
JOptionPane.showMessageDialog(null, "This is not Implemented yet"); JOptionPane.showMessageDialog(null, "This is not Implemented yet");
} }
/**
* Goes to the airline summary page.
*/
public void airlineSummaryButton() { public void airlineSummaryButton() {
replaceSceneContent(SceneCode.AIRLINE_SUMMARY); replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
} }

@ -48,6 +48,9 @@ public class AirlineSummaryController extends Controller{
* Loads initial state of the scene. * Loads initial state of the scene.
*/ */
public void load() { public void load() {
if (!checkDataset()){
return;
}
//Fills the table. //Fills the table.
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"));
@ -57,10 +60,9 @@ public class AirlineSummaryController extends Controller{
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines())); tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines()));
//Sets up map. //Sets up map.
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airline>() { tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airline>() {
public void changed(ObservableValue<? extends Airline> observable, Airline oldValue, Airline newValue) { public void changed(ObservableValue<? extends Airline> observable, Airline oldValue, Airline newValue) {
Airline selectedAirline= currentData.getAirlines().get(tableView.getSelectionModel().getSelectedIndices().get(0)); Airline selectedAirline= tableView.getSelectionModel().getSelectedItems().get(0);
for (int i = 0 ; i < currentData.getAirports().size(); i ++){ for (int i = 0 ; i < currentData.getAirports().size(); i ++){
if (currentData.getAirports().get(i).getCountryName().equals(selectedAirline.getCountryName())){ if (currentData.getAirports().get(i).getCountryName().equals(selectedAirline.getCountryName())){
map.displayAirport(new RoutePath(new Position(currentData.getAirports().get(i).getLatitude(), currentData.getAirports().get(i).getLongitude()))); map.displayAirport(new RoutePath(new Position(currentData.getAirports().get(i).getLatitude(), currentData.getAirports().get(i).getLongitude())));
@ -69,6 +71,7 @@ public class AirlineSummaryController extends Controller{
} }
} }
}); });
map = new Map(mapView, new RoutePath(), tableView);
} }
/** /**

@ -3,6 +3,7 @@ package seng202.group9.GUI;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox; import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -37,7 +38,7 @@ public class AirportAddController extends Controller {
@FXML @FXML
private TextField airpTzAdd; private TextField airpTzAdd;
@FXML @FXML
private TextField addButton; private Button addButton;
//Set an empty Dataset to be assigned later //Set an empty Dataset to be assigned later
private Dataset theDataSet = null; private Dataset theDataSet = null;

@ -0,0 +1,95 @@
package seng202.group9.GUI;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.EntryParser;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Airport;
/**
* Created by Sunguin on 2016/09/24.
*/
public class AirportEditController extends Controller {
//Setting up text fields for adding data
@FXML
private TextField airpNameEdit;
@FXML
private TextField airpCityEdit;
@FXML
private TextField airpCountryEdit;
@FXML
private TextField airpIATAFAAEdit;
@FXML
private TextField airpICAOEdit;
@FXML
private TextField airpLatitudeEdit;
@FXML
private TextField airpLongitudeEdit;
@FXML
private TextField airpAltitudeEdit;
@FXML
private TextField airpTimezoneEdit;
@FXML
private TextField airpDSTEdit;
@FXML
private TextField airpTzEdit;
@FXML
private Button editButton;
//Set an empty Dataset to be assigned later
private Dataset theDataSet = null;
private Session currentSession = null;
private Airport toEdit = null;
public void editAirport() {
try {
EntryParser parser = new EntryParser();
parser.parseAirport(airpNameEdit.getText(), airpCityEdit.getText(), airpCountryEdit.getText(), airpIATAFAAEdit.getText(),
airpICAOEdit.getText(), airpLatitudeEdit.getText(), airpLongitudeEdit.getText(), airpAltitudeEdit.getText(),
airpTimezoneEdit.getText(), airpDSTEdit.getText(), airpTzEdit.getText());
theDataSet.editAirport(toEdit, airpNameEdit.getText(), airpCityEdit.getText(), airpCountryEdit.getText(), airpIATAFAAEdit.getText(),
airpICAOEdit.getText(), airpLatitudeEdit.getText(), airpLongitudeEdit.getText(), airpAltitudeEdit.getText(),
airpTimezoneEdit.getText(), airpDSTEdit.getText(), airpTzEdit.getText());
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Airport Edit Successful");
alert.setHeaderText("Airport data edited!");
alert.setContentText("Your airport data has been successfully edited.");
alert.showAndWait();
Stage stage = (Stage) editButton.getScene().getWindow();
stage.close();
} catch (DataException e) {
System.err.println("RIP Harambe: " + e.getMessage() + "IT WAS TOO SOON");
}
}
public void load() {
if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
toEdit = theDataSet.getAirportDictionary().get(currentSession.getAirportToEdit());
airpNameEdit.setText(toEdit.getName());
airpCityEdit.setText(toEdit.getCityName());
airpCountryEdit.setText(toEdit.getCountryName());
airpIATAFAAEdit.setText(toEdit.getIATA_FFA());
airpICAOEdit.setText(toEdit.getICAO());
airpLatitudeEdit.setText(Double.toString(toEdit.getLatitude()));
airpLongitudeEdit.setText(Double.toString(toEdit.getLongitude()));
airpAltitudeEdit.setText(Double.toString(toEdit.getAltitude()));
airpTimezoneEdit.setText(Double.toString(toEdit.getTimezone()));
airpDSTEdit.setText(toEdit.getDST());
airpTzEdit.setText(toEdit.getTz());
}
}

@ -59,6 +59,11 @@ public class AirportRDController extends Controller{
* Also sets up the dropdown menu options. * Also sets up the dropdown menu options.
*/ */
public void load() { public void load() {
if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset();
if (theDataSet != null) {
//Sets up the table columns to be ready for use for Airport data //Sets up the table columns to be ready for use for Airport data
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"));
@ -68,18 +73,18 @@ public class AirportRDController extends Controller{
airpICAOCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ICAO")); airpICAOCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ICAO"));
airpLatitudeCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Latitude")); airpLatitudeCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Latitude"));
airpLongitudeCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Longitude")); airpLongitudeCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Longitude"));
airpAltitudeCol.setCellValueFactory(new PropertyValueFactory<Airport, String> ("Altitude")); airpAltitudeCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
airpTimezoneCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Timezone")); airpTimezoneCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Timezone"));
airpDSTCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("DST")); airpDSTCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("DST"));
airpTzCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Tz")); airpTzCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Tz"));
//Assigning the Dataset to the current Dataset's airports and displaying it in a table //Assigning the Dataset to the current Dataset's airports and displaying it in a table
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession(); currentSession = getParent().getSession();
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports())); tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
tableViewAirportRD.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); tableViewAirportRD.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
} }
}
public void openAdd() { public void openAdd() {
createPopUpStage(SceneCode.AIRPORT_ADD, 600, 480); createPopUpStage(SceneCode.AIRPORT_ADD, 600, 480);
@ -89,11 +94,8 @@ public class AirportRDController extends Controller{
public void openFilter() { public void openFilter() {
createPopUpStage(SceneCode.AIRPORT_FILTER, 600, 480); createPopUpStage(SceneCode.AIRPORT_FILTER, 600, 480);
ArrayList<Airport> d = new ArrayList(); ArrayList<Airport> d = new ArrayList();
for(int i = 0; i < theDataSet.getAirports().size(); i++) { for (int key: currentSession.getFilteredAirports().keySet()){
if (currentSession.getFilteredAirports().containsValue(theDataSet.getAirports().get(i).getName()) d.add(theDataSet.getAirportDictionary().get(currentSession.getFilteredAirports().get(key)));
&& currentSession.getFilteredAirports().containsKey(i)) {
d.add(theDataSet.getAirports().get(i));
}
} }
tableViewAirportRD.setItems(FXCollections.observableArrayList(d)); tableViewAirportRD.setItems(FXCollections.observableArrayList(d));
} }
@ -105,16 +107,11 @@ public class AirportRDController extends Controller{
*/ */
public void deleteAirport(){ public void deleteAirport(){
//Gets an airport from the table and deletes it before updating the table //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()));
ObservableList<Airport> toDelete = tableViewAirportRD.getSelectionModel().getSelectedItems(); ObservableList<Airport> toDelete = tableViewAirportRD.getSelectionModel().getSelectedItems();
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Airport Delete Confirmation"); alert.setTitle("Airport Delete Confirmation");
alert.setHeaderText("You are about to delete some data."); alert.setHeaderText("You are about to delete some data.");
alert.setContentText("Are you sure you want to delete the selected airport(s)?"); alert.setContentText("Are you sure you want to delete the selected airport(s)?");
//alert.showAndWait();
Optional<ButtonType> result = alert.showAndWait(); Optional<ButtonType> result = alert.showAndWait();
Airport air = null; Airport air = null;
if (result.isPresent() && result.get() == ButtonType.OK) { if (result.isPresent() && result.get() == ButtonType.OK) {
@ -126,6 +123,12 @@ public class AirportRDController extends Controller{
} }
} }
public void editAirport() {
Airport toEdit = tableViewAirportRD.getSelectionModel().getSelectedItem();
currentSession.setAirportToEdit(toEdit.getName());
createPopUpStage(SceneCode.AIRPORT_EDIT, 600, 480);
tableViewAirportRD.refresh();
}
/** /**
* Analyses the current data and creates a graph based on the data. * Analyses the current data and creates a graph based on the data.
@ -136,4 +139,11 @@ public class AirportRDController extends Controller{
public void airportSummaryButton() { public void airportSummaryButton() {
replaceSceneContent(SceneCode.AIRPORT_SUMMARY); replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
} }
/**
* Opens a map with the data currently being displayed in the table.
*/
public void openMap() {
}
} }

@ -0,0 +1,68 @@
package seng202.group9.GUI;
import javafx.beans.InvalidationListener;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.web.WebView;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.*;
import seng202.group9.Map.Map;
import java.util.*;
/**
* Created by fwy13 on 1/10/16.
*/
public class AirportRouteMapController extends Controller{
@FXML
WebView mapView;
@FXML
TableView airportsTable;
@FXML
TableColumn<Airport, String> airportName;
@FXML
TableColumn<Airport, Integer> routes;
ObservableList<Airport> airportsToDisplay;
Dataset currentDataset;
Map map;
@Override
public void load() {
if (!checkDataset()){
return;
}
currentDataset = getParent().getCurrentDataset();
//Sets up map.
map = new Map(mapView, new RoutePath(), airportsTable);
airportName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
routes.setCellValueFactory(new PropertyValueFactory<Airport, Integer>("TotalRoutes"));
airportsToDisplay = FXCollections.observableArrayList();
for (Airport airport: currentDataset.getAirports()){
if (airport.getTotalRoutes() > 0) {
airportsToDisplay.add(airport);
}
}
airportsTable.setItems(airportsToDisplay);
airportsTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airport>() {
public void changed(ObservableValue<? extends Airport> observable, Airport oldValue, Airport newValue) {
Airport selectedAirport= (Airport) airportsTable.getSelectionModel().getSelectedItems().get(0);
ArrayList<RoutePath> routePaths = new ArrayList<RoutePath>();
for (Route route:selectedAirport.getArrivalRoutes()){
routePaths.add(route.getRoutePath());
}
for (Route route:selectedAirport.getDepartureRoutes()){
routePaths.add(route.getRoutePath());
}
map.displayRoutes(routePaths);
}
});
}
}

@ -1,5 +1,6 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
@ -33,9 +34,7 @@ public class AirportSummaryController extends Controller{
@FXML @FXML
private TableColumn<Airport, String> columnCountry; private TableColumn<Airport, String> columnCountry;
@FXML @FXML
private TableColumn<Airport, String> columnAltitude; private TableColumn<Airport, String> columnTotalRoutes;
@FXML
private TableColumn<Airport, String> columnIATA;
//Stores required data. //Stores required data.
private Dataset currentData = null; private Dataset currentData = null;
@ -73,21 +72,24 @@ public class AirportSummaryController extends Controller{
* Loads initial state of the scene. * Loads initial state of the scene.
*/ */
public void load() { public void load() {
if (!checkDataset()){
return;
}
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name")); columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName")); columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("CountryName")); columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("CountryName"));
columnIATA.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA")); columnTotalRoutes.setCellValueFactory(new PropertyValueFactory<Airport, String>("TotalRoutes"));
columnAltitude.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getAirports())); tableView.setItems(FXCollections.observableArrayList(currentData.getAirports()));
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airport>() { tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airport>() {
public void changed(ObservableValue<? extends Airport> observable, Airport oldValue, Airport newValue) { public void changed(ObservableValue<? extends Airport> observable, Airport oldValue, Airport newValue) {
System.out.println("loading"); Airport selectedAirport= tableView.getSelectionModel().getSelectedItems().get(0);
Airport selectedAirport= currentData.getAirports().get(tableView.getSelectionModel().getSelectedIndices().get(0));
map.displayAirport(new RoutePath( new Position(selectedAirport.getLatitude(), selectedAirport.getLongitude()))); map.displayAirport(new RoutePath( new Position(selectedAirport.getLatitude(), selectedAirport.getLongitude())));
} }
}); });
map = new Map(mapView, new RoutePath(), tableView);
} }
} }

@ -4,6 +4,7 @@ import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -58,6 +59,23 @@ public abstract class Controller implements Initializable{
} }
} }
public boolean checkDataset(){
//if the dataset is null then we want to change to the initial and give a warning.
//Also then let them selecthe data set
if (getParent().getCurrentDataset() == null) {
replaceSceneContent(SceneCode.INITIAL);
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Missing Dataset");
alert.setHeaderText("No Dataset is currently selected.");
alert.setContentText("Please Create a Dataset to store your Information in.");
alert.showAndWait();
createPopUpStage(SceneCode.DATASET_CONTROLLER, 600, 400);
return false;
}else{
return true;
}
}
/** /**
* Creates a popup window with a specific fxml scene * Creates a popup window with a specific fxml scene
* @param scene * @param scene

@ -0,0 +1,79 @@
package seng202.group9.GUI;
import javafx.beans.InvalidationListener;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset;
import java.util.*;
import static javafx.collections.FXCollections.observableArrayList;
/**
* Created by fwy13 on 30/09/16.
*/
public class DatasetController extends Controller{
@FXML
ListView datasetView;
@FXML
TextField datasetName;
@FXML
Button openDataset;
Dataset curDataset = null;
ObservableList<Dataset> datasetList = observableArrayList();
public void load() {
curDataset = getParent().getCurrentDataset();
loadTable();
}
public void loadTable(){
ArrayList<Dataset> datasets = getParent().getDatasets();
datasetList = observableArrayList(datasets);
datasetView.setItems(datasetList);
}
public void deleteDataset(){
Dataset datasetToDelete = (Dataset) datasetView.getSelectionModel().getSelectedItem();
getParent().deleteDataset(datasetToDelete);
loadTable();
}
public void addDataset(){
String name = datasetName.getText();
if (!name.equals("") && name != null) {
try {
getParent().createDataset(name);
} catch (DataException e) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Dataset Creation Error");
alert.setHeaderText("Error creating Dataset.");
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}else{
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Dataset Creation Error");
alert.setHeaderText("Error creating Dataset.");
alert.setContentText("Dataset Name Cannot be Empty");
alert.showAndWait();
}
loadTable();
}
public void openDataset(){
Dataset datasetToOpen = (Dataset) datasetView.getSelectionModel().getSelectedItem();
getParent().setCurrentDataset(datasetToOpen);
loadTable();
((Stage) openDataset.getScene().getWindow()).close();
}
}

@ -67,6 +67,9 @@ public class DistCalcController extends Controller {
* Sets the initial state of the scene. * Sets the initial state of the scene.
*/ */
public void load(){ public void load(){
if (!checkDataset()){
return;
}
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
answerBox.textProperty().bind(bound); answerBox.textProperty().bind(bound);
fill_boxes(); fill_boxes();

@ -0,0 +1,69 @@
package seng202.group9.GUI;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.web.WebView;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.Airport;
import seng202.group9.Core.Equipment;
import seng202.group9.Core.Route;
import seng202.group9.Core.RoutePath;
import seng202.group9.Map.Map;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
/**
* Created by fwy13 on 2/10/16.
*/
public class EquipByRouteController extends Controller{
@FXML
WebView mapView;
@FXML
TableView<Equipment> equipTable;
@FXML
TableColumn<Airport, String> equipName;
@FXML
TableColumn<Airport, Integer> routes;
ObservableList<Equipment> equipToDisplay;
Dataset currentDataset;
Map map;
@Override
public void load() {
if (!checkDataset()){
return;
}
currentDataset = getParent().getCurrentDataset();
//Sets up map.
map = new Map(mapView, new RoutePath(), equipTable);
equipName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
routes.setCellValueFactory(new PropertyValueFactory<Airport, Integer>("RouteNum"));
equipToDisplay = FXCollections.observableArrayList();
ArrayList<String> keys = new ArrayList<>(currentDataset.getEquipmentDictionary().keySet());
for (int i = 0; i < currentDataset.getEquipmentDictionary().size(); i ++){
if (currentDataset.getEquipmentDictionary().get(keys.get(i)).getRouteNum() > 0){
equipToDisplay.add(currentDataset.getEquipmentDictionary().get(keys.get(i)));
}
}
equipTable.setItems(equipToDisplay);
equipTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Equipment>() {
public void changed(ObservableValue<? extends Equipment> observable, Equipment oldValue, Equipment newValue) {
Equipment selectedEquip= (Equipment) equipTable.getSelectionModel().getSelectedItems().get(0);
ArrayList<RoutePath> routePaths = new ArrayList<RoutePath>();
HashMap<Integer, Route> routes = selectedEquip.getRoutesUsed();
for (int i = 0; i < routes.size(); i ++){
routePaths.add(routes.get(i).getRoutePath());
}
map.displayRoutes(routePaths);
}
});
}
}

@ -0,0 +1,66 @@
package seng202.group9.GUI;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.Session;
/**
* Created by Sunguin on 2016/10/01.
*/
public class FlightAddController extends Controller {
//Set up text fields for adding data
@FXML
private TextField fNameAdd;
@FXML
private TextField fTypeAdd;
@FXML
private TextField fAltitudeAdd;
@FXML
private TextField fLatitudeAdd;
@FXML
private TextField fLongitudeAdd;
@FXML
private Button flightAddButton;
//Set an empty Dataset to be assigned later
private Dataset theDataSet = null;
private Session currentSession = null;
public void load() {
if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
}
public void addFlight() {
try {
theDataSet.addFlightPointToPath(currentSession.getCurrentFlightPathID(),
fNameAdd.getText(),
fTypeAdd.getText(),
fAltitudeAdd.getText(),
fLatitudeAdd.getText(),
fLongitudeAdd.getText());
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Flight Point Add Successful");
alert.setHeaderText("New Flight Point added!");
alert.setContentText("Your new flight point has been successfully added into the database.");
alert.showAndWait();
Stage stage = (Stage) flightAddButton.getScene().getWindow();
stage.close();
} catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Flight Point Data Error");
alert.setHeaderText("Error adding a custom flight point entry.");
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}
}

@ -0,0 +1,101 @@
package seng202.group9.GUI;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.Session;
import seng202.group9.Core.FlightPoint;
/**
* Controller for the Flights Edit Point Pop up Scene.
* Created by Liam Beckett on 23/09/2016.
*/
public class FlightEditorController extends Controller{
//Setting up text fields for adding data
@FXML
TextField fNameEdit;
@FXML
TextField fTypeEdit;
@FXML
TextField fAltitudeEdit;
@FXML
TextField fLatitudeEdit;
@FXML
TextField fLongitudeEdit;
@FXML
private Button flightEditButton;
//Set an empty Dataset to be assigned later
private Dataset theDataSet = null;
/**
* Edits a single flight entry in the database.
* Takes in values from the field the user right clicked.
* @see Dataset
*/
public void editFlight() {
//Data is pre-loaded into the text fields and any accepted changes will be implemented.
//Otherwise an error message will pop up with what is wrong with edit
try {
Session session = getParent().getSession();
int flightPointID = session.getCurrentFlightPointID();
theDataSet.editFlight(
theDataSet.getFlightPointDictionary().get(flightPointID),
fNameEdit.getText(),
fTypeEdit.getText(),
fAltitudeEdit.getText(),
fLatitudeEdit.getText(),
fLongitudeEdit.getText()
);
session.setCurrentFlightPointID(flightPointID);
fNameEdit.clear();
fTypeEdit.clear();
fAltitudeEdit.clear();
fLatitudeEdit.clear();
fLongitudeEdit.clear();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Flight Path Edit Successful");
alert.setHeaderText("Flight Point Edited!");
alert.setContentText("Your flight point has been updated in the database.");
alert.showAndWait();
Stage stage = (Stage) flightEditButton.getScene().getWindow();
stage.close();
} catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Flight Data Error");
alert.setHeaderText("Error editing a flight point.");
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}
/**
* Loader which is used to load the selected information into the text fields for editing.
*/
public void load() {
if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset();
Session session = getParent().getSession();
int flightPointID = session.getCurrentFlightPointID();
FlightPoint flightPoint = theDataSet.getFlightPointDictionary().get(flightPointID);
fNameEdit.setText(flightPoint.getName());
fTypeEdit.setText(flightPoint.getType());
fAltitudeEdit.setText(Double.toString(flightPoint.getAltitude()));
fLatitudeEdit.setText(Double.toString(flightPoint.getLatitude()));
fLongitudeEdit.setText(Double.toString(flightPoint.getLongitude()));
}
}

@ -1,5 +1,7 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.EventHandler; import javafx.event.EventHandler;
@ -9,18 +11,20 @@ import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import seng202.group9.Controller.DataException; import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode;
import seng202.group9.Controller.Session;
import seng202.group9.Core.FlightPath; import seng202.group9.Core.FlightPath;
import seng202.group9.Core.FlightPoint; import seng202.group9.Core.FlightPoint;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Optional;
/** /**
* 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 extends Controller { public class FlightRDController extends Controller {
private Dataset theDataSet = null; private Dataset theDataSet = null;
@ -36,8 +40,6 @@ public class FlightRDController extends Controller {
@FXML @FXML
private TableColumn<FlightPoint, String> flightTypeCol; private TableColumn<FlightPoint, String> flightTypeCol;
@FXML @FXML
private TableColumn<FlightPoint, String> flightViaCol;
@FXML
private TableColumn<FlightPoint, String> flightAltitudeCol; private TableColumn<FlightPoint, String> flightAltitudeCol;
@FXML @FXML
private TableColumn<FlightPoint, String> flightLatCol; private TableColumn<FlightPoint, String> flightLatCol;
@ -54,24 +56,24 @@ public class FlightRDController extends Controller {
ListView<String> flightPathListView; ListView<String> flightPathListView;
private ObservableList<String> flightList = FXCollections.observableArrayList(); private ObservableList<String> flightList = FXCollections.observableArrayList();
@FXML // @FXML
private TextField flightNameBox; // private TextField flightNameBox;
@FXML // @FXML
private TextField flightTypeBox; // private TextField flightTypeBox;
@FXML // @FXML
private TextField flightViaBox; // private TextField flightViaBox;
@FXML // @FXML
private TextField flightAltitudeBox; // private TextField flightAltitudeBox;
@FXML // @FXML
private TextField flightLatitudeBox; // private TextField flightLatitudeBox;
@FXML // @FXML
private TextField flightLongitudeBox; // private TextField flightLongitudeBox;
@FXML // @FXML
private TextField flightHeadingBox; // private TextField flightHeadingBox;
@FXML // @FXML
private TextField flightLegDistBox; // private TextField flightLegDistBox;
@FXML // @FXML
private TextField flightTotDistBox; // private TextField flightTotDistBox;
/** /**
* Loads the Flight paths into the List View and waits for a mouse clicked event for which it will update the table * Loads the Flight paths into the List View and waits for a mouse clicked event for which it will update the table
@ -81,6 +83,7 @@ public class FlightRDController extends Controller {
try { try {
ArrayList<FlightPath> flightPaths; ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths(); flightPaths = theDataSet.getFlightPaths();
for(int i = 0; i<flightPaths.size(); i++ ) { for(int i = 0; i<flightPaths.size(); i++ ) {
int pathID = flightPaths.get(i).getID(); int pathID = flightPaths.get(i).getID();
String pathSource = flightPaths.get(i).departsFrom(); String pathSource = flightPaths.get(i).departsFrom();
@ -88,23 +91,6 @@ public class FlightRDController extends Controller {
String flightPathDisplayName = Integer.toString(pathID) + "_" + pathSource + "_" + pathDestin; String flightPathDisplayName = Integer.toString(pathID) + "_" + pathSource + "_" + pathDestin;
flightList.add(flightPathDisplayName); flightList.add(flightPathDisplayName);
} }
flightPathListView.setOnMouseClicked(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) {
String flightPathDisplayNameClicked = flightPathListView.getSelectionModel().getSelectedItem();
String[] segments = flightPathDisplayNameClicked.split("_");
String pathIdClicked = segments[0];
currentPathIndex = theDataSet.getFlightPaths().indexOf(theDataSet.getFlightPathDictionary()
.get(Integer.parseInt(pathIdClicked)));
currentPathId = Integer.parseInt(pathIdClicked);
ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths();
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
}
});
flightPathListView.setItems(flightList); flightPathListView.setItems(flightList);
} catch (Exception e) { } catch (Exception e) {
@ -116,7 +102,12 @@ public class FlightRDController extends Controller {
* Used to load the table for the Flight points initially from the MenuController * Used to load the table for the Flight points initially from the MenuController
*/ */
public void load() { public void load() {
if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
if (theDataSet != null) {
try {
try { try {
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
} catch (DataException e) { } catch (DataException e) {
@ -125,7 +116,6 @@ public class FlightRDController extends Controller {
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"));
flightViaCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Via"));
flightAltitudeCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Altitude")); flightAltitudeCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Altitude"));
flightLatCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Latitude")); flightLatCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Latitude"));
flightLongCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Longitude")); flightLongCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Longitude"));
@ -137,46 +127,40 @@ public class FlightRDController extends Controller {
flightPaths = theDataSet.getFlightPaths(); flightPaths = theDataSet.getFlightPaths();
ArrayList<FlightPoint> flightPoints = flightPaths.get(0).getFlight(); ArrayList<FlightPoint> flightPoints = flightPaths.get(0).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints)); flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
}catch(IndexOutOfBoundsException e){
System.out.println("There is no Paths to show");
} }
flightPathListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>(){
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
String flightPathDisplayNameClicked = flightPathListView.getSelectionModel().getSelectedItem();
if (flightPathDisplayNameClicked!=null) {
String[] segments = flightPathDisplayNameClicked.split("_");
String pathIdClicked = segments[0];
currentPathIndex = theDataSet.getFlightPaths().indexOf(theDataSet.getFlightPathDictionary()
.get(Integer.parseInt(pathIdClicked)));
currentPathId = Integer.parseInt(pathIdClicked);
/**
* Will take the inputs from the text fields and adds the point to the current flight path.
*/
public void addFlightPoint() {
ArrayList<FlightPath> flightPaths; ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths(); flightPaths = theDataSet.getFlightPaths();
try {
theDataSet.addFlightPointToPath(currentPathId,
flightNameBox.getText(),
flightTypeBox.getText(),
flightViaBox.getText(),
flightAltitudeBox.getText(),
flightLatitudeBox.getText(),
flightLongitudeBox.getText(),
flightHeadingBox.getText(),
flightLegDistBox.getText(),
flightTotDistBox.getText());
flightNameBox.clear();
flightTypeBox.clear();
flightViaBox.clear();
flightAltitudeBox.clear();
flightLatitudeBox.clear();
flightLongitudeBox.clear();
flightHeadingBox.clear();
flightLegDistBox.clear();
flightTotDistBox.clear();
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight(); ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints)); flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
} catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Flight Point Data Error");
alert.setHeaderText("Error adding a custom flight point entry.");
alert.setContentText(e.getMessage());
} }
} }
});
}
}
/**
* Will take the inputs from the text fields and adds the point to the current flight path.
*/
public void openAdd() {
Session session = getParent().getSession();
session.setCurrentFlightPathtID(currentPathId);
createPopUpStage(SceneCode.FLIGHT_ADD, 600, 280);
//flightTableView.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
updateTable(currentPathIndex);
}
/** /**
* Creates a pop up dialog which prompts the user for two ICAO airport codes which will use when creating a new path. * Creates a pop up dialog which prompts the user for two ICAO airport codes which will use when creating a new path.
@ -198,12 +182,19 @@ public class FlightRDController extends Controller {
*/ */
public void deletePoint() { public void deletePoint() {
FlightPoint toDelete = flightTableView.getSelectionModel().getSelectedItem(); FlightPoint toDelete = flightTableView.getSelectionModel().getSelectedItem();
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Flight Point Delete Confirmation");
alert.setHeaderText("You are about to delete some data.");
alert.setContentText("Are you sure you want to delete the selected flight point?");
//alert.showAndWait();
Optional<ButtonType> result = alert.showAndWait();
if (result.isPresent() && result.get() == ButtonType.OK) {
int pathID; int pathID;
try { try {
pathID = toDelete.getIndex(); pathID = toDelete.getIndex();
} catch (DataException e) { } catch (DataException e) {
e.printStackTrace(); e.printStackTrace();
System.out.println("Point is Undeletable as the Index ID is not set."); System.err.println("Point is Undeletable as the Index ID is not set.");
return; return;
} }
LinkedHashMap<Integer, FlightPath> flightPathDict = theDataSet.getFlightPathDictionary(); LinkedHashMap<Integer, FlightPath> flightPathDict = theDataSet.getFlightPathDictionary();
@ -212,12 +203,30 @@ public class FlightRDController extends Controller {
currentPathIndex = theDataSet.getFlightPaths().indexOf(theDataSet.getFlightPathDictionary().get(pathID)); currentPathIndex = theDataSet.getFlightPaths().indexOf(theDataSet.getFlightPathDictionary().get(pathID));
ArrayList<FlightPath> flightPaths; updateTable(currentPathIndex);
flightPaths = theDataSet.getFlightPaths(); updatePaths();
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight(); }
flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
} }
/**
* Loads the pop up for the edit data scene and updates the table when the window is closed.
*/
public void editPoint() {
FlightPoint toEdit = flightTableView.getSelectionModel().getSelectedItem();
try {
Session session = getParent().getSession();
session.setCurrentFlightPointID(toEdit.getID());
session.setCurrentFlightPathtID(currentPathId);
} catch (DataException e) {
e.printStackTrace();
System.err.println("Point is Uneditable as the Index ID is not set.");
return;
}
createPopUpStage(SceneCode.FLIGHT_EDITOR, 600, 289);
updateTable(currentPathIndex);
updatePaths();
}
/** /**
* Removes the selected path from the list view of paths and from the database. * Removes the selected path from the list view of paths and from the database.
*/ */
@ -232,6 +241,80 @@ public class FlightRDController extends Controller {
theDataSet.deleteFlightPath(toDeleteIndex); theDataSet.deleteFlightPath(toDeleteIndex);
flightPathListView.getItems().clear(); flightPathListView.getItems().clear();
flightPathListView(); flightPathListView();
updatePaths();
updateTable(0);
}
/**
* Function for the 'Move Up' right click option on the points in the flight table.
*/
public void movePointUp(){
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
try{
if (toMoveIndex != 0) {
theDataSet.moveFlightPoint(toMove, toMoveIndex - 1);
}
} catch (DataException e) {
e.printStackTrace();
}
updateTable(currentPathIndex);
updatePaths();
}
/**
* Function for the 'Move Down' right click option on the points in the flight table.
*/
public void movePointDown(){
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
try{
if (toMoveIndex != flightTableView.getItems().size()-1) {
theDataSet.moveFlightPoint(toMove, toMoveIndex + 1);
}
} catch (DataException e) {
e.printStackTrace();
}
updateTable(currentPathIndex);
updatePaths();
}
/**
* Updates the table so that when the database is changed (deleted or edited) it still shows the correct data values.
* @param currentPathIndex The index of the current path in the Path array list.
*/
private void updateTable(int currentPathIndex) {
ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths();
if (flightPaths.size() != 0) {
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
flightTableView.refresh();
}else{
flightTableView.getItems().clear();
flightTableView.refresh();
}
}
/**
* Updates the flight path list view so that it displays the correct names for the paths
*/
private void updatePaths(){
try {
flightPathListView.getItems().clear();
ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths();
for(int i = 0; i<flightPaths.size(); i++ ) {
int pathID = flightPaths.get(i).getID();
String pathSource = flightPaths.get(i).departsFrom();
String pathDestin = flightPaths.get(i).arrivesAt();
String flightPathDisplayName = Integer.toString(pathID) + "_" + pathSource + "_" + pathDestin;
flightList.add(flightPathDisplayName);
}
flightPathListView.setItems(flightList);
} catch (Exception e) {
e.printStackTrace();
}
} }
/** /**
@ -243,7 +326,13 @@ public class FlightRDController extends Controller {
@Override @Override
public void loadOnce(){ public void loadOnce(){
if (theDataSet != null) {
flightPathListView(); flightPathListView();
} }
}
public void flightSummaryButton() {
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
}
} }

@ -13,8 +13,10 @@ import javafx.scene.control.ListView;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.web.WebView; import javafx.scene.web.WebView;
import seng202.group9.Controller.App; import seng202.group9.Controller.App;
import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Core.Airport;
import seng202.group9.Core.FlightPath; import seng202.group9.Core.FlightPath;
import seng202.group9.Core.RoutePath; import seng202.group9.Core.RoutePath;
import seng202.group9.Map.Map; import seng202.group9.Map.Map;
@ -22,6 +24,7 @@ import seng202.group9.Core.FlightPoint;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.ResourceBundle; import java.util.ResourceBundle;
/** /**
@ -31,18 +34,18 @@ import java.util.ResourceBundle;
public class FlightSummaryController extends Controller { public class FlightSummaryController 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;
@FXML
private Button flightRawData;
private Map map; private Map map;
@FXML @FXML
private WebView mapView; private WebView mapView;
@FXML @FXML
ListView<String> flightPathListView; ListView<String> flightPathListView;
final ObservableList<String> flightList = FXCollections.observableArrayList(); final ObservableList<String> flightList = FXCollections.observableArrayList();
@FXML
ListView<String> flightSummaryListView;
final ObservableList<String> infoList = FXCollections.observableArrayList();
/** /**
* Changes to the Flight Raw Data Scene when the Raw Data Button is clicked. * Changes to the Flight Raw Data Scene when the Raw Data Button is clicked.
@ -54,7 +57,9 @@ public class FlightSummaryController extends Controller {
/** /**
* Changes to the Airport Summary Scene when the Airport is clicked. * Changes to the Airport Summary Scene when the Airport is clicked.
*/ */
public void airportSummaryButton() { replaceSceneContent(SceneCode.AIRPORT_SUMMARY); } public void airportSummaryButton() {
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
}
/** /**
* Changes to the Route Summary Scene when the Route Button is clicked. * Changes to the Route Summary Scene when the Route Button is clicked.
@ -70,6 +75,68 @@ public class FlightSummaryController extends Controller {
replaceSceneContent(SceneCode.AIRLINE_SUMMARY); replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
} }
/**
* Loads the current flight paths summary information into the ListView panel. The summary data includes the distance
* and the name of the source and destination airports pulled from the Airport array list.
*/
public void flightSummaryListView() {
try {
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
FlightPath currentPath = theDataSet.getFlightPathDictionary().get(currentPathId);
ArrayList<FlightPoint> flightPoints = currentPath.getFlightPoints();
FlightPoint firstPoint = flightPoints.get(0);
String firstPointICAO = firstPoint.getName();
FlightPoint lastPoint = flightPoints.get(flightPoints.size()-1);
String lastPointICAO = lastPoint.getName();
ArrayList<Airport> airportList = theDataSet.getAirports();
Airport sourceAirport = null;
Airport destinationAirport = null;
for (int i=0; i < airportList.size(); i++){
Airport current = airportList.get(i);
if(current.getICAO().equals(firstPointICAO)){
sourceAirport = current;
}
if(current.getICAO().equals(lastPointICAO)){
destinationAirport = current;
}
}
String source = "Not Available";
String destination = "Not Available";
double distance = 0.0;
if(sourceAirport != null){
source = sourceAirport.getName();
}
if(destinationAirport != null){
destination = destinationAirport.getName();
}
if(destination != "Not Available" && source != "Not Available"){
distance = sourceAirport.calculateDistance(destinationAirport);
}
infoList.add(" Flight Path Summary Information");
infoList.add("");
infoList.add("Total Distance of Flight:");
infoList.add(Double.toString(distance));
infoList.add("Source Airport:");
infoList.add(source);
infoList.add("Destination Airport:");
infoList.add(destination);
if(sourceAirport == null || destinationAirport == null){
infoList.add("");
infoList.add("Missing Data is due to first or last points");
infoList.add("ICAO codes not being present in the Airline");
infoList.add("Database!");
}
flightSummaryListView.setItems(infoList);
} catch(Exception e) {
e.printStackTrace();
}
}
/** /**
* Loads the Flight paths into the List View and waits for a mouse clicked event for which it will update the table * Loads the Flight paths into the List View and waits for a mouse clicked event for which it will update the table
* to display the selected Flight paths points. Called from the MenuController. * to display the selected Flight paths points. Called from the MenuController.
@ -85,20 +152,38 @@ public class FlightSummaryController extends Controller {
String flightPathDisplayName = Integer.toString(pathID) + "_" + pathSource + "_" + pathDestin; String flightPathDisplayName = Integer.toString(pathID) + "_" + pathSource + "_" + pathDestin;
flightList.add(flightPathDisplayName); flightList.add(flightPathDisplayName);
} }
flightPathListView.setOnMouseClicked(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) {
String flightPathDisplayNameClicked = flightPathListView.getSelectionModel().getSelectedItem();
if (flightPathDisplayNameClicked!=null) {
String[] segments = flightPathDisplayNameClicked.split("_");
String pathIdClicked = segments[0];
currentPathIndex = theDataSet.getFlightPaths().indexOf(theDataSet.getFlightPathDictionary()
.get(Integer.parseInt(pathIdClicked)));
currentPathId = Integer.parseInt(pathIdClicked);
}
}
});
flightPathListView.setItems(flightList); flightPathListView.setItems(flightList);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* Used to load the page from the MenuController. * Used to load the page from the MenuController.
*/ */
public void load() { public void load() {
try { if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
ArrayList<FlightPath> flightPaths = new ArrayList(); if (theDataSet != null) {
try {
ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths(); flightPaths = theDataSet.getFlightPaths();
for(int i = 0; i<flightPaths.size(); i++ ){ for (int i = 0; i < flightPaths.size(); i++) {
int pathID = flightPaths.get(i).getID(); int pathID = flightPaths.get(i).getID();
String pathSource = flightPaths.get(i).departsFrom(); String pathSource = flightPaths.get(i).departsFrom();
String pathDestin = flightPaths.get(i).arrivesAt(); String pathDestin = flightPaths.get(i).arrivesAt();
@ -106,13 +191,13 @@ public class FlightSummaryController extends Controller {
flightList.add(flightPathDisplayName); flightList.add(flightPathDisplayName);
} }
flightPathListView.setItems(flightList); flightPathListView.setItems(flightList);
flightSummaryListView();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if (theDataSet.getFlightPaths().size() > 0){ if (theDataSet.getFlightPaths().size() > 0) {
map = new Map(mapView, theDataSet.getFlightPaths().get(0).getRoutePath()); map = new Map(mapView, theDataSet.getFlightPaths().get(0).getRoutePath());
}else{ } else {
map = new Map(mapView, new RoutePath()); map = new Map(mapView, new RoutePath());
} }
flightPathListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { flightPathListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@ -124,6 +209,8 @@ public class FlightSummaryController extends Controller {
} }
}); });
} }
}
/** /**
* Removes the selected path from the list view of paths and from the database. * Removes the selected path from the list view of paths and from the database.
*/ */

@ -0,0 +1,45 @@
package seng202.group9.GUI;
import javafx.scene.control.Alert;
import seng202.group9.Controller.SceneCode;
/**
* Created by spe76 on 26/09/16.
*/
public class GettingStartedController extends Controller {
public void load() {
}
public void importAirlines() {
getParent().getMenuController().changeDatasetPrompt();
Importer importer = new Importer(SceneCode.AIRLINE_RAW_DATA, getParent(), getParent().getPrimaryStage());
}
public void importAirports() {
getParent().getMenuController().changeDatasetPrompt();
Importer importer = new Importer(SceneCode.AIRPORT_RAW_DATA, getParent(), getParent().getPrimaryStage());
}
public void importRoutes() {
getParent().getMenuController().changeDatasetPrompt();
Importer importer = new Importer(SceneCode.ROUTE_RAW_DATA, getParent(), getParent().getPrimaryStage());
}
public void importFlightData() {
getParent().getMenuController().changeDatasetPrompt();
Importer importer = new Importer(SceneCode.FLIGHT_RAW_DATA, getParent(), getParent().getPrimaryStage());
}
public void manageDatasets() {
getParent().getMenuController().openDataset();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Dataset Selected");
alert.setHeaderText("You have decided to change the Dataset.");
alert.setContentText("You will now be taken to the airline summary page.");
alert.showAndWait();
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
}
}

@ -0,0 +1,168 @@
package seng202.group9.GUI;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
/**
* The GUI controller class for help.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin.
*/
public class HelpController extends Controller {
@FXML
private TreeView treeView;
@FXML
private TextFlow textArea;
Text text = new Text();
//The TreeItems for the TreeView.
TreeItem main_root = new TreeItem("Main Root");
TreeItem importing = new TreeItem("Importing Data");
TreeItem importing_start = new TreeItem("Importing on Startup");
TreeItem importing_after = new TreeItem("Importing after Startup");
TreeItem viewing = new TreeItem("Viewing Data");
TreeItem summary_viewing = new TreeItem("Viewing Summary Data");
TreeItem raw_viewing = new TreeItem("Viewing Raw Data");
TreeItem manipulating = new TreeItem("Manipulating Data");
TreeItem adding = new TreeItem("Adding Data");
TreeItem filter = new TreeItem("Filtering Data");
TreeItem edit = new TreeItem("Editing Data");
TreeItem delete = new TreeItem("Deleting Data");
TreeItem analysing = new TreeItem("Analysing Data");
TreeItem graphing = new TreeItem("Graphs");
TreeItem distance = new TreeItem("Distance Calculator");
/**
* Loads the TreeView and sets up the TreeView.
*/
public void load() {
treeView.setRoot(main_root);
treeView.setShowRoot(false);
main_root.getChildren().add(importing);
importing.getChildren().add(importing_start);
importing.getChildren().add(importing_after);
main_root.getChildren().add(viewing);
viewing.getChildren().add(summary_viewing);
viewing.getChildren().add(raw_viewing);
main_root.getChildren().add(manipulating);
manipulating.getChildren().add(adding);
manipulating.getChildren().add(filter);
manipulating.getChildren().add(edit);
manipulating.getChildren().add(delete);
main_root.getChildren().add(analysing);
analysing.getChildren().add(graphing);
analysing.getChildren().add(distance);
text = new Text("Please select an option on the left side menu to display its contents.");
textArea.getChildren().add(text);
treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
public void changed(ObservableValue observable, Object oldValue,
Object newValue) {
TreeItem<String> selectedItem = (TreeItem<String>) newValue;
String menuValue = selectedItem.getValue();
if ( menuValue != null ){
textArea.getChildren().clear();
if (menuValue.equals("Importing on Startup")) {
text = new Text("Importing on Startup\n" + "You can import data from the first start up of the application." +
"\nTo import data, select the type of data you wish to import along the bottom of the screen." +
" Then select the file (.csv and .txt file) from the " +
"file selector. The data will be loaded into the program and taken to the " +
"corresponding summary page.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Importing after Startup")) {
text = new Text("Importing after Startup\n" +
"You can import data from the 'File' menu on the top of the screen.\n" +
"To import data, select the type of data you wish to import. " +
"Then select the file (.csv and .txt file) from the file selector. " +
"The data will be loaded into the program and taken to the corresponding summary page.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Viewing Summary Data")) {
text = new Text("Viewing Summary Data\n" +
"The summary data view consists of a reduced version of the data and a map of the currently selected value. " +
"The flight summary data also has a flight path selector to select which flight points you want to view.\n" +
"The summary views are accessible from the menu on the top of the screen under the " +
"'View' tab. You first choose which set of data you want to view and then you can select 'Summary'." +
"\nEach summary page also has buttons that lead to their corresponding raw data view and the other summary views.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Viewing Raw Data")) {
text = new Text("Viewing Raw Data\n" +
"The raw data view allows the user to view the full data table." +
"The user can also add, filter, edit and delete data values as well.\n" +
"These are accessible from the menu on the top of the screen under the " +
"'View' tab. You first choose which set of data you want to view and then you can select 'Raw Data'.\n" +
"The summary view does not have every column but provides a map of where the " +
"The raw data page also has buttons that lead to the analysis of that type of data and to go back to the" +
" corresponding summary page.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Adding Data")) {
text = new Text("Adding Data\n" +
"To add a new entry, first go to the raw data view for that data type. Then click " +
"on the add button located on the bottom of the page. Then fill out the entries in the " +
"pop-up box and click add at the bottom of the screen. " +
"When the program detects an invalid field, a message will pop up and state where the error is.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Filtering Data")) {
text = new Text("Filtering Data\n" +
"To filter all current entries, click on the filter option and a pop " +
"up will appear. Then type in the fields the values you wish to filter by and press the filter button. " +
"The table should update with the fields specified.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Editing Data")) {
text = new Text("Editing Data\n" +
"The edit function can be accessed by right clicking on the entry you wish to edit and" +
" clicking the edit option. This will lead to a pop up where you can edit the current entry." +
" When the edit has been completed, you can press the apply button on the bottom of the pop up. " +
"When the program detects an invalid field, a message will pop up and state where the error is.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Deleting Data")) {
text = new Text("Deleting Data\n" +
"The delete function is accessed by right clicking an entry and pressing the delete option. " +
"This will come up with a pop up to confirm your delete. When you press OK, the entry will be deleted " +
"from the program. The program also allows multiple deletes.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Graphs")) {
text = new Text("Graphs\n" + "The program has the ability to produce graphs according to the type of data.\n" +
"This is done by going to the raw data page for the data you wish to graph. Then press the analyse data button" +
" on the bottom of the screen. This will produce a graph specific for that type of data.");
textArea.getChildren().add(text);
} else if (menuValue.equals("Distance Calculator")) {
text = new Text("Distance Calculator\n" + "You can calculate the distance between two airports.\n" +
"First, go to the 'Analysis' tab on the top of the menu bar. You will be taken to a page that " +
"allows them to select two airports, one from each column and press 'Calculate' to get the distance between" +
" the two airports.");
textArea.getChildren().add(text);
} else {
text = new Text("Please select an option on the left side menu to display its contents.");
textArea.getChildren().add(text);
}
}
}
});
}
}

@ -1,6 +1,7 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import java.net.URL; import java.net.URL;
import java.util.Optional;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -8,6 +9,8 @@ import javax.swing.JOptionPane;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
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.Controller.SceneCode;
@ -18,18 +21,22 @@ import seng202.group9.Controller.SceneCode;
public class MenuController extends Controller{ public class MenuController extends Controller{
public void importAirports(){ public void importAirports(){
changeDatasetPrompt();
Importer importer = new Importer(SceneCode.AIRPORT_RAW_DATA, getParent(), getParent().getPrimaryStage()); Importer importer = new Importer(SceneCode.AIRPORT_RAW_DATA, getParent(), getParent().getPrimaryStage());
} }
public void importAirlines(){ public void importAirlines(){
changeDatasetPrompt();
Importer importer = new Importer(SceneCode.AIRLINE_RAW_DATA, getParent(), getParent().getPrimaryStage()); Importer importer = new Importer(SceneCode.AIRLINE_RAW_DATA, getParent(), getParent().getPrimaryStage());
} }
public void importRoutes(){ public void importRoutes(){
changeDatasetPrompt();
Importer importer = new Importer(SceneCode.ROUTE_RAW_DATA, getParent(), getParent().getPrimaryStage()); Importer importer = new Importer(SceneCode.ROUTE_RAW_DATA, getParent(), getParent().getPrimaryStage());
} }
public void importFlightData(){ public void importFlightData(){
changeDatasetPrompt();
Importer importer = new Importer(SceneCode.FLIGHT_RAW_DATA, getParent(), getParent().getPrimaryStage()); Importer importer = new Importer(SceneCode.FLIGHT_RAW_DATA, getParent(), getParent().getPrimaryStage());
} }
@ -62,13 +69,18 @@ public class MenuController extends Controller{
public void viewAnalyserMain() { replaceSceneContent(SceneCode.ANALYSER_TAB);} public void viewAnalyserMain() { replaceSceneContent(SceneCode.ANALYSER_TAB);}
/**
* view Routes by the Destination / Arrival Airport
*/
public void viewRouteByAirport(){
replaceSceneContent(SceneCode.ROUTE_BY_AIRPORT);
}
/** /**
* Load Flight Summary Function. * Load Flight Summary Function.
*/ */
public void viewFlightSummary() { public void viewFlightSummary() {
replaceSceneContent(SceneCode.FLIGHT_SUMMARY); replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
} }
/** /**
* Load Flight Raw Data Function. * Load Flight Raw Data Function.
*/ */
@ -76,6 +88,18 @@ public class MenuController extends Controller{
replaceSceneContent(SceneCode.FLIGHT_RAW_DATA); replaceSceneContent(SceneCode.FLIGHT_RAW_DATA);
} }
public void viewRouteByEquipment(){
replaceSceneContent(SceneCode.ROUTE_BY_EQUIP);
}
public void goToGettingStarted() {
replaceSceneContent(SceneCode.INITIAL);
}
public void goToHelp() {
createPopUpStage(SceneCode.HELP, 600, 400);
}
public void load() { public void load() {
//nothing to load //nothing to load
} }
@ -87,4 +111,22 @@ public class MenuController extends Controller{
} }
public void changeDatasetPrompt(){
ButtonType yes = new ButtonType("Yes", ButtonBar.ButtonData.YES);
ButtonType no = new ButtonType("No", ButtonBar.ButtonData.NO);
Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "", yes, no);
alert.setTitle("Dataset Change?");
alert.setHeaderText("You are about to import Data");
alert.setContentText("Would you like to change Datasets?");
//alert.showAndWait();
Optional<ButtonType> result = alert.showAndWait();
if (result.isPresent() && result.get() == yes) {
createPopUpStage(SceneCode.DATASET_CONTROLLER, 600, 400);
}
}
public void openDataset(){
createPopUpStage(SceneCode.DATASET_CONTROLLER, 600, 400);
}
} }

@ -74,6 +74,9 @@ public class RouteAddController extends Controller {
} }
public void load() { public void load() {
if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
} }
} }

@ -0,0 +1,76 @@
package seng202.group9.GUI;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.EntryParser;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Route;
/**
* Created by Sunguin on 2016/09/24.
*/
public class RouteEditController extends Controller {
@FXML
private TextField rAirlineEdit;
@FXML
private TextField rSourceEdit;
@FXML
private TextField rDestEdit;
@FXML
private TextField rCodeshareEdit;
@FXML
private TextField rStopsEdit;
@FXML
private TextField rEquipmentEdit;
@FXML
private Button editButton;
private Dataset theDataSet = null;
private Session currentSession = null;
private Route toEdit = null;
public void editRoute() {
try {
EntryParser parser = new EntryParser();
parser.parseRoute(rAirlineEdit.getText(), rSourceEdit.getText(), rDestEdit.getText(), rCodeshareEdit.getText(),
rStopsEdit.getText(), rEquipmentEdit.getText());
theDataSet.editRoute(toEdit, rAirlineEdit.getText(), rSourceEdit.getText(), rDestEdit.getText(), rCodeshareEdit.getText(),
rStopsEdit.getText(), rEquipmentEdit.getText());
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Route Edit Successful");
alert.setHeaderText("Route data edited!");
alert.setContentText("Your route data has been successfully edited.");
alert.showAndWait();
Stage stage = (Stage) editButton.getScene().getWindow();
stage.close();
} catch (DataException e) {
System.err.println("RIP Harambe: " + e.getMessage() + "IT WAS TOO SOON");
}
}
public void load() {
if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
toEdit = theDataSet.getRouteDictionary().get(currentSession.getRouteToEdit());
rAirlineEdit.setText(toEdit.getAirlineName());
rSourceEdit.setText(toEdit.getDepartureAirport());
rDestEdit.setText(toEdit.getArrivalAirport());
rCodeshareEdit.setText(toEdit.getCode());
rStopsEdit.setText(Integer.toString(toEdit.getStops()));
rEquipmentEdit.setText(toEdit.getEquipment());
}
}

@ -72,11 +72,12 @@ public class RouteFilterController extends Controller {
alert.showAndWait(); alert.showAndWait();
//currentSession.setFilteredAirlines(FXCollections.observableArrayList(filter.getFilteredData())); //currentSession.setFilteredAirlines(FXCollections.observableArrayList(filter.getFilteredData()));
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
HashMap<Integer, String> routesHM = new HashMap<Integer, String>(); HashMap<Integer, String> routesHM = new HashMap<Integer, String>();
ArrayList<Route> routes = filter.getFilteredData(); ArrayList<Route> routes = filter.getFilteredData();
for (int index = 0; index < routes.size(); index++) { for (int index = 0; index < routes.size(); index++) {
routesHM.put(index, routes.get(index).getAirlineName()); routesHM.put(index, routes.get(index).getAirlineName() + routes.get(index).getDepartureAirport() + routes.get(index).getArrivalAirport()
+ routes.get(index).getCode() + routes.get(index).getStops() + routes.get(index).getEquipment());
} }
currentSession.setFilteredRoutes(routesHM); currentSession.setFilteredRoutes(routesHM);
@ -85,6 +86,9 @@ public class RouteFilterController extends Controller {
} }
public void load() { public void load() {
if (!checkDataset()){
return;
}
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession(); currentSession = getParent().getSession();
} }

@ -51,6 +51,9 @@ public class RouteRDController extends Controller {
* Also sets up the dropdown menu options. * Also sets up the dropdown menu options.
*/ */
public void load() { public void load() {
if (!checkDataset()){
return;
}
//Sets up the table columns to be ready for use for Route data //Sets up the table columns to be ready for use for Route data
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName")); rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID")); rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
@ -77,12 +80,10 @@ public class RouteRDController extends Controller {
public void openFilter() { public void openFilter() {
createPopUpStage(SceneCode.ROUTE_FILTER, 600, 330); createPopUpStage(SceneCode.ROUTE_FILTER, 600, 330);
ArrayList<Route> d = new ArrayList(); ArrayList<Route> d = new ArrayList();
for(int i = 0; i < theDataSet.getRoutes().size(); i++) { for (int key: currentSession.getFilteredRoutes().keySet()){
if (currentSession.getFilteredRoutes().containsValue(theDataSet.getRoutes().get(i).getAirlineName()) d.add(theDataSet.getRouteDictionary().get(currentSession.getFilteredRoutes().get(key)));
&& currentSession.getFilteredRoutes().containsKey(i)) {
d.add(theDataSet.getRoutes().get(i));
}
} }
tableViewRouteRD.setItems(FXCollections.observableArrayList(d)); tableViewRouteRD.setItems(FXCollections.observableArrayList(d));
} }
@ -111,6 +112,18 @@ public class RouteRDController extends Controller {
} }
} }
public void editRoute() {
Route toEdit = tableViewRouteRD.getSelectionModel().getSelectedItem();
currentSession.setRouteToEdit(toEdit.getAirlineName() + toEdit.getDepartureAirport() + toEdit.getArrivalAirport() +
toEdit.getCode() + toEdit.getStops() + toEdit.getEquipment());
createPopUpStage(SceneCode.ROUTE_EDIT, 600, 330);
// System.out.println(toEdit.getName() + "," + toEdit.getCity() + "," + toEdit.getCountry() + "," + toEdit.getIATA_FFA()
// + "," + toEdit.getICAO() + "," + toEdit.getLatitude() + "," + toEdit.getLongitude() + "," + toEdit.getAltitude()
// + "," + toEdit.getTimezone() + "," + toEdit.getDST() + "," + toEdit.getTz());
tableViewRouteRD.refresh();
}
/** /**
* Analyses the current data and creates a graph based on the data. * Analyses the current data and creates a graph based on the data.
@ -124,4 +137,11 @@ public class RouteRDController extends Controller {
replaceSceneContent(SceneCode.ROUTE_SUMMARY); replaceSceneContent(SceneCode.ROUTE_SUMMARY);
currentSession = getParent().getSession(); currentSession = getParent().getSession();
} }
/**
* Opens a map with the data currently being displayed in the table.
*/
public void openMap(){
}
} }

@ -43,6 +43,9 @@ public class RouteSummaryController extends Controller{
* Loads initial state of the scene. * Loads initial state of the scene.
*/ */
public void load() { public void load() {
if (!checkDataset()){
return;
}
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName")); columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
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"));
@ -50,11 +53,9 @@ public class RouteSummaryController extends Controller{
columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment")); columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getRoutes())); tableView.setItems(FXCollections.observableArrayList(currentData.getRoutes()));
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Route>() { tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Route>() {
public void changed(ObservableValue<? extends Route> observable, Route oldValue, Route newValue) { public void changed(ObservableValue<? extends Route> observable, Route oldValue, Route newValue) {
System.out.println("loading"); Route selectedRoute= tableView.getSelectionModel().getSelectedItems().get(0);
Route selectedRoute= currentData.getRoutes().get(tableView.getSelectionModel().getSelectedIndices().get(0));
if (selectedRoute.getSourceAirport() != null && selectedRoute.getDestinationAirport() != null) { if (selectedRoute.getSourceAirport() != null && selectedRoute.getDestinationAirport() != null) {
map.displayRoute(new RoutePath( map.displayRoute(new RoutePath(
new Position(selectedRoute.getSourceAirport().getLatitude(), selectedRoute.getSourceAirport().getLongitude()), new Position(selectedRoute.getSourceAirport().getLatitude(), selectedRoute.getSourceAirport().getLongitude()),
@ -71,6 +72,7 @@ public class RouteSummaryController extends Controller{
} }
} }
}); });
map = new Map(mapView, new RoutePath(), tableView);
} }
/** /**

@ -3,11 +3,15 @@ package seng202.group9.Map;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker; import javafx.concurrent.Worker;
import javafx.scene.control.Alert;
import javafx.scene.control.TableView;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView; import javafx.scene.web.WebView;
import seng202.group9.Core.Position; import seng202.group9.Core.Position;
import seng202.group9.Core.RoutePath; import seng202.group9.Core.RoutePath;
import java.util.ArrayList;
/** /**
* Created by fwy13 on 17/09/16. * Created by fwy13 on 17/09/16.
*/ */
@ -31,6 +35,21 @@ public class Map {
}); });
} }
public Map(WebView webView, final RoutePath newRoute, TableView table){
this.webView = webView;
webEngine = webView.getEngine();
initMap();
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED){
displayRoute(newRoute);
table.getSelectionModel().selectFirst();
}
}
});
}
public void initMap() { public void initMap() {
webEngine.load(getClass().getClassLoader().getResource("map.html").toExternalForm()); webEngine.load(getClass().getClassLoader().getResource("map.html").toExternalForm());
} }
@ -45,4 +64,22 @@ public class Map {
webEngine.executeScript(scriptToExecute); webEngine.executeScript(scriptToExecute);
} }
public void displayRoutes(ArrayList<RoutePath> routes){
String routeJSONArray = "[";
int counter = 0;
for (RoutePath route: routes){
routeJSONArray += route.toJSONArray() + ", ";
if (counter++ > 49){
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Too Many Routes");
alert.setHeaderText("Too Many Routes to display");
alert.setContentText("As there are too many routes to display only the first\n50 will be displayed.");
alert.showAndWait();
break;
}
}
routeJSONArray += "]";
webEngine.executeScript("displayRoutes("+routeJSONArray+");");
}
} }

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="370.0" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirlineEditController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="125.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="515.0" minWidth="10.0" prefWidth="445.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="0.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="4.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<children>
<Label text="Edit Airline" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="TOP">
<font>
<Font size="18.0" />
</font>
</Label>
<Label text="Name" GridPane.halignment="LEFT" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Alias" GridPane.halignment="LEFT" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="IATA" GridPane.halignment="LEFT" GridPane.rowIndex="3">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="ICAO" GridPane.halignment="LEFT" GridPane.rowIndex="4">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Callsign" GridPane.halignment="LEFT" GridPane.rowIndex="5">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Country" GridPane.halignment="LEFT" GridPane.rowIndex="6">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Active" GridPane.halignment="LEFT" GridPane.rowIndex="7">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Button fx:id="applyButton" mnemonicParsing="false" onAction="#editAirline" text="Apply Conditions" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="8" />
<TextField fx:id="airlNameEdit" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="airlAliasEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="airlIATAEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="airlICAOEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="airlCallsignEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="airlCountryEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<TextField fx:id="airlActiveEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
</children>
</GridPane>

@ -49,6 +49,7 @@
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#editAirline" text="Edit" />
<MenuItem mnemonicParsing="false" onAction="#deleteAirline" text="Delete" /> <MenuItem mnemonicParsing="false" onAction="#deleteAirline" text="Delete" />
</items> </items>
</ContextMenu> </ContextMenu>
@ -56,17 +57,17 @@
</TableView> </TableView>
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE"> <HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE">
<children> <children>
<Button mnemonicParsing="false" onAction="#analyse_Button" text="Analyse Airline Data"> <Button mnemonicParsing="false" onAction="#analyse_Button" prefWidth="100.0" text="Analyse">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>
</Button> </Button>
<Button mnemonicParsing="false" onAction="#openFilter" text="Filter Airline Data"> <Button mnemonicParsing="false" onAction="#openFilter" prefWidth="100.0" text="Filter">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>
</Button> </Button>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" text="Add New Airline"> <Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" prefWidth="100.0" text="Add New">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>

@ -2,95 +2,70 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<?import javafx.scene.web.WebView?> <?import javafx.scene.web.WebView?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirlineSummaryController"> <GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.60" fx:controller="seng202.group9.GUI.AirlineSummaryController">
<children> <columnConstraints>
<ScrollPane prefHeight="800.0" prefWidth="800.0"> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<content> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<AnchorPane prefHeight="800.0" prefWidth="800.0"> </columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="429.0" minHeight="10.0" prefHeight="408.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="118.0" minHeight="10.0" prefHeight="110.0" vgrow="SOMETIMES" />
</rowConstraints>
<children> <children>
<HBox alignment="CENTER" prefHeight="300.0" prefWidth="583.0" AnchorPane.topAnchor="25.0"> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Airlines Summary">
<children>
<AnchorPane prefHeight="300.0" prefWidth="330.0">
<children>
<Pane layoutY="-6.0" prefHeight="60.0" prefWidth="330.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Text layoutX="21.0" layoutY="40.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Airlines Summary">
<font> <font>
<Font size="29.0" /> <Font size="36.0" />
</font> </font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Text> </Text>
</children> <TableView fx:id="tableView" prefHeight="200.0" prefWidth="378.0" GridPane.rowIndex="1" GridPane.rowSpan="2">
</Pane>
<Pane layoutY="52.0" prefHeight="240.0" prefWidth="480.0" AnchorPane.bottomAnchor="0.0">
<children>
<Pane layoutX="25.0" layoutY="10.0" prefHeight="220.0" prefWidth="120.0">
<children>
<TableView fx:id="tableView" prefHeight="200.0" prefWidth="378.0">
<columns> <columns>
<TableColumn fx:id="columnName" maxWidth="100.0" prefWidth="50.0" text="Name" /> <TableColumn fx:id="columnName" maxWidth="100.0" prefWidth="50.0" text="Name" />
<TableColumn fx:id="columnAlias" prefWidth="77.0" text="Alias" /> <TableColumn fx:id="columnAlias" prefWidth="77.0" text="Alias" />
<TableColumn fx:id="columnCountry" prefWidth="86.0" text="Country" /> <TableColumn fx:id="columnCountry" prefWidth="110.0" text="Country" />
<TableColumn fx:id="columnIATA" prefWidth="86.0" text="IATA/FAA" /> <TableColumn fx:id="columnIATA" prefWidth="89.0" text="IATA/FAA" />
<TableColumn fx:id="columnActive" prefWidth="46.0" text="Active" /> <TableColumn fx:id="columnActive" prefWidth="58.0" text="Active" />
</columns> </columns>
<GridPane.margin>
<Insets bottom="15.0" left="15.0" />
</GridPane.margin>
</TableView> </TableView>
</children></Pane> <WebView fx:id="mapView" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
</children> <GridPane.margin>
<padding> <Insets left="15.0" right="15.0" />
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </GridPane.margin>
</padding> </WebView>
</Pane> <Button mnemonicParsing="false" onAction="#airportSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Airports" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2" GridPane.valignment="TOP">
</children> <GridPane.margin>
</AnchorPane> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
<AnchorPane prefHeight="300.0" prefWidth="253.0"> </GridPane.margin>
<children>
<Pane layoutY="200.0" prefHeight="100.0" prefWidth="253.0">
<children>
<Button layoutX="20.0" layoutY="14.0" mnemonicParsing="false" onAction="#airportSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Airports">
<font>
<Font size="12.0" />
</font>
</Button> </Button>
<Button layoutX="94.0" layoutY="14.0" mnemonicParsing="false" onAction="#routeSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Routes"> <Button mnemonicParsing="false" onAction="#routeSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Routes" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="TOP">
<font> <GridPane.margin>
<Font size="12.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</font> </GridPane.margin>
</Button> </Button>
<Button layoutX="169.0" layoutY="14.0" mnemonicParsing="false" onAction="#flightSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Flights"> <Button mnemonicParsing="false" onAction="#flightSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Flights" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="TOP">
<font> <GridPane.margin>
<Font size="12.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</font> </GridPane.margin>
</Button>
<Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#airlineRawDataButton" prefHeight="25.0" prefWidth="200.0" text="Airline Raw Data" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="BOTTOM">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Button> </Button>
<Button layoutX="20.0" layoutY="61.0" mnemonicParsing="false" onAction="#airlineRawDataButton" prefHeight="25.0" prefWidth="214.0" text="Airline Raw Data" />
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</Pane>
<Pane prefHeight="200.0" prefWidth="253.0">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</Pane>
<WebView fx:id="mapView" prefHeight="200.0" prefWidth="252.0" />
</children>
</AnchorPane>
</children>
</HBox>
</children> </children>
</AnchorPane> </GridPane>
</content>
</ScrollPane>
</children>
</VBox>

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="480.0" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirportEditController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="125.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="515.0" minWidth="10.0" prefWidth="445.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="0.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="4.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<children>
<Label text="Edit Airport" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="TOP">
<font>
<Font size="18.0" />
</font>
</Label>
<Label text="Name*" GridPane.halignment="LEFT" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="City*" GridPane.halignment="LEFT" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Country*" GridPane.halignment="LEFT" GridPane.rowIndex="3">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="IATA/FAA" GridPane.halignment="LEFT" GridPane.rowIndex="4">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="ICAO" GridPane.halignment="LEFT" GridPane.rowIndex="5">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Latitude*" GridPane.halignment="LEFT" GridPane.rowIndex="6">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Longitude*" GridPane.halignment="LEFT" GridPane.rowIndex="7">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Button fx:id="editButton" mnemonicParsing="false" onAction="#editAirport" text="Edit Airport" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="12" />
<TextField fx:id="airpNameEdit" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="airpCityEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="airpCountryEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="airpIATAFAAEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="airpICAOEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="airpLatitudeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<Label prefHeight="21.0" prefWidth="117.0" text="* = required field" GridPane.columnSpan="2" GridPane.halignment="LEFT" GridPane.rowIndex="12">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" top="15.0" />
</GridPane.margin></Label>
<TextField fx:id="airpLongitudeEdit" GridPane.columnIndex="1" GridPane.rowIndex="7" />
<TextField fx:id="airpAltitudeEdit" GridPane.columnIndex="1" GridPane.rowIndex="8" />
<TextField fx:id="airpTimezoneEdit" GridPane.columnIndex="1" GridPane.rowIndex="9" />
<TextField fx:id="airpDSTEdit" GridPane.columnIndex="1" GridPane.rowIndex="10" />
<TextField fx:id="airpTzEdit" GridPane.columnIndex="1" GridPane.rowIndex="11" />
<Label text="Altitude*" GridPane.halignment="LEFT" GridPane.rowIndex="8">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Timezone*" GridPane.halignment="LEFT" GridPane.rowIndex="9">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="DST" GridPane.halignment="LEFT" GridPane.rowIndex="10">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Time Olson" GridPane.halignment="LEFT" GridPane.rowIndex="11">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
</children>
</GridPane>

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.web.*?>
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<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.AirportRouteMapController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="205.0" minWidth="10.0" prefWidth="197.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="686.0" minWidth="10.0" prefWidth="603.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="0.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="520.0" minHeight="10.0" prefHeight="20.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="520.0" minHeight="10.0" prefHeight="500.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Routes By Airport">
<font>
<Font size="36.0" />
</font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Text>
<Label text="Airports" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="TOP">
<font>
<Font size="15.0" />
</font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Label>
<WebView fx:id="mapView" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.rowSpan="2">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="20.0" />
</GridPane.margin>
</WebView>
<TableView fx:id="airportsTable" prefHeight="471.0" prefWidth="142.0" GridPane.rowIndex="2">
<columns>
<TableColumn fx:id="airportName" prefWidth="88.0" text="Airport" />
<TableColumn fx:id="routes" prefWidth="62.0" text="Routes" />
</columns>
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" />
</GridPane.margin>
</TableView>
</children>
</GridPane>

@ -39,6 +39,7 @@
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#editAirport" text="Edit" />
<MenuItem mnemonicParsing="false" onAction="#deleteAirport" text="Delete" /> <MenuItem mnemonicParsing="false" onAction="#deleteAirport" text="Delete" />
</items> </items>
</ContextMenu> </ContextMenu>
@ -60,17 +61,22 @@
</TableView> </TableView>
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE"> <HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE">
<children> <children>
<Button mnemonicParsing="false" onAction="#analyse_Button" text="Analyse Airport Data"> <Button mnemonicParsing="false" onAction="#analyse_Button" prefWidth="100.0" text="Analyse">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>
</Button> </Button>
<Button mnemonicParsing="false" onAction="#openFilter" text="Filter Airport Data"> <Button mnemonicParsing="false" onAction="#openFilter" prefWidth="100.0" text="Filter">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>
</Button> </Button>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" text="Add New Airport"> <Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" prefWidth="100.0" text="Add New">
<HBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</HBox.margin>
</Button>
<Button layoutX="285.0" layoutY="25.0" mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openMap" prefWidth="100.0" text="Map Data">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>

@ -1,99 +1,76 @@
<?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.scene.web.*?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<?import javafx.scene.web.WebView?> <?import javafx.scene.web.WebView?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirportSummaryController"> <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.AirportSummaryController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="429.0" minHeight="10.0" prefHeight="408.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="118.0" minHeight="10.0" prefHeight="110.0" vgrow="SOMETIMES" />
</rowConstraints>
<children> <children>
<ScrollPane prefHeight="800.0" prefWidth="800.0"> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Airports Summary">
<content>
<AnchorPane prefHeight="800.0" prefWidth="800.0">
<children>
<HBox alignment="CENTER" prefHeight="300.0" prefWidth="583.0" AnchorPane.topAnchor="25.0">
<children>
<AnchorPane prefHeight="300.0" prefWidth="330.0">
<children>
<Pane layoutY="-6.0" prefHeight="60.0" prefWidth="330.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Text layoutX="21.0" layoutY="40.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Airports Summary">
<font> <font>
<Font size="29.0" /> <Font size="36.0" />
</font> </font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Text> </Text>
</children> <WebView fx:id="mapView" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
</Pane> <GridPane.margin>
<Pane layoutY="52.0" prefHeight="240.0" prefWidth="480.0" AnchorPane.bottomAnchor="0.0"> <Insets left="15.0" right="15.0" />
<children> </GridPane.margin>
<Pane layoutX="25.0" layoutY="10.0" prefHeight="220.0" prefWidth="120.0"> </WebView>
<children> <Button mnemonicParsing="false" onAction="#airlineSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Airlines" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2" GridPane.valignment="TOP">
<TableView fx:id="tableView" layoutX="10.0" layoutY="10.0" prefHeight="200.0" prefWidth="378.0"> <GridPane.margin>
<columns> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
<TableColumn fx:id="columnName" maxWidth="150.0" prefWidth="75.0" text="Name" /> </GridPane.margin>
<TableColumn fx:id="columnCity" prefWidth="75.0" text="City" />
<TableColumn fx:id="columnCountry" prefWidth="75.0" text="Country" />
<TableColumn fx:id="columnAltitude" prefWidth="75.0" text="Altitude" />
<TableColumn fx:id="columnIATA" prefWidth="75.0" text="IATA/FAA" />
</columns>
</TableView>
</children>
</Pane>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</Pane>
</children>
</AnchorPane>
<AnchorPane prefHeight="300.0" prefWidth="253.0">
<children>
<Pane layoutY="200.0" prefHeight="100.0" prefWidth="253.0">
<children>
<Button layoutX="20.0" layoutY="14.0" mnemonicParsing="false" onAction="#airlineSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Airline">
<font>
<Font size="12.0" />
</font>
</Button> </Button>
<Button layoutX="94.0" layoutY="14.0" mnemonicParsing="false" onAction="#routeSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Routes"> <Button mnemonicParsing="false" onAction="#routeSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Routes" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="TOP">
<font> <GridPane.margin>
<Font size="12.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</font> </GridPane.margin>
</Button> </Button>
<Button layoutX="169.0" layoutY="14.0" mnemonicParsing="false" onAction="#flightSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Flights"> <Button mnemonicParsing="false" onAction="#flightSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Flights" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="TOP">
<font> <GridPane.margin>
<Font size="12.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</font> </GridPane.margin>
</Button> </Button>
<Button layoutX="20.0" layoutY="61.0" mnemonicParsing="false" onAction="#airportRawDataButton" prefHeight="25.0" prefWidth="214.0" text="Airport Raw Data" /> <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#airportRawDataButton" prefHeight="25.0" prefWidth="200.0" text="Airport Raw Data" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="BOTTOM">
</children> <GridPane.margin>
<padding> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </GridPane.margin>
</padding> </Button>
</Pane> <TableView fx:id="tableView" prefHeight="200.0" prefWidth="378.0" GridPane.rowIndex="1" GridPane.rowSpan="2">
<Pane prefHeight="200.0" prefWidth="253.0"> <columns>
<padding> <TableColumn fx:id="columnName" minWidth="100.0" prefWidth="133.0" text="Name" />
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <TableColumn fx:id="columnCity" minWidth="50.0" prefWidth="65.0" text="City" />
</padding> <TableColumn fx:id="columnCountry" minWidth="45.0" prefWidth="99.0" text="Country" />
<children> <TableColumn fx:id="columnTotalRoutes" minWidth="18.0" prefWidth="70.0" text="Routes" />
<WebView fx:id="mapView" prefHeight="200.0" prefWidth="254.0" /> </columns>
</children> <GridPane.margin>
</Pane> <Insets bottom="15.0" left="15.0" />
</children> </GridPane.margin>
</AnchorPane> </TableView>
</children>
</HBox>
</children>
</AnchorPane>
</content>
</ScrollPane>
</children> </children>
</VBox> </GridPane>

@ -0,0 +1,42 @@
<?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="400.0" prefWidth="598.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="seng202.group9.GUI.DatasetController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="517.0" minWidth="10.0" prefWidth="496.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="300.0" minWidth="10.0" prefWidth="104.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="319.0" minHeight="10.0" prefHeight="41.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="319.0" minHeight="10.0" prefHeight="264.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="194.0" minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="194.0" minHeight="10.0" prefHeight="41.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ListView fx:id="datasetView" prefHeight="200.0" prefWidth="597.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
<contextMenu>
<ContextMenu>
<items>
<MenuItem fx:id="deleteBtn" mnemonicParsing="false" onAction="#deleteDataset" text="Delete Dataset" />
</items>
</ContextMenu>
</contextMenu>
</ListView>
<TextField fx:id="datasetName" prefHeight="25.0" prefWidth="485.0" promptText="Dataset Name" GridPane.rowIndex="2" />
<Button fx:id="addDataset" mnemonicParsing="false" onAction="#addDataset" prefHeight="25.0" prefWidth="84.0" text="Add" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<Label text="Select or Add a Dataset" GridPane.columnSpan="2" GridPane.halignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
<Button fx:id="openDataset" mnemonicParsing="false" onAction="#openDataset" prefHeight="25.0" prefWidth="785.0" text="Open" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.rowIndex="3" />
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</GridPane>

@ -0,0 +1,72 @@
<?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.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="280.0" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.FlightAddController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="125.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="515.0" minWidth="10.0" prefWidth="402.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="0.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="4.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<children>
<Label text="Add Flight Point" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="TOP">
<font>
<Font size="18.0" />
</font>
</Label>
<Label text="Name" GridPane.halignment="LEFT" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Type" GridPane.halignment="LEFT" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Altitude" GridPane.halignment="LEFT" GridPane.rowIndex="3">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Latitude" GridPane.halignment="LEFT" GridPane.rowIndex="4">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Longitude" GridPane.halignment="LEFT" GridPane.rowIndex="5">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Button fx:id="flightAddButton" mnemonicParsing="false" onAction="#addFlight" text="Add Flight Point" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<TextField fx:id="fNameAdd" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="fTypeAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="fAltitudeAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="fLatitudeAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="fLongitudeAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
</children>
</GridPane>

@ -3,134 +3,81 @@
<?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?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?> <?import javafx.scene.control.ListView?>
<?import javafx.scene.control.MenuItem?> <?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?> <?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?> <?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<?import javafx.scene.web.WebView?> <?import javafx.scene.web.WebView?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.FlightSummaryController"> <GridPane 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.FlightSummaryController">
<children>
<ScrollPane hbarPolicy="NEVER" prefHeight="800.0" prefWidth="800.0" vbarPolicy="NEVER">
<content>
<AnchorPane prefHeight="600.0" prefWidth="800.0">
<children>
<GridPane prefHeight="600.0" prefWidth="800.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="493.0" minWidth="10.0" prefWidth="484.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="393.0" minWidth="10.0" prefWidth="316.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="261.0" minHeight="0.0" prefHeight="48.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="711.0" minHeight="10.0" prefHeight="542.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane GridPane.rowIndex="1">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="237.0" minWidth="10.0" prefWidth="168.0" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="140.0" minWidth="10.0" prefWidth="140.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="316.0" minWidth="10.0" prefWidth="316.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints maxHeight="172.0" minHeight="0.0" prefHeight="44.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="461.0" minHeight="10.0" prefHeight="454.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="429.0" minHeight="10.0" prefHeight="408.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="118.0" minHeight="10.0" prefHeight="110.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Pane prefHeight="461.0" prefWidth="175.0" GridPane.rowIndex="1"> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Flight Data Summary">
<children> <font>
<ListView fx:id="flightPathListView" layoutX="20.0" layoutY="27.0" prefHeight="404.0" prefWidth="125.0"> <Font size="36.0" />
</font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Text>
<Button mnemonicParsing="false" onAction="#airportSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Airports" GridPane.columnIndex="2" GridPane.halignment="LEFT" GridPane.rowIndex="2" GridPane.valignment="TOP">
<GridPane.margin>
<Insets bottom="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Button>
<Button mnemonicParsing="false" onAction="#airlineSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Airlines" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="TOP">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="30.0" top="15.0" />
</GridPane.margin>
</Button>
<Button mnemonicParsing="false" onAction="#routeSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Routes" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="TOP">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Button>
<Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#handleRawDataButton" prefHeight="31.0" prefWidth="336.0" text="Flights Raw Data" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="BOTTOM">
<GridPane.margin>
<Insets bottom="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Button>
<ListView fx:id="flightPathListView" maxHeight="512.0" maxWidth="125.0" prefHeight="472.0" prefWidth="125.0" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.rowSpan="2" GridPane.valignment="CENTER">
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#deletePath" text="Delete" /> <MenuItem mnemonicParsing="false" onAction="#deletePath" text="Delete" />
</items> </items>
</ContextMenu> </ContextMenu>
</contextMenu></ListView> </contextMenu>
<Label layoutX="26.0" layoutY="4.0" text="Flight Path File(s)"> <GridPane.margin>
<font> <Insets bottom="15.0" left="15.0" top="20.0" />
<Font size="15.0" /> </GridPane.margin>
</font> </ListView>
</Label> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Flight Path File(s)" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="TOP">
</children> <GridPane.margin>
</Pane> <Insets left="15.0" />
<Pane prefHeight="60.0" prefWidth="330.0"> </GridPane.margin>
<children>
<Text layoutX="21.0" layoutY="40.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Flight Data Summary">
<font>
<Font size="48.0" />
</font>
</Text> </Text>
<WebView fx:id="mapView" prefHeight="431.0" prefWidth="310.0" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.rowSpan="2">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" />
</GridPane.margin>
</WebView>
<ListView fx:id="flightSummaryListView" prefHeight="317.0" prefWidth="266.0" GridPane.columnIndex="2" GridPane.rowIndex="1">
<GridPane.margin>
<Insets right="15.0" />
</GridPane.margin>
</ListView>
</children> </children>
</Pane> </GridPane>
<Pane prefHeight="934.0" prefWidth="474.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<WebView fx:id="mapView" prefHeight="431.0" prefWidth="310.0" />
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</Pane>
</children>
</GridPane>
<GridPane GridPane.columnIndex="1" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="347.0" minHeight="10.0" prefHeight="346.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="356.0" minHeight="10.0" prefHeight="152.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane prefHeight="160.0" prefWidth="295.0" GridPane.rowIndex="1">
<children>
<Button layoutX="26.0" layoutY="82.0" mnemonicParsing="false" onAction="#airportSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Airports">
<font>
<Font size="12.0" />
</font>
</Button>
<Button layoutX="127.0" layoutY="82.0" mnemonicParsing="false" onAction="#airlineSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Airlines">
<font>
<Font size="12.0" />
</font>
</Button>
<Button layoutX="227.0" layoutY="82.0" mnemonicParsing="false" onAction="#routeSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Routes">
<font>
<Font size="12.0" />
</font>
</Button>
<Button layoutX="26.0" layoutY="132.0" mnemonicParsing="false" onAction="#handleRawDataButton" prefHeight="25.0" prefWidth="266.0" text="Flights Raw Data" />
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</Pane>
<Pane prefHeight="200.0" prefWidth="200.0">
<children>
<Pane prefHeight="350.0" prefWidth="316.0">
<children>
<ListView layoutX="25.0" layoutY="76.0" prefHeight="258.0" prefWidth="266.0" />
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</Pane>
</children>
</Pane>
</children>
</GridPane>
</children>
</GridPane>
</children>
</AnchorPane>
</content>
</ScrollPane>
</children>
</VBox>

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="289.0" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.FlightEditorController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="168.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="515.0" minWidth="10.0" prefWidth="402.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="0.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="4.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<children>
<Label text="Edit Flight Point" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="TOP">
<font>
<Font size="18.0" />
</font>
</Label>
<Label text="Name" GridPane.halignment="LEFT" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Type" GridPane.halignment="LEFT" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Altitude" GridPane.halignment="LEFT" GridPane.rowIndex="3">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Latitude" GridPane.halignment="LEFT" GridPane.rowIndex="4">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Longitude" GridPane.halignment="LEFT" GridPane.rowIndex="5">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Button fx:id="flightEditButton" mnemonicParsing="false" onAction="#editFlight" text="Edit Flight" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<TextField fx:id="fNameEdit" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="fTypeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="fAltitudeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="fLatitudeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="fLongitudeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
</children>
</GridPane>

@ -1,148 +1,94 @@
<?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?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?> <?import javafx.scene.control.ListView?>
<?import javafx.scene.control.MenuItem?> <?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?> <?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?> <?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.FlightRDController"> <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.FlightRDController">
<children>
<ScrollPane hbarPolicy="NEVER" prefHeight="603.0" prefWidth="751.0" vbarPolicy="NEVER">
<content>
<AnchorPane prefHeight="371.0" prefWidth="600.0">
<children>
<GridPane prefHeight="600.0" prefWidth="800.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="193.0" minHeight="10.0" prefHeight="57.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="521.0" minHeight="10.0" prefHeight="513.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="62.0" minHeight="0.0" prefHeight="28.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane GridPane.rowIndex="1">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="393.0" minWidth="10.0" prefWidth="162.0" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="142.0" minWidth="10.0" prefWidth="142.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="651.0" minWidth="10.0" prefWidth="638.0" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="686.0" minWidth="10.0" prefWidth="658.0" />
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="50.0" minHeight="0.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="450.0" minHeight="10.0" prefHeight="450.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="68.0" minHeight="0.0" prefHeight="68.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Pane prefHeight="505.0" prefWidth="162.0"> <HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE">
<children> <children>
<Button layoutX="32.0" layoutY="480.0" mnemonicParsing="false" onAction="#newPath" prefHeight="25.0" prefWidth="99.0" text="New" /> <Button mnemonicParsing="false" onAction="#newPath" text="New Flight Path">
<ListView fx:id="flightPathListView" layoutX="19.0" layoutY="25.0" prefHeight="444.0" prefWidth="125.0"> <HBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</HBox.margin>
</Button>
<Button mnemonicParsing="false" onAction="#flightAnalyser" text="Analyse Flight Data">
<HBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</HBox.margin>
</Button>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" text="Add New Flight Point">
<HBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</HBox.margin>
</Button>
</children>
</HBox>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#flightSummaryButton" text="Back to Flight Summary" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="TOP">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Button>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Flight Raw Data">
<font>
<Font size="36.0" />
</font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Text>
<ListView fx:id="flightPathListView" prefHeight="415.0" prefWidth="128.0" GridPane.rowIndex="1">
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#deletePath" text="Delete" /> <MenuItem mnemonicParsing="false" onAction="#deletePath" text="Delete" />
</items> </items>
</ContextMenu> </ContextMenu>
</contextMenu></ListView> </contextMenu>
<Label layoutX="16.0" text="Flight Path File(s)"> <GridPane.margin>
<Insets bottom="15.0" left="15.0" top="20.0" />
</GridPane.margin>
</ListView>
<Label text="Flight Path File(s)" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="TOP">
<font> <font>
<Font size="15.0" /> <Font size="15.0" />
</font> </font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Label> </Label>
</children> <TableView fx:id="flightTableView" prefHeight="377.0" prefWidth="601.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
</Pane>
<GridPane prefHeight="467.0" prefWidth="638.0" GridPane.columnIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="617.0" minWidth="10.0" prefWidth="607.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="318.0" minWidth="10.0" prefWidth="43.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="414.0" minHeight="10.0" prefHeight="386.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="137.0" minHeight="1.0" prefHeight="17.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="137.0" minHeight="10.0" prefHeight="62.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="137.0" minHeight="10.0" prefHeight="44.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ScrollPane prefHeight="52.0" prefViewportHeight="25.0" prefViewportWidth="765.0" prefWidth="601.0" GridPane.rowIndex="2">
<content>
<Pane layoutY="25.0">
<children>
<TextField fx:id="flightLatitudeBox" layoutX="440.0" prefHeight="25.0" prefWidth="100.0" promptText="Latitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="flightTypeBox" layoutX="190.0" prefHeight="25.0" prefWidth="75.0" promptText="Type">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="flightAltitudeBox" layoutX="365.0" prefHeight="25.0" prefWidth="75.0" promptText="Altitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<Label prefHeight="25.0" prefWidth="90.0" text="Enter Values:" />
<TextField fx:id="flightViaBox" layoutX="265.0" prefHeight="25.0" prefWidth="100.0" promptText="Via">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="flightHeadingBox" layoutX="640.0" prefHeight="25.0" prefWidth="100.0" promptText="Heading">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="flightLongitudeBox" layoutX="540.0" prefHeight="25.0" prefWidth="100.0" promptText="Longitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="flightNameBox" layoutX="90.0" prefHeight="25.0" prefWidth="100.0" promptText="Name">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="flightLegDistBox" layoutX="740.0" prefHeight="25.0" prefWidth="75.0" promptText="Leg Dist">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="flightTotDistBox" layoutX="815.0" prefHeight="25.0" prefWidth="75.0" promptText="Tot Dist">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
</children>
<opaqueInsets>
<Insets />
</opaqueInsets>
</Pane>
</content>
</ScrollPane>
<Pane prefHeight="44.0" prefWidth="601.0" GridPane.rowIndex="3">
<children>
<Button layoutX="476.0" layoutY="11.0" mnemonicParsing="false" onAction="#addFlightPoint" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Button layoutY="11.0" mnemonicParsing="false" onAction="#flightAnalyser" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
</children>
</Pane>
<TableView fx:id="flightTableView" prefHeight="377.0" prefWidth="601.0">
<columns> <columns>
<TableColumn fx:id="flightIdCol" prefWidth="90.0" text="ID" /> <TableColumn fx:id="flightIdCol" prefWidth="90.0" text="ID" />
<TableColumn fx:id="flightNameCol" prefWidth="100.0" text="Name" /> <TableColumn fx:id="flightNameCol" prefWidth="100.0" text="Name" />
<TableColumn fx:id="flightTypeCol" prefWidth="75.0" text="Type" /> <TableColumn fx:id="flightTypeCol" prefWidth="75.0" text="Type" />
<TableColumn fx:id="flightViaCol" prefWidth="100.0" text="Via" /> <TableColumn fx:id="flightViaCol" prefWidth="100.0" text="Via" visible="false" />
<TableColumn fx:id="flightAltitudeCol" prefWidth="75.0" text="Altitude" /> <TableColumn fx:id="flightAltitudeCol" prefWidth="75.0" text="Altitude" />
<TableColumn fx:id="flightLatCol" prefWidth="100.0" text="Latitude" /> <TableColumn fx:id="flightLatCol" prefWidth="100.0" text="Latitude" />
<TableColumn fx:id="flightLongCol" prefWidth="100.0" text="Longitude" /> <TableColumn fx:id="flightLongCol" prefWidth="100.0" text="Longitude" />
@ -153,29 +99,16 @@
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#movePointUp" text="Move Up" />
<MenuItem mnemonicParsing="false" onAction="#movePointDown" text="Move Down" />
<MenuItem mnemonicParsing="false" onAction="#editPoint" text="Edit" />
<MenuItem mnemonicParsing="false" onAction="#deletePoint" text="Delete" /> <MenuItem mnemonicParsing="false" onAction="#deletePoint" text="Delete" />
</items> </items>
</ContextMenu> </ContextMenu>
</contextMenu> </contextMenu>
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" />
</GridPane.margin>
</TableView> </TableView>
</children> </children>
</GridPane> </GridPane>
</children>
</GridPane>
<Pane prefHeight="55.0" prefWidth="800.0">
<children>
<Text layoutX="14.0" layoutY="42.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Flight Raw Data">
<font>
<Font size="29.0" />
</font>
</Text>
</children>
</Pane>
</children>
</GridPane>
</children>
</AnchorPane>
</content>
</ScrollPane>
</children>
</VBox>

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<GridPane 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.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 alignment="TOP_CENTER" text="Welcome!" GridPane.columnSpan="5" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<font>
<Font size="36.0" />
</font>
<GridPane.margin>
<Insets />
</GridPane.margin>
</Label>
<Button mnemonicParsing="false" onAction="#manageDatasets" text="Manage Datasets" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="15.0" right="15.0" />
</GridPane.margin>
</Button>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="To get started, select which type of data you wish to import or manage your datasets." textAlignment="CENTER" wrappingWidth="480.84765625" GridPane.columnIndex="1" GridPane.rowIndex="1">
<font>
<Font size="20.0" />
</font>
</Text>
</children>
</GridPane>

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.HelpController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="286.0" minWidth="10.0" prefWidth="200.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="471.0" minWidth="10.0" prefWidth="400.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="126.0" minHeight="0.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="305.0" minHeight="10.0" prefHeight="289.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Help Section" GridPane.columnSpan="2" GridPane.halignment="CENTER">
<font>
<Font size="24.0" />
</font>
</Label>
<ScrollPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="10.0" right="10.0" />
</GridPane.margin>
<content>
<TextFlow fx:id="textArea" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="289.0" prefWidth="364.0" textAlignment="JUSTIFY" />
</content>
</ScrollPane>
<TreeView fx:id="treeView" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="10.0" left="10.0" right="10.0" />
</GridPane.margin>
</TreeView>
</children>
<padding>
<Insets top="10.0" />
</padding>
</GridPane>

@ -90,6 +90,57 @@
repositionMap(flightPath); repositionMap(flightPath);
} }
function displayRoutes(flightPaths) {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 0, lng: 0},
zoom: 5
});
for (var i = 0; i < flightPaths.length; i++) {
var tempMarker1 = null;
var tempMarker2 = null;
var tempPath = null;
if (flightPaths[i].length < 2) {
continue;
}
// CREATE MARKERS AT START AND FINISH
tempMarker1 = new google.maps.Marker({
position: flightPaths[i][0],
map: map
});
tempMarker2 = new google.maps.Marker({
position: flightPaths[i][flightPaths[i].length - 1],
map: map
});
// DRAW POLYLINE FOR ROUTE
tempPath = new google.maps.Polyline({
path: flightPaths[i],
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
tempPath.setMap(map);
}
repositionMapToMulti(flightPaths);
}
function repositionMapToMulti(flightPaths){
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < flightPaths.length; i++) {
for (var j = 0; j < flightPaths[i].length; j++) {
bounds.extend(flightPaths[i][j]);
}
}
map.fitBounds(bounds);
}
function repositionMap(flightPath) { function repositionMap(flightPath) {
var bounds = new google.maps.LatLngBounds(); var bounds = new google.maps.LatLngBounds();

@ -1,16 +1,21 @@
<?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.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>
<Menu mnemonicParsing="false" text="File"> <Menu mnemonicParsing="false" text="File">
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#openDataset" text="New/Open Dataset" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" onAction="#importAirports" text="Import Airports" /> <MenuItem mnemonicParsing="false" onAction="#importAirports" text="Import Airports" />
<MenuItem mnemonicParsing="false" onAction="#importAirlines" text="Import Airlines" /> <MenuItem mnemonicParsing="false" onAction="#importAirlines" text="Import Airlines" />
<MenuItem mnemonicParsing="false" onAction="#importRoutes" text="Import Routes" /> <MenuItem mnemonicParsing="false" onAction="#importRoutes" text="Import Routes" />
@ -43,12 +48,24 @@
<MenuItem mnemonicParsing="false" onAction="#viewFlightRawData" text="Raw Data" /> <MenuItem mnemonicParsing="false" onAction="#viewFlightRawData" text="Raw Data" />
</items> </items>
</Menu> </Menu>
<Menu mnemonicParsing="false" text="Maps">
<items>
<MenuItem mnemonicParsing="false" onAction="#viewRouteByAirport" text="Route By Airport" />
<MenuItem mnemonicParsing="false" onAction="#viewRouteByEquipment" text="Route By Equipment" />
</items>
</Menu>
</items></Menu> </items></Menu>
<Menu mnemonicParsing="false" text="Analysis"> <Menu mnemonicParsing="false" text="Analysis">
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#viewAnalyserMain" text="Graphs" /> <MenuItem mnemonicParsing="false" onAction="#viewAnalyserMain" text="Graphs" />
<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" />
<MenuItem mnemonicParsing="false" onAction="#goToHelp" text="Help Page" />
</items>
</Menu>
</menus> </menus>
</MenuBar> </MenuBar>
</children> </children>

@ -53,7 +53,7 @@
<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>
</Label> </Label>
<Label text="Stops" GridPane.halignment="LEFT" GridPane.rowIndex="5"> <Label text="Stops*" GridPane.halignment="LEFT" GridPane.rowIndex="5">
<GridPane.margin> <GridPane.margin>
<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>

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.web.*?>
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<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.EquipByRouteController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="205.0" minWidth="10.0" prefWidth="197.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="686.0" minWidth="10.0" prefWidth="603.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="0.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="520.0" minHeight="10.0" prefHeight="500.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Routes By Equip">
<font>
<Font size="36.0" />
</font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Text>
<TableView fx:id="equipTable" prefHeight="471.0" prefWidth="142.0" GridPane.rowIndex="1">
<columns>
<TableColumn fx:id="equipName" prefWidth="88.0" text="Equipment" />
<TableColumn fx:id="routes" prefWidth="62.0" text="Routes" />
</columns>
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" />
</GridPane.margin>
</TableView>
<WebView fx:id="mapView" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
</children>
</GridPane>

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="330.0" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.RouteEditController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="168.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="515.0" minWidth="10.0" prefWidth="402.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="0.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="4.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<children>
<Label text="Edit Route" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="TOP">
<font>
<Font size="18.0" />
</font>
</Label>
<Label text="Airline*" GridPane.halignment="LEFT" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Source Airport*" GridPane.halignment="LEFT" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Desintation Airport*" GridPane.halignment="LEFT" GridPane.rowIndex="3">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Codeshare" GridPane.halignment="LEFT" GridPane.rowIndex="4">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Stops" GridPane.halignment="LEFT" GridPane.rowIndex="5">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="Equipment" GridPane.halignment="LEFT" GridPane.rowIndex="6">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Button fx:id="editButton" mnemonicParsing="false" onAction="#editRoute" text="Edit Route" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
<TextField fx:id="rAirlineEdit" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="rSourceEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="rDestEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="rCodeshareEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="rStopsEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="rEquipmentEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<Label text="* = required field" GridPane.halignment="LEFT" GridPane.rowIndex="7">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin></Label>
</children>
</GridPane>

@ -39,6 +39,7 @@
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#editRoute" text="Edit" />
<MenuItem mnemonicParsing="false" onAction="#deleteRoute" text="Delete" /> <MenuItem mnemonicParsing="false" onAction="#deleteRoute" text="Delete" />
</items> </items>
</ContextMenu> </ContextMenu>
@ -57,17 +58,22 @@
</TableView> </TableView>
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE"> <HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE">
<children> <children>
<Button mnemonicParsing="false" onAction="#analyse_Button" text="Analyse Route Data"> <Button mnemonicParsing="false" onAction="#analyse_Button" prefWidth="100.0" text="Analyse ">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>
</Button> </Button>
<Button mnemonicParsing="false" onAction="#openFilter" text="Filter Route Data"> <Button mnemonicParsing="false" onAction="#openFilter" prefWidth="100.0" text="Filter">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>
</Button> </Button>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" text="Add New Route"> <Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" prefWidth="100.0" text="Add New">
<HBox.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</HBox.margin>
</Button>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openMap" prefWidth="100.0" text="Map Data">
<HBox.margin> <HBox.margin>
<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" />
</HBox.margin> </HBox.margin>
@ -79,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>

@ -2,98 +2,70 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<?import javafx.scene.web.WebView?> <?import javafx.scene.web.WebView?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.RouteSummaryController"> <GridPane 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.RouteSummaryController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="429.0" minHeight="10.0" prefHeight="408.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="118.0" minHeight="10.0" prefHeight="110.0" vgrow="SOMETIMES" />
</rowConstraints>
<children> <children>
<ScrollPane prefHeight="800.0" prefWidth="800.0"> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Routes Summary">
<content>
<AnchorPane prefHeight="800.0" prefWidth="800.0">
<children>
<HBox alignment="CENTER" prefHeight="300.0" prefWidth="583.0" AnchorPane.topAnchor="25.0">
<children>
<AnchorPane prefHeight="300.0" prefWidth="330.0">
<children>
<Pane layoutY="-6.0" prefHeight="60.0" prefWidth="330.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Text layoutX="21.0" layoutY="40.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Routes Summary">
<font> <font>
<Font size="29.0" /> <Font size="36.0" />
</font> </font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Text> </Text>
</children> <WebView fx:id="mapView" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
</Pane> <GridPane.margin>
<Pane layoutY="52.0" prefHeight="240.0" prefWidth="480.0" AnchorPane.bottomAnchor="0.0"> <Insets left="15.0" right="15.0" />
<children> </GridPane.margin>
<Pane layoutX="25.0" layoutY="10.0" prefHeight="220.0" prefWidth="120.0"> </WebView>
<children> <Button mnemonicParsing="false" onAction="#airportSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Airports" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2" GridPane.valignment="TOP">
<TableView fx:id="tableView" prefHeight="200.0" prefWidth="378.0"> <GridPane.margin>
<columns> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
<TableColumn fx:id="columnAirline" prefWidth="89.0" text="Airline" /> </GridPane.margin>
<TableColumn fx:id="columnDepart" prefWidth="80.99998474121094" text="Depart" />
<TableColumn fx:id="columnArrive" prefWidth="67.0" text="Arrive" />
<TableColumn fx:id="columnStops" prefWidth="72.0" text="Stops" />
<TableColumn fx:id="columnEquipment" prefWidth="66.0" text="Equipment" />
</columns>
</TableView>
</children>
</Pane>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</Pane>
</children>
</AnchorPane>
<AnchorPane prefHeight="300.0" prefWidth="253.0">
<children>
<Pane layoutY="200.0" prefHeight="100.0" prefWidth="253.0">
<children>
<Button layoutX="20.0" layoutY="14.0" mnemonicParsing="false" onAction="#airportSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Airports">
<font>
<Font size="12.0" />
</font>
</Button> </Button>
<Button layoutX="94.0" layoutY="14.0" mnemonicParsing="false" onAction="#airlineSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Airlines"> <Button mnemonicParsing="false" onAction="#airlineSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Airlines" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="TOP">
<font> <GridPane.margin>
<Font size="12.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</font> </GridPane.margin>
</Button> </Button>
<Button layoutX="169.0" layoutY="14.0" mnemonicParsing="false" onAction="#flightSummaryButton" prefHeight="25.0" prefWidth="65.0" text="Flights"> <Button mnemonicParsing="false" onAction="#flightSummaryButton" prefHeight="25.0" prefWidth="100.0" text="Flights" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="TOP">
<font> <GridPane.margin>
<Font size="12.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</font> </GridPane.margin>
</Button> </Button>
<Button layoutX="20.0" layoutY="61.0" mnemonicParsing="false" onAction="#routeRawDataButton" prefHeight="25.0" prefWidth="214.0" text="Routes Raw Data" /> <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#routeRawDataButton" prefHeight="25.0" prefWidth="200.0" text="Routes Raw Data" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="BOTTOM">
</children> <GridPane.margin>
<padding> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </GridPane.margin>
</padding> </Button>
</Pane> <TableView fx:id="tableView" prefHeight="200.0" prefWidth="378.0" GridPane.rowIndex="1" GridPane.rowSpan="2">
<Pane prefHeight="200.0" prefWidth="253.0"> <columns>
<padding> <TableColumn fx:id="columnAirline" prefWidth="77.0" text="Airline" />
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <TableColumn fx:id="columnDepart" prefWidth="72.0" text="Depart" />
</padding> <TableColumn fx:id="columnArrive" prefWidth="70.0" text="Arrive" />
<children> <TableColumn fx:id="columnStops" prefWidth="60.0" text="Stops" />
<WebView fx:id="mapView" prefHeight="200.0" prefWidth="252.0" /> <TableColumn fx:id="columnEquipment" prefWidth="85.0" text="Equipment" />
</children> </columns>
</Pane> <GridPane.margin>
</children> <Insets bottom="15.0" left="15.0" />
</AnchorPane> </GridPane.margin>
</children> </TableView>
</HBox>
</children>
</AnchorPane>
</content>
</ScrollPane>
</children> </children>
</VBox> </GridPane>

@ -32,6 +32,11 @@ public class DatasetTest {
fail("The sample file is missing"); fail("The sample file is missing");
} }
assertTrue(dataset.getAirlines().size() == dataset.getAirlineDictionary().size()); assertTrue(dataset.getAirlines().size() == dataset.getAirlineDictionary().size());
try {
assertTrue(dataset.getAirlines().get(0).getID() == 1);
} catch (DataException e) {
fail("The first index of Airlines should have an id of 1 as there has been no tampering with the data yet");
}
try { try {
dataset.importAirport("res/Reduced Samples/Airports.txt"); dataset.importAirport("res/Reduced Samples/Airports.txt");
@ -41,6 +46,11 @@ public class DatasetTest {
assertTrue(dataset.getAirports().size() == dataset.getAirportDictionary().size()); assertTrue(dataset.getAirports().size() == dataset.getAirportDictionary().size());
assertTrue(dataset.getCities().size() == dataset.getCityDictionary().size()); assertTrue(dataset.getCities().size() == dataset.getCityDictionary().size());
assertTrue(dataset.getCountries().size() == dataset.getCountryDictionary().size()); assertTrue(dataset.getCountries().size() == dataset.getCountryDictionary().size());
try {
assertTrue(dataset.getAirports().get(0).getID() == 1);
} catch (DataException e) {
fail("The first index of Airports should have an id of 1 as there has been no tampering with the data yet");
}
try { try {
dataset.importRoute("res/Reduced Samples/Routes.txt"); dataset.importRoute("res/Reduced Samples/Routes.txt");
@ -48,6 +58,11 @@ public class DatasetTest {
fail("The sample file is missing"); fail("The sample file is missing");
} }
assertTrue(dataset.getRoutes().size() == dataset.getRouteDictionary().size()); assertTrue(dataset.getRoutes().size() == dataset.getRouteDictionary().size());
try {
assertTrue(dataset.getRoutes().get(0).getID() == 1);
} catch (DataException e) {
fail("The first index of Routes should have an id of 1 as there has been no tampering with the data yet");
}
try { try {
dataset.importFlight("res/Reduced Samples/NZCH-WSSS.csv"); dataset.importFlight("res/Reduced Samples/NZCH-WSSS.csv");
@ -55,6 +70,11 @@ public class DatasetTest {
fail("The sample file is missing"); fail("The sample file is missing");
} }
assertTrue(dataset.getFlightPaths().size() == dataset.getFlightPathDictionary().size()); assertTrue(dataset.getFlightPaths().size() == dataset.getFlightPathDictionary().size());
try {
assertTrue(dataset.getFlightPaths().get(0).getID() == 1);
} catch (DataException e) {
fail("The first index of Flight Paths should have an id of 1 as there has been no tampering with the data yet");
}
dataset.createDataLinks(); dataset.createDataLinks();
@ -185,6 +205,8 @@ public class DatasetTest {
fail("The sample file is missing"); fail("The sample file is missing");
} }
assertTrue(dataset.getFlightPaths().get(0).getFlightPoints().get(0).getID() == 1);
FlightPoint flightPoint = dataset.getFlightPaths().get(0).getFlightPoints().get(6); FlightPoint flightPoint = dataset.getFlightPaths().get(0).getFlightPoints().get(6);
FlightPoint flightPoint1 = dataset.getFlightPaths().get(0).getFlightPoints().get(5); FlightPoint flightPoint1 = dataset.getFlightPaths().get(0).getFlightPoints().get(5);
dataset.deleteFlightPoint(1, 5); dataset.deleteFlightPoint(1, 5);
@ -198,6 +220,15 @@ public class DatasetTest {
assertEquals(dataset.getFlightPaths().get(0).getFlightPoints().get(5).getName(), flightPoint1.getName()); assertEquals(dataset.getFlightPaths().get(0).getFlightPoints().get(5).getName(), flightPoint1.getName());
assertEquals(dataset.getFlightPaths().get(0).getFlightPoints().get(6).getName(), flightPoint.getName()); assertEquals(dataset.getFlightPaths().get(0).getFlightPoints().get(6).getName(), flightPoint.getName());
//edit order
FlightPoint wasLast = dataset.getFlightPaths().get(0).getFlightPoints().get(dataset.getFlightPaths().get(0).getFlightPoints().size() - 1);
FlightPoint wasSecondToLast = dataset.getFlightPaths().get(0).getFlightPoints().get(dataset.getFlightPaths().get(0).getFlightPoints().size() - 2);
FlightPoint wasFirst = dataset.getFlightPaths().get(0).getFlightPoints().get(0);
dataset.moveFlightPoint(wasLast, 0);
assertTrue(dataset.getFlightPaths().get(0).getFlightPoints().indexOf(wasLast) == 0);
assertTrue(dataset.getFlightPaths().get(0).getFlightPoints().indexOf(wasSecondToLast) == dataset.getFlightPaths().get(0).getFlightPoints().size() - 1);
assertTrue(dataset.getFlightPaths().get(0).getFlightPoints().indexOf(wasFirst) == 1);
app.deleteDataset(app.getCurrentDataset()); app.deleteDataset(app.getCurrentDataset());
} }

@ -31,6 +31,10 @@ public class FilterUnitTest {
int size = airlineFilter.getFilteredData().size(); int size = airlineFilter.getFilteredData().size();
airlineFilter.filterCountry("New Zealand");
assertTrue(airlineFilter.getFilteredData().size() == 25);
airlineFilter.reset();
airlineFilter.filterActive("Y"); airlineFilter.filterActive("Y");
assertTrue(size != airlineFilter.getFilteredData().size()); assertTrue(size != airlineFilter.getFilteredData().size());

Loading…
Cancel
Save