Merge remote-tracking branch 'remotes/origin/master' into WIP_Flight_Editor

# Conflicts:
#	res/userdb.db
#	src/main/java/seng202/group9/Controller/App.java
#	src/main/java/seng202/group9/Controller/Dataset.java
#	src/main/java/seng202/group9/Controller/SceneCode.java
#	src/main/java/seng202/group9/Controller/Session.java
#	src/main/java/seng202/group9/Core/FlightPath.java
main
Liam Beckett 9 years ago
commit b1864b6467

@ -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

Binary file not shown.

@ -155,6 +155,10 @@ public class AirlineFilter extends Filter{
return filteredList; return filteredList;
} }
// public ArrayList getBaseList(){
// return baseArray;
// }
/** /**
* sets a new base list of the filter. * sets a new base list of the filter.
* @param arrayList * @param arrayList

@ -139,6 +139,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();
} }
} }

@ -32,6 +32,7 @@ public class Dataset {
private LinkedHashMap<String, City> cityDictionary; private LinkedHashMap<String, City> cityDictionary;
/** /**
*
* @param name Name of the database * @param name Name of the database
* @param action either Dataset.getExisting or Dataset.createNew * @param action either Dataset.getExisting or Dataset.createNew
* @throws DataException Throws an exception if there is some error ie databases with the same name * @throws DataException Throws an exception if there is some error ie databases with the same name
@ -45,16 +46,11 @@ public class Dataset {
this.cities = new ArrayList<City>(); this.cities = new ArrayList<City>();
this.countries = new ArrayList<Country>(); this.countries = new ArrayList<Country>();
this.airlineDictionary = new LinkedHashMap<String, Airline>(); this.airlineDictionary = new LinkedHashMap<String, Airline>();
this.airportDictionary = new LinkedHashMap<String, Airport>(); this.airportDictionary = new LinkedHashMap<String, Airport>();;
; this.routeDictionary = new LinkedHashMap<String, Route>();;
this.routeDictionary = new LinkedHashMap<String, Route>(); this.countryDictionary = new LinkedHashMap<String, Country>();;
; this.cityDictionary = new LinkedHashMap<String, City>();;
this.countryDictionary = new LinkedHashMap<String, Country>();
;
this.cityDictionary = new LinkedHashMap<String, City>();
;
this.flightPathDictionary = new LinkedHashMap<Integer, FlightPath>(); this.flightPathDictionary = new LinkedHashMap<Integer, FlightPath>();
this.flightPointDictionary = new LinkedHashMap<Integer, FlightPoint>();
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
@ -65,7 +61,6 @@ public class Dataset {
/** /**
* Updates Dataset Arrays from Database. * Updates Dataset Arrays from Database.
*
* @throws DataException * @throws DataException
*/ */
public void updateDataset() throws DataException{ public void updateDataset() throws DataException{
@ -193,7 +188,7 @@ public class Dataset {
///////////////////////*/ ///////////////////////*/
for (int i = 0; i < flightPaths.size(); i++){ for (int i = 0; i < flightPaths.size(); i++){
stmt = c.createStatement(); stmt = c.createStatement();
String queryFlightPoints = "SELECT * FROM `" + this.name + "_Flight_Points` WHERE `Index_ID` = " + flightPaths.get(i).getID() + " ORDER BY `Order` ASC"; String queryFlightPoints = "SELECT * FROM `" + this.name + "_Flight_Points` WHERE `Index_ID` = "+flightPaths.get(i).getID() + " ORDER BY `Index_ID` ASC, `Order` ASC";
rs = stmt.executeQuery(queryFlightPoints); rs = stmt.executeQuery(queryFlightPoints);
while (rs.next()) { while (rs.next()) {
//FlightPoint(String name, int ID, int indexID, String type, String via, //FlightPoint(String name, int ID, int indexID, String type, String via,
@ -210,11 +205,9 @@ 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");
FlightPoint flightPoint = new FlightPoint(flightPtName, flightPtID, flightPtInd flightPaths.get(i).addFlightPoint(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();
@ -248,12 +241,15 @@ public class Dataset {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0); System.exit(0);
} }
//update all flightpaths
for (FlightPath flightPath: flightPaths){
//updateFlightPointInfo(flightPath);
}
createDataLinks(); createDataLinks();
} }
/** /**
* Creates new Dataset with empty data tables etc * Creates new Dataset with empty data tables etc
*
* @throws DataException * @throws DataException
*/ */
public void createTables() throws DataException{ public void createTables() throws DataException{
@ -368,7 +364,6 @@ public class Dataset {
/** /**
* Imports Airline files to the dataset * Imports Airline files to the dataset
*
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -381,7 +376,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;
@ -438,10 +433,8 @@ public class Dataset {
createDataLinks(); createDataLinks();
return message; return message;
} }
/** /**
* Imports Airport files to the dataset * Imports Airport files to the dataset
*
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -456,7 +449,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;
@ -471,6 +464,7 @@ 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`," +
@ -575,7 +569,6 @@ public class Dataset {
/** /**
* Imports Route files to dataset * Imports Route files to dataset
*
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -588,7 +581,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;
@ -651,7 +644,6 @@ public class Dataset {
/** /**
* Imports Flight files to dataset * Imports Flight files to dataset
*
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -663,7 +655,6 @@ 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 numOfDuplicates = 0;
int nextID = 1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
@ -672,8 +663,8 @@ 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...
@ -720,28 +711,31 @@ public class Dataset {
insertFlightPointQuery += ","; insertFlightPointQuery += ",";
} }
insertFlightPointQuery += "(" + flightPathId +", \""+ flightName +"\", \"" + flightType + "\", "+ flightAltitude + ", " + insertFlightPointQuery += "(" + flightPathId +", \""+ flightName +"\", \"" + flightType + "\", "+ flightAltitude + ", " +
"" + flightLatitude + ", " + flightLongitude + ")"; "" + flightLatitude + ", " + flightLongitude + ", "+numOfFlights+")";
flightPointsToImport.get(i).setID(nextID); flightPointsToImport.get(i).setID(nextID);
flightPointsToImport.get(i).setIndexID(flightPathId); flightPointsToImport.get(i).setIndexID(flightPathId);
//add data to dataset array. //add data to dataset array.
//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));
flightPointDictionary.put(flightPointsToImport.get(i).getID(), flightPointsToImport.get(i)); //routeDictionary.put(routeIdentifier, flightsToImport.get(i));
nextID++; nextID++;
numOfFlights++; numOfFlights++;
//} //}
} }
if (numOfFlights > 0){ if (numOfFlights > 0){
stmt.execute(insertFlightPointQuery); stmt.execute(insertFlightPointQuery);
stmt.close();
} }
stmt.close();
c.close();
flightPaths.add(flightPathToAdd); flightPaths.add(flightPathToAdd);
updateFlightPointInfo(flightPathToAdd);
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);
} }
message += "\nDuplicates ommitted: " + numOfDuplicates;
createDataLinks(); createDataLinks();
return message; return message;
} }
@ -774,6 +768,7 @@ public class Dataset {
HashMap<String, Airport> airportsByIATA = new HashMap<String, Airport>(); //this is used later for connecting the routes HashMap<String, Airport> airportsByIATA = new HashMap<String, Airport>(); //this is used later for connecting the routes
HashMap<String, Airport> airportsByICAO = new HashMap<String, Airport>(); //this is used later for connecting the routes HashMap<String, Airport> airportsByICAO = new HashMap<String, Airport>(); //this is used later for connecting the routes
for (Airport airport: airports){ for (Airport airport: airports){
//System.out.println(airport.getIATA_FFA());
airportsByIATA.put(airport.getIATA_FFA(), airport); airportsByIATA.put(airport.getIATA_FFA(), airport);
airportsByICAO.put(airport.getICAO(), airport); airportsByICAO.put(airport.getICAO(), airport);
airport.setCountry(countryDictionary.get(airport.getCountryName())); airport.setCountry(countryDictionary.get(airport.getCountryName()));
@ -807,7 +802,6 @@ public class Dataset {
/** /**
* Addes Single Airline to Program and Database. * Addes Single Airline to Program and Database.
*
* @param name * @param name
* @param alias * @param alias
* @param IATA * @param IATA
@ -833,7 +827,6 @@ public class Dataset {
/** /**
* Adds a Single Airline from the Program to the Database * Adds a Single Airline from the Program to the Database
*
* @param airlineToAdd * @param airlineToAdd
* @throws DataException * @throws DataException
*/ */
@ -886,7 +879,6 @@ public class Dataset {
/** /**
* Adds a single Airport from the Program to the Database * Adds a single Airport from the Program to the Database
*
* @param name * @param name
* @param city * @param city
* @param country * @param country
@ -928,7 +920,6 @@ public class Dataset {
/** /**
* gets the name of the dataset. * gets the name of the dataset.
*
* @return * @return
*/ */
public String getName() { public String getName() {
@ -937,7 +928,6 @@ public class Dataset {
/** /**
* Adds an Airport to the database and dataset. * Adds an Airport to the database and dataset.
*
* @param airportToAdd * @param airportToAdd
* @throws DataException * @throws DataException
*/ */
@ -992,7 +982,6 @@ public class Dataset {
/** /**
* Adds a city to the dataset and database * Adds a city to the dataset and database
*
* @param city * @param city
*/ */
private void addCity(City city){ private void addCity(City city){
@ -1023,7 +1012,6 @@ public class Dataset {
/** /**
* Adds a Country to the dataset and database * Adds a Country to the dataset and database
*
* @param country * @param country
*/ */
private void addCountry(Country country){ private void addCountry(Country country){
@ -1053,7 +1041,6 @@ public class Dataset {
/** /**
* Adds one single route to the program. * Adds one single route to the program.
*
* @param airline * @param airline
* @param sourceAirport * @param sourceAirport
* @param destAirport * @param destAirport
@ -1078,7 +1065,6 @@ public class Dataset {
/** /**
* Adds a single route the dataset and database. * Adds a single route the dataset and database.
*
* @param routeToAdd * @param routeToAdd
* @throws DataException * @throws DataException
*/ */
@ -1139,7 +1125,6 @@ public class Dataset {
/** /**
* Adds a path to the database and to the path dictionary * Adds a path to the database and to the path dictionary
*
* @param sourceAirport * @param sourceAirport
* @param destAirport * @param destAirport
*/ */
@ -1184,7 +1169,6 @@ public class Dataset {
/** /**
* Adds a flight point to a given path woth the given id * Adds a flight point to a given path woth the given id
*
* @param id * @param id
* @param name * @param name
* @param type * @param type
@ -1259,6 +1243,40 @@ public class Dataset {
", \"" + via + "\")"; ", \"" + via + "\")";
stmt.execute(insertFlightPointQuery); stmt.execute(insertFlightPointQuery);
stmt.close(); stmt.close();
//move all the points after this forward
stmt = c.createStatement();
String updatePointOrderQuery = "";
FlightPath flightPath = flightPathDictionary.get(Integer.valueOf(id));
for (int i = index + 1; 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();
//if the index is the first or last we need to update the flight
if (index == 0){
try {
stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Flight_Path` SET `Source_Airport` = \""+flightName+"\" " +
"WHERE `Path_ID` = "+flightPath.getID();
stmt.execute(query);
c.close();
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
}
flightPath.setDepartureAirport(flightName);
}else if (index == flightPath.getFlightPoints().size() - 1){
try {
stmt = c.createStatement();
String query = "UPDATE `"+this.name+"_Flight_Path` SET `Destination_Airport` = \""+flightName+"\" " +
"WHERE `Path_ID` = "+flightPath.getID();
stmt.execute(query);
c.close();
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
}
flightPath.setArrivalAirport(flightName);
}
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);
@ -1266,22 +1284,21 @@ public class Dataset {
FlightPoint pointToAdd = new FlightPoint(name, pointID+1, id, type, via, headingVal, altitudeVal, legDistVal, FlightPoint pointToAdd = new FlightPoint(name, pointID+1, id, type, via, headingVal, altitudeVal, legDistVal,
totalDistVal,latitudeVal, longitudeVal); totalDistVal,latitudeVal, longitudeVal);
flightPointDictionary.put(pointID + 1, pointToAdd); updateFlightPointInfo(flightPathDictionary.get(Integer.valueOf(id)));
flightPathDictionary.get(Integer.valueOf(id)).addFlightPoint(pointToAdd, index); flightPathDictionary.get(Integer.valueOf(id)).addFlightPoint(pointToAdd, index);
} }
/*** /***
* Adds a single flight Point to an Existing Flight Path. * Adds a single flight Point to an Existing FLight Path.
* @param point * @param point
* @param index * @param index
* @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(), point.getVia(), String.valueOf(point.getAltitude()),
String.valueOf(point.getLatitude()), String.valueOf(point.getLongitude()), String.valueOf(point.getHeading()), String.valueOf( point.getLatitude()),String.valueOf(point.getLongitude()),
String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), 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.
* @param point * @param point
@ -1289,13 +1306,12 @@ public class Dataset {
*/ */
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(), point.getVia(), String.valueOf(point.getAltitude()),
String.valueOf(point.getLatitude()), String.valueOf(point.getLongitude()), String.valueOf(point.getHeading()), String.valueOf( point.getLatitude()),String.valueOf(point.getLongitude()),
String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), -1); String.valueOf(point.getHeading()), String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), -1);
} }
/** /**
* 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.
*
* @param id * @param id
* @param name * @param name
* @param type * @param type
@ -1313,7 +1329,6 @@ public class Dataset {
String heading, String legDist, String totDist) throws DataException{ String heading, String legDist, String totDist) throws DataException{
addFlightPointToPath(id, name, type, via, altitude, latitude, longitude, heading, legDist, totDist, -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
*/ */
@ -1344,7 +1359,6 @@ public class Dataset {
/** /**
* deletes an airline from the dataset. * deletes an airline from the dataset.
*
* @param airline * @param airline
*/ */
public void deleteAirline(Airline airline){ public void deleteAirline(Airline airline){
@ -1401,7 +1415,6 @@ public class Dataset {
/** /**
* Deletes an AIrline from the dataset and database based on it index * Deletes an AIrline from the dataset and database based on it index
*
* @param index * @param index
*/ */
public void deleteAirline(int index){ public void deleteAirline(int index){
@ -1410,7 +1423,6 @@ public class Dataset {
/** /**
* deletes an airport from the dataset. * deletes an airport from the dataset.
*
* @param airport * @param airport
*/ */
public void deleteAirport(Airport airport){ public void deleteAirport(Airport airport){
@ -1486,16 +1498,13 @@ public class Dataset {
/** /**
* Deletes an Airport from the dataset and database based on it index. * Deletes an Airport from the dataset and database based on it index.
*
* @param index * @param index
*/ */
public void deleteAirport(int index){ public void deleteAirport(int index){
deleteAirport(airports.get(index)); deleteAirport(airports.get(index));
} }
/** /**
* deletes an route from the dataset. * deletes an route from the dataset.
*
* @param route * @param route
*/ */
public void deleteRoute(Route route){ public void deleteRoute(Route route){
@ -1522,16 +1531,13 @@ public class Dataset {
/** /**
* Deletes a Route from the dataset and database based on its index * Deletes a Route from the dataset and database based on its index
*
* @param index * @param index
*/ */
public void deleteRoute(int index){ public void deleteRoute(int index){
deleteRoute(routes.get(index)); deleteRoute(routes.get(index));
} }
/** /**
* deletes an airline from the dataset. * deletes an airline from the dataset.
*
* @param flightPath * @param flightPath
*/ */
public void deleteFlightPath(FlightPath flightPath){ public void deleteFlightPath(FlightPath flightPath){
@ -1567,7 +1573,6 @@ public class Dataset {
/** /**
* Deletes a flight path from the database based on its index. * Deletes a flight path from the database based on its index.
*
* @param index * @param index
*/ */
public void deleteFlightPath(int index){ public void deleteFlightPath(int index){
@ -1576,7 +1581,6 @@ public class Dataset {
/** /**
* deletes an airline from the dataset. * deletes an airline from the dataset.
*
* @param flightPoint * @param flightPoint
*/ */
public void deleteFlightPoint(FlightPoint flightPoint, FlightPath flightPath){ public void deleteFlightPoint(FlightPoint flightPoint, FlightPath flightPath){
@ -1604,7 +1608,6 @@ public class Dataset {
/** /**
* deletes a single flight point from a given path. * deletes a single flight point from a given path.
*
* @param pathIndex * @param pathIndex
* @param pointIndex * @param pointIndex
*/ */
@ -1614,7 +1617,6 @@ public class Dataset {
/** /**
* returns the airlines that are part of this dataset. * returns the airlines that are part of this dataset.
*
* @return * @return
*/ */
public ArrayList<Airline> getAirlines() { public ArrayList<Airline> getAirlines() {
@ -1623,7 +1625,6 @@ public class Dataset {
/** /**
* returns the airports that are associated with this dataset. * returns the airports that are associated with this dataset.
*
* @return * @return
*/ */
public ArrayList<Airport> getAirports() { public ArrayList<Airport> getAirports() {
@ -1632,7 +1633,6 @@ public class Dataset {
/** /**
* returns the routes that are associated with this dataset. * returns the routes that are associated with this dataset.
*
* @return * @return
*/ */
public ArrayList<Route> getRoutes() { public ArrayList<Route> getRoutes() {
@ -1641,7 +1641,6 @@ public class Dataset {
/** /**
* returns the flight paths that are associated with this dataset. * returns the flight paths that are associated with this dataset.
*
* @return * @return
*/ */
public ArrayList<FlightPath> getFlightPaths() { public ArrayList<FlightPath> getFlightPaths() {
@ -1650,7 +1649,6 @@ public class Dataset {
/** /**
* returns the countries that are associated with this dataset. * returns the countries that are associated with this dataset.
*
* @return * @return
*/ */
public ArrayList<Country> getCountries() { public ArrayList<Country> getCountries() {
@ -1659,7 +1657,6 @@ public class Dataset {
/** /**
* returns the cities that are associate wit hthis dataset. * returns the cities that are associate wit hthis dataset.
*
* @return * @return
*/ */
public ArrayList<City> getCities() { public ArrayList<City> getCities() {
@ -1668,7 +1665,6 @@ public class Dataset {
/** /**
* returns a dictionary with the airlines that are associated with this datatset. * returns a dictionary with the airlines that are associated with this datatset.
*
* @return * @return
*/ */
public LinkedHashMap<String, Airline> getAirlineDictionary() { public LinkedHashMap<String, Airline> getAirlineDictionary() {
@ -1677,7 +1673,6 @@ public class Dataset {
/** /**
* returns a dictionary with the airports that are associated with this dataset. * returns a dictionary with the airports that are associated with this dataset.
*
* @return * @return
*/ */
public LinkedHashMap<String, Airport> getAirportDictionary() { public LinkedHashMap<String, Airport> getAirportDictionary() {
@ -1686,7 +1681,6 @@ public class Dataset {
/** /**
* returns a route dictionary with the routes that are associated wit hthis dataset. * returns a route dictionary with the routes that are associated wit hthis dataset.
*
* @return * @return
*/ */
public LinkedHashMap<String, Route> getRouteDictionary() { public LinkedHashMap<String, Route> getRouteDictionary() {
@ -1695,7 +1689,6 @@ public class Dataset {
/** /**
* returns a flightpath dictionary with the flights that are associated with this dataset. * returns a flightpath dictionary with the flights that are associated with this dataset.
*
* @return * @return
*/ */
public LinkedHashMap<Integer, FlightPath> getFlightPathDictionary() { public LinkedHashMap<Integer, FlightPath> getFlightPathDictionary() {
@ -1713,7 +1706,6 @@ public class Dataset {
/** /**
* 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
*/ */
public LinkedHashMap<String, Country> getCountryDictionary() { public LinkedHashMap<String, Country> getCountryDictionary() {
@ -1722,7 +1714,6 @@ public class Dataset {
/** /**
* returns a City Dictionary with the Cities that are associated with this datatset. * returns a City Dictionary with the Cities that are associated with this datatset.
*
* @return * @return
*/ */
public LinkedHashMap<String, City> getCityDictionary() { public LinkedHashMap<String, City> getCityDictionary() {
@ -1731,7 +1722,6 @@ public class Dataset {
/** /**
* Edits Airline and commits them to the database. * Edits Airline and commits them to the database.
*
* @param index * @param index
* @param name * @param name
* @param alias * @param alias
@ -1745,10 +1735,8 @@ public class Dataset {
public void editAirline(int index, String name, String alias, String IATA, String ICAO, String callsign, String country, String active ) throws DataException { public void editAirline(int index, String name, String alias, String IATA, String ICAO, String callsign, String country, String active ) throws DataException {
editAirline(airlines.get(index), name, alias, IATA, ICAO, callsign, country, active); editAirline(airlines.get(index), name, alias, IATA, ICAO, callsign, country, active);
} }
/** /**
* Edits Airline and commits them to the database. * Edits Airline and commits them to the database.
*
* @param airline * @param airline
* @param name * @param name
* @param alias * @param alias
@ -1790,7 +1778,6 @@ public class Dataset {
/** /**
* Edits the Airport in the dataset then commits it to the database. * Edits the Airport in the dataset then commits it to the database.
*
* @param index * @param index
* @param name * @param name
* @param city * @param city
@ -1811,7 +1798,6 @@ public class Dataset {
/** /**
* Edits the Airport in the dataset then commits it to the database. * Edits the Airport in the dataset then commits it to the database.
*
* @param airport * @param airport
* @param name * @param name
* @param city * @param city
@ -1844,9 +1830,59 @@ public class Dataset {
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("\"", "\"\"")+"\", " +
@ -1863,7 +1899,6 @@ public class Dataset {
/** /**
* Edits the ROutes in the dataset and commits it to the database. * Edits the ROutes in the dataset and commits it to the database.
*
* @param index * @param index
* @param airline * @param airline
* @param source * @param source
@ -1879,7 +1914,6 @@ public class Dataset {
/** /**
* Edits the ROutes in the dataset and then commits it to the database. * Edits the ROutes in the dataset and then commits it to the database.
*
* @param route * @param route
* @param airline * @param airline
* @param source * @param source
@ -1919,7 +1953,6 @@ public class Dataset {
/** /**
* Edits a flight Point in the dataset then commits it to the database. * Edits a flight Point in the dataset then commits it to the database.
*
* @param flightPath * @param flightPath
* @param index * @param index
* @param name * @param name
@ -1935,7 +1968,6 @@ public class Dataset {
/** /**
* Edits a flight Point in the dataset then commits it to the database. * Edits a flight Point in the dataset then commits it to the database.
*
* @param flightPoint * @param flightPoint
* @param name * @param name
* @param type * @param type
@ -1970,7 +2002,8 @@ 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() );
} }
FlightPath flightPath = flightPathDictionary.get(flightPoint.getIndex());
FlightPath flightPath = flightPathDictionary.get(flightPoint.getIndexID());
int indexOf = flightPath.getFlightPoints().indexOf(flightPoint); int indexOf = flightPath.getFlightPoints().indexOf(flightPoint);
if (indexOf == 0){ if (indexOf == 0){
@ -1996,10 +2029,72 @@ public class Dataset {
} }
flightPath.setArrivalAirport(flightPoint.getName()); flightPath.setArrivalAirport(flightPoint.getName());
} }
updateFlightPointInfo(flightPath);
createDataLinks(); createDataLinks();
} }
/**
* moves a flight point to another place in the Flight.
* @param flightPoint
* @param index
* @throws DataException
*/
public void moveFlightPoint(FlightPoint flightPoint, int index) throws DataException {
//remove and add it to the arraylist first
System.out.println(flightPoint.getIndex());
FlightPath flightPath = flightPathDictionary.get(flightPoint.getIndex());
int curIndex = flightPath.getFlightPoints().indexOf(flightPoint);
flightPath.getFlightPoints().remove(flightPoint);
int indexToAdd = index;
if (curIndex < index){
indexToAdd --;
}
flightPath.getFlightPoints().add(indexToAdd, flightPoint);
Connection c = null;
Statement stmt;
try {
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
//move all the points after this forward
stmt = c.createStatement();
String updatePointOrderQuery = "";
for (int i = index; 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();
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();
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0);
}
updateFlightPointInfo(flightPath);
}
/** /**
* Updates the Leg Distance, Total Distance and Bearing(Heading) of the Flight points in the flight path. * Updates the Leg Distance, Total Distance and Bearing(Heading) of the Flight points in the flight path.
* @param flightPath * @param flightPath

@ -9,7 +9,9 @@ public enum SceneCode {
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"), FLIGHT_EDITOR("flight_editor_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"),
ROUTE_FILTER("route_filter_form.fxml"), FLIGHT_EDITOR("flight_editor_form.fxml");
private String filePath; private String filePath;

@ -1,8 +1,12 @@
package seng202.group9.Controller; package seng202.group9.Controller;
import javafx.collections.ObservableList;
import seng202.group9.Core.Airline;
import seng202.group9.Core.FlightPoint; import seng202.group9.Core.FlightPoint;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap;
/** /**
* Created by fwy13 on 16/09/16. * Created by fwy13 on 16/09/16.
@ -12,6 +16,9 @@ public class Session implements Serializable {
private SceneCode sceneDisplayed; private SceneCode sceneDisplayed;
private int currentFlightPointID; private int currentFlightPointID;
private int currentFlightPathID; private int currentFlightPathID;
private HashMap<Integer, String> filteredAirlines;
private HashMap<Integer, String> filteredAirports;
private HashMap<Integer, String> filteredRoutes;
/** /**
* Constructor for a new session * Constructor for a new session
@ -45,6 +52,30 @@ public class Session implements Serializable {
return sceneDisplayed; return sceneDisplayed;
} }
public void setFilteredAirlines(HashMap airlines) {
this.filteredAirlines = airlines;
}
public HashMap<Integer, String> getFilteredAirlines() {
return filteredAirlines;
}
public void setFilteredAirports(HashMap airports) {
this.filteredAirports = airports;
}
public HashMap<Integer, String> getFilteredAirports() {
return filteredAirports;
}
public void setFilteredRoutes(HashMap routes) {
this.filteredRoutes = routes;
}
public HashMap<Integer, String> getFilteredRoutes() {
return filteredRoutes;
}
/** /**
* sets the current flight point * sets the current flight point
* @param currentFlightPointID * @param currentFlightPointID

@ -0,0 +1,83 @@
package seng202.group9.GUI;
import javafx.collections.FXCollections;
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;
/**
* Created by Sunguin on 2016/09/22.
*/
public class AirlineAddController extends Controller {
//Setting up text fields for adding data
@FXML
private TextField airlNameAdd;
@FXML
private TextField airlAliasAdd;
@FXML
private TextField airlIATAAdd;
@FXML
private TextField airlICAOAdd;
@FXML
private TextField airlCallsignAdd;
@FXML
private TextField airlCountryAdd;
@FXML
private TextField airlActiveAdd;
@FXML
private Button addButton;
private Dataset theDataSet = null;
/**
* Adds a single airline entry to the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addAirlineSingle() {
//Tries to add a new airline and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addAirline(
airlNameAdd.getText(),
airlAliasAdd.getText(),
airlIATAAdd.getText(),
airlICAOAdd.getText(),
airlCallsignAdd.getText(),
airlCountryAdd.getText(),
airlActiveAdd.getText());
airlNameAdd.clear();
airlAliasAdd.clear();
airlIATAAdd.clear();
airlICAOAdd.clear();
airlCallsignAdd.clear();
airlCountryAdd.clear();
airlActiveAdd.clear();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Airline Add Successful");
alert.setHeaderText("New Airline added!");
alert.setContentText("Your new airline has been successfully added into the database.");
alert.showAndWait();
Stage stage = (Stage) addButton.getScene().getWindow();
stage.close();
} catch (Exception e) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Airline Data Error");
alert.setHeaderText("Error adding a custom airline entry.");
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}
public void load() {
theDataSet = getParent().getCurrentDataset();
}
}

@ -0,0 +1,100 @@
package seng202.group9.GUI;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
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.AirlineFilter;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Airline;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Sunguin on 2016/09/22.
*/
public class AirlineFilterController extends Controller {
//Setting up text fields for filtering data
@FXML
private TextField airlNameFilter;
@FXML
private TextField airlAliasFilter;
@FXML
private TextField airlIATAFilter;
@FXML
private TextField airlICAOFilter;
@FXML
private TextField airlCallsignFilter;
@FXML
private TextField airlCountryFilter;
@FXML
private TextField airlActiveFilter;
@FXML
private Button applyButton;
private Dataset theDataSet = null;
private Session currentSession = null;
/**
* Filters airlines by any field.
* These are specified by what the user has typed in the filter boxes.
* Updates the GUI accordingly.
* @see AirlineFilter
*/
public void filterAirlines() {
//The filter function also operates like a search function
AirlineFilter filter = new AirlineFilter(theDataSet.getAirlines());
if (airlNameFilter.getText() != null) {
filter.filterName(airlNameFilter.getText());
}
if (airlAliasFilter.getText() != null) {
filter.filterAlias(airlAliasFilter.getText());
}
if (airlIATAFilter.getText() != null) {
filter.filterIATA(airlIATAFilter.getText());
}
if (airlICAOFilter.getText() != null) {
filter.filterICAO(airlICAOFilter.getText());
}
if (airlCallsignFilter.getText() != null) {
filter.filterCallsign(airlCallsignFilter.getText());
}
if (airlCountryFilter.getText() != null) {
filter.filterCountry(airlCountryFilter.getText());
}
if (airlActiveFilter.getText() != null) {
filter.filterActive(airlActiveFilter.getText());
}
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Airline Filter Successful");
alert.setHeaderText("Airline data filtered!");
alert.setContentText("Your airline data has been successfully filtered.");
alert.showAndWait();
//currentSession.setFilteredAirlines(FXCollections.observableArrayList(filter.getFilteredData()));
HashMap<Integer, String> airlinesHM = new HashMap<Integer, String>();
ArrayList<Airline> airlines = filter.getFilteredData();
//for (Airline airline: airlines) {
for (int index = 0; index < airlines.size(); index++) {
airlinesHM.put(index, airlines.get(index).getName());
}
currentSession.setFilteredAirlines(airlinesHM);
Stage stage = (Stage) applyButton.getScene().getWindow();
stage.close();
}
public void load() {
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
}
}

@ -1,14 +1,17 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import seng202.group9.Controller.AirlineFilter; import seng202.group9.Controller.*;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.Airline; import seng202.group9.Core.Airline;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList;
import java.util.Optional;
/** /**
* The GUI controller class for airline_raw_data.fxml. * The GUI controller class for airline_raw_data.fxml.
@ -20,56 +23,26 @@ public class AirlineRDController extends Controller {
@FXML @FXML
private TableView<Airline> tableViewAirlineRD; private TableView<Airline> tableViewAirlineRD;
@FXML @FXML
private TableColumn<Airline, String> airlIDcol; private TableColumn<Airline, String> airlIDCol;
@FXML @FXML
private TableColumn<Airline, String> airlNamecol; private TableColumn<Airline, String> airlNameCol;
@FXML @FXML
private TableColumn<Airline, String> airlAliascol; private TableColumn<Airline, String> airlAliasCol;
@FXML @FXML
private TableColumn<Airline, String> airlIATAcol; private TableColumn<Airline, String> airlIATACol;
@FXML @FXML
private TableColumn<Airline, String> airlICAOcol; private TableColumn<Airline, String> airlICAOCol;
@FXML @FXML
private TableColumn<Airline, String> airlCallsigncol; private TableColumn<Airline, String> airlCallsignCol;
@FXML @FXML
private TableColumn<Airline, String> airlCountrycol; private TableColumn<Airline, String> airlCountryCol;
@FXML @FXML
private TableColumn<Airline, String> airlActivecol; private TableColumn<Airline, String> airlActiveCol;
//Setting up text fields for adding data //Set an empty Dataset to be assigned to the current dataset.
@FXML
private TextField airlNameBox;
@FXML
private TextField airlAliasBox;
@FXML
private TextField airlIATABox;
@FXML
private TextField airlICAOBox;
@FXML
private TextField airlCallsignBox;
@FXML
private TextField airlCountryBox;
@FXML
private ComboBox<String> airlActiveCBox;
//Setting up text fields for filtering data
@FXML
private TextField airlNameFilter;
@FXML
private TextField airlAliasFilter;
@FXML
private TextField airlIATAFilter;
@FXML
private TextField airlICAOFilter;
@FXML
private TextField airlCallsignFilter;
@FXML
private TextField airlCountryFilter;
@FXML
private TextField airlActiveFilter;
//Set an empty Dataset to be assigned later.
private Dataset theDataSet = null; private Dataset theDataSet = null;
//Set an empty session to be assigned to the current session.
private Session currentSession = null;
/** /**
* Loads the initial airline data to the GUI table. * Loads the initial airline data to the GUI table.
@ -77,58 +50,47 @@ public class AirlineRDController extends Controller {
*/ */
public void load() { public void load() {
//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"));
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias")); airlAliasCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA")); airlIATACol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
airlICAOcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO")); airlICAOCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO"));
airlCallsigncol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign")); airlCallsignCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign"));
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName")); airlCountryCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active")); airlActiveCol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
//Assigning the Dataset to the current Dataset's airlines and displaying it in a table //Assigning the Dataset to the current Dataset's airlines and displaying it in a table
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines())); currentSession = getParent().getSession();
//Initializes the value for the drop-down menu for Active for adding a new Airline tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
airlActiveCBox.setValue("Y"); tableViewAirlineRD.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
airlActiveCBox.getItems().addAll("Y", "N");
} }
/** /**
* Adds a single airline entry to the database. * Opens the Airline add form.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/ */
public void addAirlineSingle() { public void openAdd() {
//Tries to add a new airline and clears the fields to their initial state if successful. createPopUpStage(SceneCode.AIRLINE_ADD, 600, 370);
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addAirline(
airlNameBox.getText(),
airlAliasBox.getText(),
airlIATABox.getText(),
airlICAOBox.getText(),
airlCallsignBox.getText(),
airlCountryBox.getText(),
airlActiveCBox.getSelectionModel().getSelectedItem().toString());
airlNameBox.clear();
airlAliasBox.clear();
airlIATABox.clear();
airlICAOBox.clear();
airlCallsignBox.clear();
airlCountryBox.clear();
airlActiveCBox.getSelectionModel().clearSelection();
airlActiveCBox.setValue("Y");
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines())); tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
} catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Airline Data Error");
alert.setHeaderText("Error adding a custom airline entry.");
alert.setContentText(e.getMessage());
alert.showAndWait();
} }
/**
* Opens the Airline Filter form.
*/
public void openFilter() {
createPopUpStage(SceneCode.AIRLINE_FILTER, 600, 370);
ArrayList<Airline> d = new ArrayList();
for(int i = 0; i < theDataSet.getAirlines().size(); i++) {
if (currentSession.getFilteredAirlines().containsValue(theDataSet.getAirlines().get(i).getName())
&& currentSession.getFilteredAirlines().containsKey(i)) {
d.add(theDataSet.getAirlines().get(i));
} }
}
tableViewAirlineRD.setItems(FXCollections.observableArrayList(d));
}
/** /**
* Deletes a single selected airline entry from the database. * Deletes a single selected airline entry from the database.
@ -137,45 +99,24 @@ public class AirlineRDController extends Controller {
*/ */
public void deleteAirline() { public void deleteAirline() {
//Gets an airline from the table and deletes it before updating the table //Gets an airline from the table and deletes it before updating the table
Airline toDelete = tableViewAirlineRD.getSelectionModel().getSelectedItem(); ObservableList<Airline> toDelete = tableViewAirlineRD.getSelectionModel().getSelectedItems();
theDataSet.deleteAirline(toDelete); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines())); alert.setTitle("Airline Delete Confirmation");
alert.setHeaderText("You are about to delete some data.");
alert.setContentText("Are you sure you want to delete the selected airline(s)?");
//alert.showAndWait();
Optional<ButtonType> result = alert.showAndWait();
Airline air = null;
if (result.isPresent() && result.get() == ButtonType.OK) {
for (int i = 0; i < toDelete.size(); i++) {
air = toDelete.get(i);
theDataSet.deleteAirline(air);
} }
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
/**
* Filters airlines by any field.
* These are specified by what the user has typed in the filter boxes.
* Updates the GUI accordingly.
* @see AirlineFilter
*/
public void filterAirlines() {
//The filter function also operates like a search function
AirlineFilter filter = new AirlineFilter(theDataSet.getAirlines());
if (airlNameFilter.getText() != null) {
filter.filterName(airlNameFilter.getText());
}
if (airlAliasFilter.getText() != null) {
filter.filterAlias(airlAliasFilter.getText());
}
if (airlIATAFilter.getText() != null) {
filter.filterIATA(airlIATAFilter.getText());
}
if (airlICAOFilter.getText() != null) {
filter.filterICAO(airlICAOFilter.getText());
}
if (airlCallsignFilter.getText() != null) {
filter.filterCallsign(airlCallsignFilter.getText());
}
if (airlCountryFilter.getText() != null) {
filter.filterCountry(airlCountryFilter.getText());
}
if (airlActiveFilter.getText() != null) {
filter.filterActive(airlActiveFilter.getText());
} }
//Sets the data according to the criteria specified by the user.
tableViewAirlineRD.setItems(FXCollections.<Airline>observableArrayList(filter.getFilteredData()));
} }
/** /**
* Analyses the current data and creates a graph based on the data. * Analyses the current data and creates a graph based on the data.
* Currently not implemented yet. * Currently not implemented yet.
@ -183,4 +124,8 @@ public class AirlineRDController extends Controller {
public void analyse_Button() { public void analyse_Button() {
JOptionPane.showMessageDialog(null, "This is not Implemented yet"); JOptionPane.showMessageDialog(null, "This is not Implemented yet");
} }
public void airlineSummaryButton() {
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
}
} }

@ -0,0 +1,99 @@
package seng202.group9.GUI;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.Session;
/**
* Created by Sunguin on 2016/09/22.
*/
public class AirportAddController extends Controller {
//Setting up text fields for adding data
@FXML
private TextField airpNameAdd;
@FXML
private TextField airpCityAdd;
@FXML
private TextField airpCountryAdd;
@FXML
private TextField airpIATAFAAAdd;
@FXML
private TextField airpICAOAdd;
@FXML
private TextField airpLatitudeAdd;
@FXML
private TextField airpLongitudeAdd;
@FXML
private TextField airpAltitudeAdd;
@FXML
private TextField airpTimezoneAdd;
@FXML
private TextField airpDSTAdd;
@FXML
private TextField airpTzAdd;
@FXML
private TextField addButton;
//Set an empty Dataset to be assigned later
private Dataset theDataSet = null;
/**
* Adds a single airport entry in the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addAirportSingle() {
//Tries to add a new airport and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addAirport(
airpNameAdd.getText(),
airpCityAdd.getText(),
airpCountryAdd.getText(),
airpIATAFAAAdd.getText(),
airpICAOAdd.getText(),
airpLatitudeAdd.getText(),
airpLongitudeAdd.getText(),
airpAltitudeAdd.getText(),
airpTimezoneAdd.getText(),
airpDSTAdd.getText(),
airpTzAdd.getText());
airpNameAdd.clear();
airpCityAdd.clear();
airpCountryAdd.clear();
airpIATAFAAAdd.clear();
airpICAOAdd.clear();
airpLatitudeAdd.clear();
airpLongitudeAdd.clear();
airpAltitudeAdd.clear();
airpTimezoneAdd.clear();
airpDSTAdd.clear();
airpTzAdd.clear();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Airport Add Successful");
alert.setHeaderText("New Airport added!");
alert.setContentText("Your new airport has been successfully added into the database.");
alert.showAndWait();
Stage stage = (Stage) addButton.getScene().getWindow();
stage.close();
} catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Airport Data Error");
alert.setHeaderText("Error adding a custom airport entry.");
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}
public void load() {
theDataSet = getParent().getCurrentDataset();
}
}

@ -0,0 +1,117 @@
package seng202.group9.GUI;
import javafx.collections.FXCollections;
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.AirportFilter;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Airport;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Sunguin on 2016/09/22.
*/
public class AirportFilterController extends Controller {
//Setting up text fields for filtering data
@FXML
private TextField airpNameFilter;
@FXML
private TextField airpCityFilter;
@FXML
private TextField airpCountryFilter;
@FXML
private TextField airpIATAFAAFilter;
@FXML
private TextField airpICAOFilter;
@FXML
private TextField airpLatitudeFilter;
@FXML
private TextField airpLongitudeFilter;
@FXML
private TextField airpAltitudeFilter;
@FXML
private TextField airpTimezoneFilter;
@FXML
private TextField airpDSTFilter;
@FXML
private TextField airpTzFilter;
@FXML
private Button applyButton;
//Set an empty Dataset to be assigned later
private Dataset theDataSet = null;
//Set an empty session to be assigned to the current session.
private Session currentSession = null;
/**
* Filters the airports table by any field.
* These are specified by what the user has typed in the filter boxes.
* Updates the GUI accordingly.
* @see AirportFilter
*/
public void filterAirports() {
//The filter function also operates like a search function
AirportFilter filter = new AirportFilter(theDataSet.getAirports());
if (airpNameFilter.getText() != null) {
filter.filterName(airpNameFilter.getText());
}
if (airpCityFilter.getText() != null) {
filter.filterCity(airpCityFilter.getText());
}
if (airpCountryFilter.getText() != null) {
filter.filterCountry(airpCountryFilter.getText());
}
if (airpIATAFAAFilter.getText() != null) {
filter.filterIATA_FFA(airpIATAFAAFilter.getText());
}
if (airpICAOFilter.getText() != null) {
filter.filterICAO(airpICAOFilter.getText());
}
if (airpLatitudeFilter.getText() != null) {
filter.filterLatitude(airpLatitudeFilter.getText());
}
if (airpLongitudeFilter.getText() != null) {
filter.filterLongitude(airpLongitudeFilter.getText());
}
if (airpAltitudeFilter.getText() != null) {
filter.filterAltitude(airpAltitudeFilter.getText());
}
if (airpTimezoneFilter.getText() != null) {
filter.filterTimezone(airpTimezoneFilter.getText());
}
if (airpDSTFilter.getText() != null) {
filter.filterDST(airpDSTFilter.getText());
}
if (airpTzFilter.getText() != null) {
filter.filterOlson(airpTzFilter.getText());
}
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Airline Filter Successful");
alert.setHeaderText("Airline data filtered!");
alert.setContentText("Your airline data has been successfully filtered.");
alert.showAndWait();
//currentSession.setFilteredAirlines(FXCollections.observableArrayList(filter.getFilteredData()));
HashMap<Integer, String> airportsHM = new HashMap<Integer, String>();
ArrayList<Airport> airports = filter.getFilteredData();
for (int index = 0; index < airports.size(); index++) {
airportsHM.put(index, airports.get(index).getName());
}
currentSession.setFilteredAirports(airportsHM);
Stage stage = (Stage) applyButton.getScene().getWindow();
stage.close();
}
public void load() {
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
}
}

@ -1,14 +1,19 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import seng202.group9.Controller.AirportFilter; import seng202.group9.Controller.AirportFilter;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Airport; import seng202.group9.Core.Airport;
import java.util.ArrayList;
import java.util.Optional;
import static javafx.collections.FXCollections.observableArrayList; import static javafx.collections.FXCollections.observableArrayList;
/** /**
@ -21,80 +26,34 @@ public class AirportRDController extends Controller{
@FXML @FXML
private TableView<Airport> tableViewAirportRD; private TableView<Airport> tableViewAirportRD;
@FXML @FXML
private TableColumn<Airport, String> airpIDcol; private TableColumn<Airport, String> airpIDCol;
@FXML
private TableColumn<Airport, String> airpNamecol;
@FXML
private TableColumn<Airport, String> airpCitycol;
@FXML
private TableColumn<Airport, String> airpCountrycol;
@FXML
private TableColumn<Airport, String> airpIATAFFAcol;
@FXML
private TableColumn<Airport, String> airpICAOcol;
@FXML
private TableColumn<Airport, String> airpLatitudecol;
@FXML
private TableColumn<Airport, String> airpLongitudecol;
@FXML
private TableColumn<Airport, String> airpAltitudecol;
@FXML
private TableColumn<Airport, String> airpTimezonecol;
@FXML
private TableColumn<Airport, String> airpDSTcol;
@FXML
private TableColumn<Airport, String> airpTzcol;
//Setting up text fields for adding data
@FXML
private TextField airpNameBox;
@FXML
private TextField airpCityBox;
@FXML
private TextField airpCountryBox;
@FXML
private TextField airpIATAFFABox;
@FXML @FXML
private TextField airpICAOBox; private TableColumn<Airport, String> airpNameCol;
@FXML @FXML
private TextField airpLatitudeBox; private TableColumn<Airport, String> airpCityCol;
@FXML @FXML
private TextField airpLongitudeBox; private TableColumn<Airport, String> airpCountryCol;
@FXML @FXML
private TextField airpAltitudeBox; private TableColumn<Airport, String> airpIATAFFACol;
@FXML @FXML
private TextField airpTimezoneBox; private TableColumn<Airport, String> airpICAOCol;
@FXML
private ComboBox<String> airpDSTCBox;
@FXML
private TextField airpTzBox;
//Setting up text fields for filtering data
@FXML @FXML
private TextField airpNameFilter; private TableColumn<Airport, String> airpLatitudeCol;
@FXML @FXML
private TextField airpCityFilter; private TableColumn<Airport, String> airpLongitudeCol;
@FXML @FXML
private TextField airpCountryFilter; private TableColumn<Airport, String> airpAltitudeCol;
@FXML @FXML
private TextField airpIATAFFAFilter; private TableColumn<Airport, String> airpTimezoneCol;
@FXML @FXML
private TextField airpICAOFilter; private TableColumn<Airport, String> airpDSTCol;
@FXML @FXML
private TextField airpLatitudeFilter; private TableColumn<Airport, String> airpTzCol;
@FXML
private TextField airpLongitudeFilter;
@FXML
private TextField airpAltitudeFilter;
@FXML
private TextField airpTimezoneFilter;
@FXML
private TextField airpDSTFilter;
@FXML
private TextField airpTzFilter;
//Set an empty Dataset to be assigned later //Set an empty Dataset to be assigned later
private Dataset theDataSet = null; private Dataset theDataSet = null;
//Set an empty session to be assigned to the current session.
private Session currentSession = null;
/** /**
* Loads the initial airport data to the GUI table. * Loads the initial airport data to the GUI table.
@ -102,69 +61,43 @@ public class AirportRDController extends Controller{
*/ */
public void load() { public void load() {
//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"));
airpCitycol.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName")); airpCityCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
airpCountrycol.setCellValueFactory(new PropertyValueFactory<Airport, String>("CountryName")); airpCountryCol.setCellValueFactory(new PropertyValueFactory<Airport, String>("CountryName"));
airpIATAFFAcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA")); airpIATAFFACol.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA"));
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(); theDataSet = getParent().getCurrentDataset();
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports())); currentSession = getParent().getSession();
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
airpDSTCBox.setValue("E");//Initializes the value for the drop-down menu for DST for adding a new Airport tableViewAirportRD.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U");
} }
/** public void openAdd() {
* Adds a single airport entry in the database. createPopUpStage(SceneCode.AIRPORT_ADD, 600, 480);
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addAirportSingle() {
//Tries to add a new airport and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addAirport(
airpNameBox.getText(),
airpCityBox.getText(),
airpCountryBox.getText(),
airpIATAFFABox.getText(),
airpICAOBox.getText(),
airpLatitudeBox.getText(),
airpLongitudeBox.getText(),
airpAltitudeBox.getText(),
airpTimezoneBox.getText(),
airpDSTCBox.getSelectionModel().getSelectedItem().toString(),
airpTzBox.getText());
airpCityBox.clear();
airpCountryBox.clear();
airpIATAFFABox.clear();
airpICAOBox.clear();
airpLatitudeBox.clear();
airpLongitudeBox.clear();
airpAltitudeBox.clear();
airpTimezoneBox.clear();
airpDSTCBox.getSelectionModel().clearSelection();
airpDSTCBox.setValue("E");
airpTzBox.clear();
tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports())); tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
} catch ( Exception e ) { }
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Airport Data Error"); public void openFilter() {
alert.setHeaderText("Error adding a custom airport entry."); createPopUpStage(SceneCode.AIRPORT_FILTER, 600, 480);
alert.setContentText(e.getMessage()); ArrayList<Airport> d = new ArrayList();
alert.showAndWait(); for(int i = 0; i < theDataSet.getAirports().size(); i++) {
if (currentSession.getFilteredAirports().containsValue(theDataSet.getAirports().get(i).getName())
&& currentSession.getFilteredAirports().containsKey(i)) {
d.add(theDataSet.getAirports().get(i));
} }
} }
tableViewAirportRD.setItems(FXCollections.observableArrayList(d));
}
/** /**
* Deletes a single selected airport entry from the database. * Deletes a single selected airport entry from the database.
@ -173,60 +106,35 @@ 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(); // Airport toDelete = tableViewAirportRD.getSelectionModel().getSelectedItem();
theDataSet.deleteAirport(toDelete); // theDataSet.deleteAirport(toDelete);
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports())); // tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
}
/** ObservableList<Airport> toDelete = tableViewAirportRD.getSelectionModel().getSelectedItems();
* Filters the airports table by any field. Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
* These are specified by what the user has typed in the filter boxes. alert.setTitle("Airport Delete Confirmation");
* Updates the GUI accordingly. alert.setHeaderText("You are about to delete some data.");
* @see AirportFilter alert.setContentText("Are you sure you want to delete the selected airport(s)?");
*/ //alert.showAndWait();
public void filterAirports() { Optional<ButtonType> result = alert.showAndWait();
//The filter function also operates like a search function Airport air = null;
AirportFilter filter = new AirportFilter(theDataSet.getAirports()); if (result.isPresent() && result.get() == ButtonType.OK) {
if (airpNameFilter.getText() != null) { for (int i = 0; i < toDelete.size(); i++) {
filter.filterName(airpNameFilter.getText()); air = toDelete.get(i);
theDataSet.deleteAirport(air);
} }
if (airpCityFilter.getText() != null) { tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
filter.filterCity(airpCityFilter.getText());
}
if (airpCountryFilter.getText() != null) {
filter.filterCountry(airpCountryFilter.getText());
}
if (airpIATAFFAFilter.getText() != null) {
filter.filterIATA_FFA(airpIATAFFAFilter.getText());
}
if (airpICAOFilter.getText() != null) {
filter.filterICAO(airpICAOFilter.getText());
}
if (airpLatitudeFilter.getText() != null) {
filter.filterLatitude(airpLatitudeFilter.getText());
}
if (airpLongitudeFilter.getText() != null) {
filter.filterLongitude(airpLongitudeFilter.getText());
}
if (airpAltitudeFilter.getText() != null) {
filter.filterAltitude(airpAltitudeFilter.getText());
}
if (airpTimezoneFilter.getText() != null) {
filter.filterTimezone(airpTimezoneFilter.getText());
}
if (airpDSTFilter.getText() != null) {
filter.filterDST(airpDSTFilter.getText());
}
if (airpTzFilter.getText() != null) {
filter.filterOlson(airpTzFilter.getText());
} }
//Sets the data according to the criteria specified by the user
tableViewAirportRD.setItems(FXCollections.<Airport>observableArrayList(filter.getFilteredData()));
} }
/** /**
* Analyses the current data and creates a graph based on the data. * Analyses the current data and creates a graph based on the data.
* @see AirportAnalyser * @see AirportAnalyser
*/ */
public void analyse_Button(){ replaceSceneContent(SceneCode.AIRPORT_ANALYSER);} public void analyse_Button(){ replaceSceneContent(SceneCode.AIRPORT_ANALYSER);}
public void airportSummaryButton() {
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
}
} }

@ -0,0 +1,79 @@
package seng202.group9.GUI;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.Dataset;
/**
* Created by Sunguin on 2016/09/23.
*/
public class RouteAddController extends Controller {
//Setting up text fields for adding data
@FXML
private TextField rAirlineAdd;
@FXML
private TextField rSourceAdd;
@FXML
private TextField rDestAdd;
@FXML
private TextField rCodeshareAdd;
@FXML
private TextField rStopsAdd;
@FXML
private TextField rEquipmentAdd;
@FXML
private Button addButton;
private Dataset theDataSet = null;
/**
* Adds a single route entry in the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addRouteSingle() {
//Tries to add a new route and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addRoute(
rAirlineAdd.getText(),
rSourceAdd.getText(),
rDestAdd.getText(),
rCodeshareAdd.getText(),
rStopsAdd.getText(),
rEquipmentAdd.getText()
);
rAirlineAdd.clear();
rSourceAdd.clear();
rDestAdd.clear();
rCodeshareAdd.clear();
rStopsAdd.clear();
rEquipmentAdd.clear();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Route Add Successful");
alert.setHeaderText("New Route added!");
alert.setContentText("Your new route has been successfully added into the database.");
alert.showAndWait();
Stage stage = (Stage) addButton.getScene().getWindow();
stage.close();
} catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Route Data Error");
alert.setHeaderText("Error adding a custom route entry.");
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}
public void load() {
theDataSet = getParent().getCurrentDataset();
}
}

@ -0,0 +1,91 @@
package seng202.group9.GUI;
import javafx.collections.FXCollections;
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.RouteFilter;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Route;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Sunguin on 2016/09/23.
*/
public class RouteFilterController extends Controller {
//Setting up text fields for filtering data
@FXML
private TextField rAirlineFilter;
@FXML
private TextField rSourceFilter;
@FXML
private TextField rDestFilter;
@FXML
private TextField rCodeshareFilter;
@FXML
private TextField rStopsFilter;
@FXML
private TextField rEquipmentFilter;
@FXML
private Button applyButton;
private Dataset theDataSet = null;
//Set an empty session to be assigned to the current session.
private Session currentSession = null;
/**
* Filters the routes table by any field.
* These are specified by what the user has typed in the filter boxes.
* Updates the GUI accordingly.
* @see RouteFilter
*/
public void filterRoutes(){
//The filter function also operates like a search function
RouteFilter filter = new RouteFilter(theDataSet.getRoutes());
if (rAirlineFilter.getText() != null) {
filter.filterAirline(rAirlineFilter.getText());
}
if (rSourceFilter.getText() != null) {
filter.filterSourceAirport(rSourceFilter.getText());
}
if (rDestFilter.getText() != null) {
filter.filterDestinationAirport(rDestFilter.getText());
}
if (rCodeshareFilter.getText() != null) {
filter.filterCodeshare(rCodeshareFilter.getText());
}
if (rStopsFilter.getText() != null) {
filter.filterDestinationStops(rStopsFilter.getText());
}
if (rEquipmentFilter.getText() != null) {
filter.filterEquipment(rEquipmentFilter.getText());
}
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Route Filter Successful");
alert.setHeaderText("Route data filtered!");
alert.setContentText("Your route data has been successfully filtered.");
alert.showAndWait();
//currentSession.setFilteredAirlines(FXCollections.observableArrayList(filter.getFilteredData()));
HashMap<Integer, String> routesHM = new HashMap<Integer, String>();
ArrayList<Route> routes = filter.getFilteredData();
for (int index = 0; index < routes.size(); index++) {
routesHM.put(index, routes.get(index).getAirlineName());
}
currentSession.setFilteredRoutes(routesHM);
Stage stage = (Stage) applyButton.getScene().getWindow();
stage.close();
}
public void load() {
theDataSet = getParent().getCurrentDataset();
currentSession = getParent().getSession();
}
}

@ -1,14 +1,19 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Controller.RouteFilter; import seng202.group9.Controller.RouteFilter;
import seng202.group9.Controller.Session;
import seng202.group9.Core.Route; import seng202.group9.Core.Route;
import java.util.ArrayList;
import java.util.Optional;
/** /**
* The GUI controller class for route_raw_data.fxml. * The GUI controller class for route_raw_data.fxml.
* Extends from the abstract class {@link Controller}. * Extends from the abstract class {@link Controller}.
@ -37,36 +42,10 @@ public class RouteRDController extends Controller {
@FXML @FXML
private TableColumn<Route, String> rEquipmentCol; private TableColumn<Route, String> rEquipmentCol;
//Setting up text fields for adding data
@FXML
private TextField rAirlineBox;
@FXML
private TextField rSourceBox;
@FXML
private TextField rDestBox;
@FXML
private ComboBox<String> rCodeshareCBox;
@FXML
private TextField rStopsBox;
@FXML
private TextField rEquipmentBox;
//Setting up text fields for filtering data
@FXML
private TextField rAirlineFilter;
@FXML
private TextField rSourceFilter;
@FXML
private TextField rDestFilter;
@FXML
private TextField rCodeshareFilter;
@FXML
private TextField rStopsFilter;
@FXML
private TextField rEquipmentFilter;
//Set an empty Dataset to be assigned later //Set an empty Dataset to be assigned later
private Dataset theDataSet = null; private Dataset theDataSet = null;
//Set an empty session to be assigned to the current session.
private Session currentSession = null;
/** /**
* Loads the initial route data to the GUI table. * Loads the initial route data to the GUI table.
@ -86,46 +65,28 @@ public class RouteRDController extends Controller {
//Assigning the Dataset to the current Dataset's routes and displaying it in a table //Assigning the Dataset to the current Dataset's routes and displaying it in a table
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes())); currentSession = getParent().getSession();
//Initializes the value for the drop-down menu for Codeshare for adding a new Route tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
rCodeshareCBox.setValue(""); tableViewRouteRD.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
rCodeshareCBox.getItems().addAll("Y", "");
} }
/** public void openAdd() {
* Adds a single route entry in the database. createPopUpStage(SceneCode.ROUTE_ADD, 600, 330);
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addRouteSingle() {
//Tries to add a new route and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data.
try {
theDataSet.addRoute(
rAirlineBox.getText(),
rSourceBox.getText(),
rDestBox.getText(),
rCodeshareCBox.getSelectionModel().getSelectedItem().toString(),
rStopsBox.getText(),
rEquipmentBox.getText()
);
rAirlineBox.clear();
rSourceBox.clear();
rDestBox.clear();
rCodeshareCBox.getSelectionModel().clearSelection();
rCodeshareCBox.setValue("");
rStopsBox.clear();
rEquipmentBox.clear();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes())); tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
} catch ( Exception e ) { }
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Route Data Error"); public void openFilter() {
alert.setHeaderText("Error adding a custom route entry."); createPopUpStage(SceneCode.ROUTE_FILTER, 600, 330);
alert.setContentText(e.getMessage()); ArrayList<Route> d = new ArrayList();
alert.showAndWait(); for(int i = 0; i < theDataSet.getRoutes().size(); i++) {
if (currentSession.getFilteredRoutes().containsValue(theDataSet.getRoutes().get(i).getAirlineName())
&& currentSession.getFilteredRoutes().containsKey(i)) {
d.add(theDataSet.getRoutes().get(i));
} }
} }
tableViewRouteRD.setItems(FXCollections.observableArrayList(d));
}
/** /**
* Deletes a single selected route entry from the database. * Deletes a single selected route entry from the database.
@ -134,42 +95,24 @@ public class RouteRDController extends Controller {
*/ */
public void deleteRoute() { public void deleteRoute() {
//Gets a route from the table and deletes it before updating the table //Gets a route from the table and deletes it before updating the table
Route toDelete = tableViewRouteRD.getSelectionModel().getSelectedItem(); ObservableList<Route> toDelete = tableViewRouteRD.getSelectionModel().getSelectedItems();
theDataSet.deleteRoute(toDelete); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes())); alert.setTitle("Route Delete Confirmation");
} alert.setHeaderText("You are about to delete some data.");
alert.setContentText("Are you sure you want to delete the selected route(s)?");
/** //alert.showAndWait();
* Filters the routes table by any field. Optional<ButtonType> result = alert.showAndWait();
* These are specified by what the user has typed in the filter boxes. Route air = null;
* Updates the GUI accordingly. if (result.isPresent() && result.get() == ButtonType.OK) {
* @see RouteFilter for (int i = 0; i < toDelete.size(); i++) {
*/ air = toDelete.get(i);
public void filterRoutes(){ theDataSet.deleteRoute(air);
//The filter function also operates like a search function
RouteFilter filter = new RouteFilter(theDataSet.getRoutes());
if (rAirlineFilter.getText() != null) {
filter.filterAirline(rAirlineFilter.getText());
}
if (rSourceFilter.getText() != null) {
filter.filterSourceAirport(rSourceFilter.getText());
}
if (rDestFilter.getText() != null) {
filter.filterDestinationAirport(rDestFilter.getText());
}
if (rCodeshareFilter.getText() != null) {
filter.filterCodeshare(rCodeshareFilter.getText());
}
if (rStopsFilter.getText() != null) {
filter.filterDestinationStops(rStopsFilter.getText());
} }
if (rEquipmentFilter.getText() != null) { tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
filter.filterEquipment(rEquipmentFilter.getText());
} }
//Sets the data according to the criteria specified by the user
tableViewRouteRD.setItems(FXCollections.<Route>observableArrayList(filter.getFilteredData()));
} }
/** /**
* Analyses the current data and creates a graph based on the data. * Analyses the current data and creates a graph based on the data.
* @see RouteAnalyser * @see RouteAnalyser
@ -177,4 +120,9 @@ public class RouteRDController extends Controller {
public void analyse_Button() { public void analyse_Button() {
replaceSceneContent(SceneCode.ROUTE_ANALYSER); replaceSceneContent(SceneCode.ROUTE_ANALYSER);
} }
public void routeSummaryButton() {
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
currentSession = getParent().getSession();
}
} }

@ -0,0 +1,85 @@
<?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.AirlineAddController">
<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="Add New 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="addButton" mnemonicParsing="false" onAction="#addAirlineSingle" text="Add Airline" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="8" />
<TextField fx:id="airlNameAdd" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="airlAliasAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="airlIATAAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="airlICAOAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="airlCallsignAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="airlCountryAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<TextField fx:id="airlActiveAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
<Label text="* = required field" GridPane.halignment="LEFT" GridPane.rowIndex="8">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin></Label>
</children>
</GridPane>

@ -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.AirlineFilterController">
<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="Search Airlines" 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="#filterAirlines" text="Apply Conditions" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="8" />
<TextField fx:id="airlNameFilter" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="airlAliasFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="airlIATAFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="airlICAOFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="airlCallsignFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="airlCountryFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<TextField fx:id="airlActiveFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
</children>
</GridPane>

@ -2,52 +2,50 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.ContextMenu?> <?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?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.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.text.Font?> <?import javafx.scene.text.Font?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirlineRDController"> <GridPane alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirlineRDController">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints maxHeight="457.0" minHeight="10.0" prefHeight="403.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="50.0" minHeight="0.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="129.0" minHeight="10.0" prefHeight="111.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="600.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowSpan="2"> <Label text="Airline Raw Data" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Airline Raw Data">
<font> <font>
<Font size="29.0" /> <Font size="36.0" />
</font> </font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Label> </Label>
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" onAction="#analyse_Button" prefHeight="25.0" prefWidth="125.0" text="Analyse" /> <TableView fx:id="tableViewAirlineRD" prefHeight="200.0" prefWidth="908.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
<Button layoutX="654.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirlineSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="14.0" layoutY="57.0" prefHeight="340.0" prefWidth="765.0">
<children>
<TableView fx:id="tableViewAirlineRD" layoutX="1.0" prefHeight="340.0" prefWidth="765.0">
<columns> <columns>
<TableColumn fx:id="airlIDcol" prefWidth="83.0" text="Airline ID" /> <TableColumn fx:id="airlIDCol" prefWidth="75.0" text="Airline ID" />
<TableColumn fx:id="airlNamecol" prefWidth="450.0" text="Name" /> <TableColumn fx:id="airlNameCol" prefWidth="400.0" text="Name" />
<TableColumn fx:id="airlAliascol" minWidth="0.0" prefWidth="56.0" text="Alias" /> <TableColumn fx:id="airlAliasCol" prefWidth="75.0" text="Alias" />
<TableColumn fx:id="airlIATAcol" minWidth="0.0" prefWidth="59.0" text="IATA" /> <TableColumn fx:id="airlIATACol" prefWidth="75.0" text="IATA" />
<TableColumn fx:id="airlICAOcol" minWidth="0.0" prefWidth="68.0" text="ICAO" /> <TableColumn fx:id="airlICAOCol" prefWidth="75.0" text="ICAO" />
<TableColumn fx:id="airlCallsigncol" minWidth="0.0" prefWidth="400.0" text="Callsign" /> <TableColumn fx:id="airlCallsignCol" prefWidth="400.0" text="Callsign" />
<TableColumn fx:id="airlCountrycol" minWidth="0.0" prefWidth="200.0" text="Country" /> <TableColumn fx:id="airlCountryCol" prefWidth="200.0" text="Country" />
<TableColumn fx:id="airlActivecol" minWidth="8.0" prefWidth="66.0" text="Active" /> <TableColumn fx:id="airlActiveCol" prefWidth="75.0" text="Active" />
</columns> </columns>
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" />
</GridPane.margin>
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
@ -56,94 +54,29 @@
</ContextMenu> </ContextMenu>
</contextMenu> </contextMenu>
</TableView> </TableView>
</children> <HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE">
</Pane>
<ScrollPane layoutX="14.0" layoutY="467.0" prefHeight="56.0" prefWidth="765.0">
<content>
<Pane prefHeight="37.0" prefWidth="1436.0">
<children> <children>
<TextField fx:id="airlNameBox" layoutX="97.0" layoutY="3.0" prefHeight="31.0" prefWidth="450.0" promptText="Name"> <Button mnemonicParsing="false" onAction="#analyse_Button" text="Analyse Airline Data">
<padding> <HBox.margin>
<Insets left="2.0" right="2.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding> </HBox.margin>
</TextField> </Button>
<TextField fx:id="airlAliasBox" layoutX="547.0" layoutY="3.0" prefHeight="31.0" prefWidth="56.0" promptText="Alias"> <Button mnemonicParsing="false" onAction="#openFilter" text="Filter Airline Data">
<padding> <HBox.margin>
<Insets left="2.0" right="2.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding> </HBox.margin>
</TextField> </Button>
<TextField fx:id="airlIATABox" layoutX="603.0" layoutY="3.0" prefHeight="31.0" prefWidth="59.0" promptText="IATA"> <Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" text="Add New Airline">
<padding> <HBox.margin>
<Insets left="2.0" right="2.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding> </HBox.margin>
</TextField> </Button>
<TextField fx:id="airlICAOBox" layoutX="662.0" layoutY="3.0" prefHeight="31.0" prefWidth="68.0" promptText="ICAO">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlCallsignBox" layoutX="730.0" layoutY="3.0" prefHeight="31.0" prefWidth="400.0" promptText="Callsign">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlCountryBox" layoutX="1130.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Country">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<Label layoutX="14.0" layoutY="6.0" prefHeight="25.0" prefWidth="84.0" text="Add Airline:" />
<ComboBox fx:id="airlActiveCBox" layoutX="1330.0" layoutY="3.0" prefHeight="31.0" prefWidth="102.0" promptText="Active" />
</children>
</Pane>
</content>
</ScrollPane>
<ScrollPane layoutX="14.0" layoutY="406.0" prefHeight="56.0" prefWidth="713.0">
<content>
<Pane prefHeight="37.0" prefWidth="1315.0">
<children>
<TextField fx:id="airlNameFilter" layoutX="57.0" layoutY="3.0" prefHeight="31.0" prefWidth="400.0" promptText="Name">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlAliasFilter" layoutX="457.0" layoutY="3.0" prefHeight="31.0" prefWidth="56.0" promptText="Alias">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlIATAFilter" layoutX="513.0" layoutY="3.0" prefHeight="31.0" prefWidth="59.0" promptText="IATA">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlICAOFilter" layoutX="572.0" layoutY="3.0" prefHeight="31.0" prefWidth="68.0" promptText="ICAO">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlCallsignFilter" layoutX="640.0" layoutY="3.0" prefHeight="31.0" prefWidth="400.0" promptText="Callsign">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlCountryFilter" layoutX="1040.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Country">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<Label layoutX="10.0" layoutY="6.0" prefHeight="25.0" prefWidth="47.0" text="Filter :" />
<TextField fx:id="airlActiveFilter" layoutX="1240.0" layoutY="3.0" prefHeight="31.0" prefWidth="66.0" promptText="Active">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
</children>
</Pane>
</content>
</ScrollPane>
<Button layoutX="733.0" layoutY="416.0" mnemonicParsing="false" onAction="#filterAirlines" prefHeight="31.0" prefWidth="40.0" text="Go" />
</children> </children>
</Pane> </HBox>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#airlineSummaryButton" text="Back to Airline 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>
</children> </children>
</GridPane> </GridPane>

@ -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.AirportAddController">
<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="Add New 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="addButton" mnemonicParsing="false" onAction="#addAirportSingle" text="Add Airport" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="12" />
<TextField fx:id="airpNameAdd" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="airpCityAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="airpCountryAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="airpIATAFAAAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="airpICAOAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="airpLatitudeAdd" 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="airpLongitudeAdd" GridPane.columnIndex="1" GridPane.rowIndex="7" />
<TextField fx:id="airpAltitudeAdd" GridPane.columnIndex="1" GridPane.rowIndex="8" />
<TextField fx:id="airpTimezoneAdd" GridPane.columnIndex="1" GridPane.rowIndex="9" />
<TextField fx:id="airpDSTAdd" GridPane.columnIndex="1" GridPane.rowIndex="10" />
<TextField fx:id="airpTzAdd" 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,109 @@
<?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.AirportFilterController">
<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="Filter Airports" 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="applyButton" mnemonicParsing="false" onAction="#filterAirports" text="Filter Airports" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="12" />
<TextField fx:id="airpNameFilter" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="airpCityFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="airpCountryFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="airpIATAFAAFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="airpICAOFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="airpLatitudeFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<TextField fx:id="airpLongitudeFilter" GridPane.columnIndex="1" GridPane.rowIndex="7" />
<TextField fx:id="airpAltitudeFilter" GridPane.columnIndex="1" GridPane.rowIndex="8" />
<TextField fx:id="airpTimezoneFilter" GridPane.columnIndex="1" GridPane.rowIndex="9" />
<TextField fx:id="airpDSTFilter" GridPane.columnIndex="1" GridPane.rowIndex="10" />
<TextField fx:id="airpTzFilter" 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.rowIndex="9">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
<Label text="DST" 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.rowIndex="11">
<GridPane.margin>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin>
</Label>
</children>
</GridPane>

@ -2,116 +2,40 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.ContextMenu?> <?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?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.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.text.Font?> <?import javafx.scene.text.Font?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirportRDController"> <GridPane alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirportRDController">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints maxHeight="457.0" minHeight="10.0" prefHeight="403.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="50.0" minHeight="0.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="129.0" minHeight="10.0" prefHeight="111.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="600.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowSpan="2"> <Label text="Airport Raw Data" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Airport Raw Data">
<font> <font>
<Font size="29.0" /> <Font size="36.0" />
</font> </font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Label> </Label>
<ScrollPane hbarPolicy="ALWAYS" layoutX="14.0" layoutY="469.0" prefHeight="54.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="764.0" vbarPolicy="NEVER"> <TableView fx:id="tableViewAirportRD" prefHeight="200.0" prefWidth="908.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
<content> <GridPane.margin>
<Pane prefHeight="39.0" prefWidth="1633.0"> <Insets bottom="15.0" left="15.0" right="15.0" />
<children> </GridPane.margin>
<TextField fx:id="airpNameBox" layoutX="89.0" layoutY="4.0" prefHeight="31.0" prefWidth="350.0" promptText="Name">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpCityBox" layoutX="439.0" layoutY="4.0" prefHeight="31.0" prefWidth="200.0" promptText="City">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpCountryBox" layoutX="639.0" layoutY="4.0" prefHeight="31.0" prefWidth="200.0" promptText="Country">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpIATAFFABox" layoutX="839.0" layoutY="4.0" prefHeight="31.0" prefWidth="75.0" promptText="IATA/FAA">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpICAOBox" layoutX="914.0" layoutY="3.0" prefHeight="31.0" prefWidth="61.0" promptText="ICAO">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpLatitudeBox" layoutX="975.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Latitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpLongitudeBox" layoutX="1074.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Longitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpAltitudeBox" layoutX="1174.0" layoutY="3.0" prefHeight="31.0" prefWidth="75.0" promptText="Altitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpTimezoneBox" layoutX="1249.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Timezone">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpTzBox" layoutX="1432.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Tz database time zone">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<Label layoutX="2.0" layoutY="7.0" prefHeight="25.0" prefWidth="87.0" text="Add Airport:" />
<ComboBox fx:id="airpDSTCBox" layoutX="1349.0" layoutY="3.0" prefHeight="31.0" prefWidth="83.0" promptText="DST" />
</children>
</Pane>
</content>
</ScrollPane>
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" onAction="#analyse_Button" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="653.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirportSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="15.0" layoutY="60.0" prefHeight="342.0" prefWidth="764.0">
<children>
<TableView fx:id="tableViewAirportRD" prefHeight="340.0" prefWidth="765.0">
<columns>
<TableColumn fx:id="airpIDcol" prefWidth="81.00003051757812" text="Airport ID" />
<TableColumn fx:id="airpNamecol" prefWidth="350.0" text="Name" />
<TableColumn fx:id="airpCitycol" minWidth="0.0" prefWidth="200.0" text="City" />
<TableColumn fx:id="airpCountrycol" minWidth="0.0" prefWidth="200.0" text="Country" />
<TableColumn fx:id="airpIATAFFAcol" minWidth="0.0" text="IATA/FAA" />
<TableColumn fx:id="airpICAOcol" minWidth="0.0" prefWidth="58.0" text="ICAO" />
<TableColumn fx:id="airpLatitudecol" minWidth="0.0" prefWidth="100.0" text="Latitude" />
<TableColumn fx:id="airpLongitudecol" minWidth="8.0" prefWidth="100.0" text="Longitude" />
<TableColumn fx:id="airpAltitudecol" minWidth="0.0" prefWidth="75.0" text="Altitude" />
<TableColumn fx:id="airpTimezonecol" minWidth="0.0" prefWidth="100.0" text="Timezone" />
<TableColumn fx:id="airpDSTcol" prefWidth="55.0" text="DST" />
<TableColumn fx:id="airpTzcol" minWidth="0.0" prefWidth="200.0" text="Tz database time zone" />
</columns>
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
@ -119,74 +43,44 @@
</items> </items>
</ContextMenu> </ContextMenu>
</contextMenu> </contextMenu>
<columns>
<TableColumn fx:id="airpIDCol" prefWidth="81.00003051757812" text="Airport ID" />
<TableColumn fx:id="airpNameCol" prefWidth="350.0" text="Name" />
<TableColumn fx:id="airpCityCol" minWidth="0.0" prefWidth="200.0" text="City" />
<TableColumn fx:id="airpCountryCol" minWidth="0.0" prefWidth="200.0" text="Country" />
<TableColumn fx:id="airpIATAFFACol" minWidth="0.0" text="IATA/FAA" />
<TableColumn fx:id="airpICAOCol" minWidth="0.0" prefWidth="58.0" text="ICAO" />
<TableColumn fx:id="airpLatitudeCol" minWidth="0.0" prefWidth="100.0" text="Latitude" />
<TableColumn fx:id="airpLongitudeCol" minWidth="8.0" prefWidth="100.0" text="Longitude" />
<TableColumn fx:id="airpAltitudeCol" minWidth="0.0" prefWidth="75.0" text="Altitude" />
<TableColumn fx:id="airpTimezoneCol" minWidth="0.0" prefWidth="100.0" text="Timezone" />
<TableColumn fx:id="airpDSTCol" prefWidth="55.0" text="DST" />
<TableColumn fx:id="airpTzCol" minWidth="0.0" prefWidth="200.0" text="Tz database time zone" />
</columns>
</TableView> </TableView>
</children></Pane> <HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE">
<ScrollPane layoutX="15.0" layoutY="408.0" prefHeight="54.0" prefWidth="713.0">
<content>
<Pane prefHeight="32.0" prefWidth="1596.0">
<children> <children>
<Label layoutX="14.0" layoutY="6.0" text="Filter :" /> <Button mnemonicParsing="false" onAction="#analyse_Button" text="Analyse Airport Data">
<TextField fx:id="airpNameFilter" layoutX="64.0" layoutY="3.0" prefHeight="31.0" prefWidth="350.0" promptText="Name"> <HBox.margin>
<padding> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
<Insets left="2.0" right="2.0" /> </HBox.margin>
</padding> </Button>
</TextField> <Button mnemonicParsing="false" onAction="#openFilter" text="Filter Airport Data">
<TextField fx:id="airpCityFilter" layoutX="414.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="City"> <HBox.margin>
<padding> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
<Insets left="2.0" right="2.0" /> </HBox.margin>
</padding> </Button>
</TextField> <Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" text="Add New Airport">
<TextField fx:id="airpCountryFilter" layoutX="614.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Country"> <HBox.margin>
<padding> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
<Insets left="2.0" right="2.0" /> </HBox.margin>
</padding> </Button>
</TextField>
<TextField fx:id="airpIATAFFAFilter" layoutX="814.0" layoutY="3.0" prefHeight="31.0" prefWidth="87.0" promptText="IATA/FAA">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpICAOFilter" layoutX="901.0" layoutY="3.0" prefHeight="31.0" prefWidth="61.0" promptText="ICAO">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpLatitudeFilter" layoutX="962.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Latitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpLongitudeFilter" layoutX="1062.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Longitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpAltitudeFilter" layoutX="1162.0" layoutY="3.0" prefHeight="31.0" prefWidth="75.0" promptText="Altitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpTimezoneFilter" layoutX="1237.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Timezone">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpTzFilter" layoutX="1395.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Tz database time zone">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpDSTFilter" layoutX="1337.0" layoutY="3.0" prefHeight="31.0" prefWidth="58.0" promptText="DST">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
</children>
</Pane>
</content>
</ScrollPane>
<Button layoutX="735.0" layoutY="420.0" mnemonicParsing="false" onAction="#filterAirports" prefHeight="31.0" prefWidth="40.0" text="Go" />
</children> </children>
</Pane> </HBox>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#airportSummaryButton" text="Back to Airport 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>
</children> </children>
</GridPane> </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.RouteAddController">
<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="Add New 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="addButton" mnemonicParsing="false" onAction="#addRouteSingle" text="Add Route" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
<TextField fx:id="rAirlineAdd" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="rSourceAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="rDestAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="rCodeshareAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="rStopsAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="rEquipmentAdd" 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>

@ -0,0 +1,74 @@
<?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.RouteFilterController">
<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="Filter Routes" 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="applyButton" mnemonicParsing="false" onAction="#filterRoutes" text="Filter Routes" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
<TextField fx:id="rAirlineFilter" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="rSourceFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="rDestFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<TextField fx:id="rCodeshareFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<TextField fx:id="rStopsFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<TextField fx:id="rEquipmentFilter" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
</children>
</GridPane>

@ -2,42 +2,47 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.ContextMenu?> <?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuItem?> <?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.Separator?>
<?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.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.text.Font?> <?import javafx.scene.text.Font?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.RouteRDController"> <GridPane alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.RouteRDController">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints maxHeight="457.0" minHeight="10.0" prefHeight="403.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="50.0" minHeight="0.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="457.0" minHeight="10.0" prefHeight="403.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="510.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowSpan="2"> <Label text="Route Raw Data" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Route Raw Data">
<font> <font>
<Font size="29.0" /> <Font size="36.0" />
</font> </font>
<GridPane.margin>
<Insets left="15.0" />
</GridPane.margin>
</Label> </Label>
<Button layoutX="14.0" layoutY="524.0" mnemonicParsing="false" onAction="#analyse_Button" prefHeight="25.0" prefWidth="125.0" text="Analyse" /> <TableView fx:id="tableViewRouteRD" prefHeight="200.0" prefWidth="908.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
<Button layoutX="656.0" layoutY="524.0" mnemonicParsing="false" onAction="#addRouteSingle" prefHeight="25.0" prefWidth="125.0" text="Add" /> <GridPane.margin>
<Pane layoutX="16.0" layoutY="53.0" prefHeight="340.0" prefWidth="765.0"> <Insets bottom="15.0" left="15.0" right="15.0" />
<children> </GridPane.margin>
<TableView fx:id="tableViewRouteRD" layoutX="-1.0" prefHeight="340.0" prefWidth="765.0"> <contextMenu>
<ContextMenu>
<items>
<MenuItem mnemonicParsing="false" onAction="#deleteRoute" text="Delete" />
</items>
</ContextMenu>
</contextMenu>
<columns> <columns>
<TableColumn fx:id="rAirlineCol" prefWidth="67.0" text="Airline" /> <TableColumn fx:id="rAirlineCol" prefWidth="67.0" text="Airline" />
<TableColumn fx:id="rAirlineIDCol" prefWidth="86.0" text="Airline ID" /> <TableColumn fx:id="rAirlineIDCol" prefWidth="86.0" text="Airline ID" />
@ -49,61 +54,30 @@
<TableColumn fx:id="rStopsCol" minWidth="0.0" prefWidth="69.0" text="Stops" /> <TableColumn fx:id="rStopsCol" minWidth="0.0" prefWidth="69.0" text="Stops" />
<TableColumn fx:id="rEquipmentCol" prefWidth="98.0" text="Equipment" /> <TableColumn fx:id="rEquipmentCol" prefWidth="98.0" text="Equipment" />
</columns> </columns>
<contextMenu>
<ContextMenu>
<items>
<MenuItem mnemonicParsing="false" onAction="#deleteRoute" text="Delete" />
</items>
</ContextMenu>
</contextMenu>
</TableView> </TableView>
</children> <HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="BASELINE">
</Pane>
<Pane layoutX="14.0" layoutY="484.0" prefHeight="32.0" prefWidth="765.0">
<children> <children>
<TextField fx:id="rAirlineBox" layoutX="90.0" layoutY="-1.0" prefHeight="31.0" prefWidth="100.0" promptText="Airline"> <Button mnemonicParsing="false" onAction="#analyse_Button" text="Analyse Route Data">
<padding> <HBox.margin>
<Insets left="2.0" right="2.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding> </HBox.margin>
</TextField> </Button>
<TextField fx:id="rSourceBox" layoutX="190.0" layoutY="-1.0" prefHeight="31.0" prefWidth="150.0" promptText="Source airport"> <Button mnemonicParsing="false" onAction="#openFilter" text="Filter Route Data">
<padding> <HBox.margin>
<Insets left="2.0" right="2.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding> </HBox.margin>
</TextField> </Button>
<TextField fx:id="rDestBox" layoutX="340.0" layoutY="-1.0" prefHeight="31.0" prefWidth="150.0" promptText="Destination airport"> <Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#openAdd" text="Add New Route">
<padding> <HBox.margin>
<Insets left="2.0" right="2.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding> </HBox.margin>
</TextField> </Button>
<TextField fx:id="rStopsBox" layoutX="590.0" layoutY="-1.0" prefHeight="31.0" prefWidth="75.0" promptText="Stops">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="rEquipmentBox" layoutX="665.0" layoutY="-1.0" prefHeight="31.0" prefWidth="100.0" promptText="Equipment">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<Label layoutX="14.0" layoutY="4.0" text="Add Route:" />
<ComboBox fx:id="rCodeshareCBox" layoutX="490.0" layoutY="-1.0" prefHeight="31.0" prefWidth="100.0" promptText="Codeshare" />
</children>
</Pane>
<Pane layoutX="14.0" layoutY="405.0" prefHeight="45.0" prefWidth="724.0">
<children>
<Label layoutX="7.0" layoutY="12.0" text="Filter :" />
<TextField fx:id="rAirlineFilter" layoutX="55.0" layoutY="7.0" prefHeight="31.0" prefWidth="100.0" promptText="Airline" />
<TextField fx:id="rSourceFilter" layoutX="155.0" layoutY="7.0" prefHeight="31.0" prefWidth="150.0" promptText="Source airport" />
<TextField fx:id="rDestFilter" layoutX="305.0" layoutY="7.0" prefHeight="31.0" prefWidth="150.0" promptText="Destination airport" />
<TextField fx:id="rCodeshareFilter" layoutX="455.0" layoutY="7.0" prefHeight="31.0" prefWidth="89.0" promptText="Codeshare" />
<TextField fx:id="rStopsFilter" layoutX="544.0" layoutY="7.0" prefHeight="31.0" prefWidth="75.0" promptText="Stops" />
<TextField fx:id="rEquipmentFilter" layoutX="619.0" layoutY="7.0" prefHeight="31.0" prefWidth="100.0" promptText="Equipment" />
</children>
</Pane>
<Separator layoutY="464.0" prefHeight="6.0" prefWidth="800.0" />
<Button layoutX="738.0" layoutY="412.0" mnemonicParsing="false" onAction="#filterRoutes" prefHeight="31.0" prefWidth="40.0" text="Go" />
</children> </children>
</Pane> </HBox>
<Button mnemonicParsing="false" nodeOrientation="LEFT_TO_RIGHT" onAction="#routeSummaryButton" text="Back to Route 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>
</children> </children>
</GridPane> </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());
} }

Loading…
Cancel
Save