Resized GUI and refactoring
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package seng202.group9.Controller;
|
||||
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import seng202.group9.Core.*;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -593,15 +591,15 @@ public class Dataset {
|
||||
" `Codeshare`, `Stops`, `Equipment`) VALUES ";
|
||||
int numOfRoutes = 0;
|
||||
for (int i = 0; i < routesToImport.size(); i ++){
|
||||
String routeIdentifier = routesToImport.get(i).getAirline() + routesToImport.get(i).departsFrom() + routesToImport.get(i).arrivesAt() +
|
||||
String routeIdentifier = routesToImport.get(i).getAirline() + routesToImport.get(i).getDepartureAirport() + routesToImport.get(i).getArrivalAirport() +
|
||||
routesToImport.get(i).getCode() + routesToImport.get(i).getStops() + routesToImport.get(i).getEquipment();
|
||||
if (routeDictionary.containsKey(routeIdentifier)){
|
||||
numOfDuplicates ++;
|
||||
}else{
|
||||
//route variables
|
||||
String routeAirline = routesToImport.get(i).getAirline().replace("\"", "\"\"");
|
||||
String routeSource = routesToImport.get(i).departsFrom().replace("\"", "\"\"");
|
||||
String routeDestination = routesToImport.get(i).arrivesAt().replace("\"", "\"\"");
|
||||
String routeSource = routesToImport.get(i).getDepartureAirport().replace("\"", "\"\"");
|
||||
String routeDestination = routesToImport.get(i).getArrivalAirport().replace("\"", "\"\"");
|
||||
String routeCode = routesToImport.get(i).getCode().replace("\"", "\"\"");
|
||||
int routeStops = routesToImport.get(i).getStops();
|
||||
String routeEquipment = routesToImport.get(i).getEquipment().replace("\"", "\"\"");
|
||||
@@ -934,10 +932,10 @@ public class Dataset {
|
||||
if (routeToAdd.getAirline().length() != 2 && routeToAdd.getAirline().length() != 3){
|
||||
throw new DataException("Airline ICAO code must be 2 or 3 letters.");
|
||||
}
|
||||
if (routeToAdd.departsFrom().length() != 3 && routeToAdd.departsFrom().length() != 4){
|
||||
if (routeToAdd.getDepartureAirport().length() != 3 && routeToAdd.getDepartureAirport().length() != 4){
|
||||
throw new DataException("Airport Source Airport IATA must be 3 letters or 4 letters if ICAO.");
|
||||
}
|
||||
if (routeToAdd.arrivesAt().length() != 3 && routeToAdd.arrivesAt().length() != 4){
|
||||
if (routeToAdd.getArrivalAirport().length() != 3 && routeToAdd.getArrivalAirport().length() != 4){
|
||||
throw new DataException("Airport Destination Airport IATA must be 3 letters or 4 letters if ICAO.");
|
||||
}
|
||||
if (routeToAdd.getCode().length() != 0 && routeToAdd.getCode().length() != 1){
|
||||
@@ -956,8 +954,8 @@ public class Dataset {
|
||||
//add the airline
|
||||
stmt = c.createStatement();
|
||||
String airline = routeToAdd.getAirline().replace("\"", "\"\"");
|
||||
String sourceAir = routeToAdd.departsFrom().replace("\"", "\"\"");
|
||||
String destAir = routeToAdd.arrivesAt().replace("\"", "\"\"");
|
||||
String sourceAir = routeToAdd.getDepartureAirport().replace("\"", "\"\"");
|
||||
String destAir = routeToAdd.getArrivalAirport().replace("\"", "\"\"");
|
||||
String equipment = routeToAdd.getEquipment().replace("\"", "\"\"");
|
||||
String insertRouteQuery = "INSERT INTO `" + this.name + "_Routes` (`Airline`, `Source_Airport`, `Destination_Airport`," +
|
||||
" `Codeshare`, `Stops`, `Equipment`) VALUES (\""+airline+"\", \""+sourceAir+"\", \""+destAir+"\", " +
|
||||
@@ -974,7 +972,7 @@ public class Dataset {
|
||||
routeToAdd.setID(routeID);
|
||||
routes.add(routeToAdd);
|
||||
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
|
||||
String routeKey = routeToAdd.getAirline() + routeToAdd.departsFrom() + routeToAdd.arrivesAt() + routeToAdd.getCode() + routeToAdd.getStops() + routeToAdd.getEquipment();
|
||||
String routeKey = routeToAdd.getAirline() + routeToAdd.getDepartureAirport() + routeToAdd.getArrivalAirport() + routeToAdd.getCode() + routeToAdd.getStops() + routeToAdd.getEquipment();
|
||||
routeDictionary.put(routeKey, routeToAdd);
|
||||
} catch ( Exception e ) {
|
||||
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
|
||||
|
||||
@@ -148,14 +148,14 @@ public class Route {
|
||||
* returns the source airport of this route
|
||||
* @return
|
||||
*/
|
||||
public String departsFrom(){
|
||||
public String getDepartureAirport(){
|
||||
return departureAirport;
|
||||
}
|
||||
/**
|
||||
* returns the target airport of this route.
|
||||
* @return
|
||||
*/
|
||||
public String arrivesAt(){
|
||||
public String getArrivalAirport(){
|
||||
return arrivalAirport;
|
||||
}
|
||||
|
||||
@@ -164,8 +164,8 @@ public class Route {
|
||||
*/
|
||||
public void hasDuplicate(Route route) throws DataException{
|
||||
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
|
||||
if (route.getAirline().equals(this.airline) && route.departsFrom().equals(this.departureAirport)
|
||||
&& route.arrivesAt().equals(this.arrivalAirport) && route.getCode().equals(this.codeShare)
|
||||
if (route.getAirline().equals(this.airline) && route.getDepartureAirport().equals(this.departureAirport)
|
||||
&& route.getArrivalAirport().equals(this.arrivalAirport) && route.getCode().equals(this.codeShare)
|
||||
&& route.getStops() == this.stops && route.getEquipment().equals(this.equipment)){
|
||||
throw new DataException("This Route already exists.");
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ public class AirlineRDController extends MenuController {
|
||||
public void loadTables() {
|
||||
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
|
||||
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
||||
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
||||
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO"));
|
||||
//Need to check IATA and ICAO
|
||||
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO"));
|
||||
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
||||
airlICAOcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
|
||||
airlCallsigncol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign"));
|
||||
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Country"));
|
||||
|
||||
@@ -141,7 +141,7 @@ public class AirportRDController extends MenuController{
|
||||
tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
|
||||
} catch ( Exception e ) {
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||
alert.setTitle("Airline Data Error");
|
||||
alert.setTitle("Airport Data Error");
|
||||
alert.setHeaderText("Error adding a custom airport entry.");
|
||||
alert.setContentText(e.getMessage());
|
||||
alert.showAndWait();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MenuController implements Initializable{
|
||||
try {
|
||||
RouteRDController summaryController = (RouteRDController) parent.replaceSceneContent("route_raw_data.fxml");
|
||||
summaryController.setApp(parent);
|
||||
//summaryController.loadTables();
|
||||
summaryController.loadTables();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,108 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import seng202.group9.Controller.App;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Core.Route;
|
||||
|
||||
/**
|
||||
* Created by Sunguin on 2016/09/14.
|
||||
*/
|
||||
public class RouteRDController extends MenuController {
|
||||
|
||||
@FXML
|
||||
private TableView<Route> tableViewRouteRD;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rAirlineCol;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rAirlineIDCol;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rSourceCol;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rSourceIDCol;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rDestCol;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rDestIDCol;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rCodeshareCol;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rStopsCol;
|
||||
@FXML
|
||||
private TableColumn<Route, String> rEquipmentCol;
|
||||
|
||||
@FXML
|
||||
private TextField rAirlineBox;
|
||||
@FXML
|
||||
private TextField rAirlineIDBox;
|
||||
@FXML
|
||||
private TextField rSourceBox;
|
||||
@FXML
|
||||
private TextField rSourceIDBox;
|
||||
@FXML
|
||||
private TextField rDestBox;
|
||||
@FXML
|
||||
private TextField rDestIDBox;
|
||||
@FXML
|
||||
private TextField rCodeshareBox;
|
||||
@FXML
|
||||
private TextField rStopsBox;
|
||||
@FXML
|
||||
private TextField rEquipmentBox;
|
||||
|
||||
|
||||
App parent;
|
||||
|
||||
public void setApp(App parent){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
public void loadTables() {
|
||||
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Airline"));
|
||||
//rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
|
||||
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
||||
//rSourceIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("SourceID"));
|
||||
rDestCol.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
|
||||
//rDestIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DestID"));
|
||||
rCodeshareCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Code"));
|
||||
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
|
||||
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
|
||||
|
||||
theDataSet = this.parent.getCurrentDataset();
|
||||
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
|
||||
}
|
||||
|
||||
public void addRouteSingle() {
|
||||
try {
|
||||
theDataSet.addRoute(
|
||||
rAirlineBox.getText(),
|
||||
rSourceBox.getText(),
|
||||
rDestBox.getText(),
|
||||
rCodeshareBox.getText(),
|
||||
rStopsBox.getText(),
|
||||
rEquipmentBox.getText()
|
||||
);
|
||||
rAirlineBox.clear();
|
||||
rSourceBox.clear();
|
||||
rDestBox.clear();
|
||||
rCodeshareBox.clear();
|
||||
rStopsBox.clear();
|
||||
rEquipmentBox.clear();
|
||||
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.shape.Rectangle?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.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 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 hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
@@ -23,18 +22,18 @@
|
||||
<RowConstraints maxHeight="129.0" minHeight="10.0" prefHeight="111.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Pane prefHeight="410.0" prefWidth="773.0" GridPane.columnSpan="2">
|
||||
<Pane prefHeight="600.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowSpan="2">
|
||||
<children>
|
||||
<Label layoutX="14.0" layoutY="14.0" text="Airline Raw Data">
|
||||
<font>
|
||||
<Font size="29.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Button layoutX="10.0" layoutY="420.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
|
||||
<Button layoutX="661.0" layoutY="420.0" mnemonicParsing="false" onAction="#addAirlineSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
|
||||
<Pane layoutX="23.0" layoutY="60.0" prefHeight="309.0" prefWidth="757.0">
|
||||
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
|
||||
<Button layoutX="654.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirlineSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
|
||||
<Pane layoutX="14.0" layoutY="57.0" prefHeight="403.0" prefWidth="765.0">
|
||||
<children>
|
||||
<TableView fx:id="tableView" layoutX="1.0" prefHeight="309.0" prefWidth="755.0">
|
||||
<TableView fx:id="tableView" layoutX="1.0" prefHeight="403.0" prefWidth="765.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="airlIDcol" prefWidth="83.0" text="Airline ID" />
|
||||
<TableColumn fx:id="airlNamecol" prefWidth="137.0" text="Name" />
|
||||
@@ -42,45 +41,45 @@
|
||||
<TableColumn fx:id="airlIATAcol" minWidth="0.0" prefWidth="69.0" text="IATA" />
|
||||
<TableColumn fx:id="airlICAOcol" minWidth="0.0" prefWidth="67.0" text="ICAO" />
|
||||
<TableColumn fx:id="airlCallsigncol" minWidth="0.0" prefWidth="93.0" text="Callsign" />
|
||||
<TableColumn fx:id="airlCountrycol" minWidth="0.0" prefWidth="84.0" text="Country" />
|
||||
<TableColumn fx:id="airlActivecol" minWidth="8.0" prefWidth="92.0" text="Active" />
|
||||
<TableColumn fx:id="airlCountrycol" minWidth="0.0" prefWidth="102.0" text="Country" />
|
||||
<TableColumn fx:id="airlActivecol" minWidth="8.0" prefWidth="84.0" text="Active" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane layoutX="23.0" layoutY="379.0" prefHeight="31.0" prefWidth="757.0">
|
||||
<Pane layoutX="14.0" layoutY="483.0" prefHeight="31.0" prefWidth="765.0">
|
||||
<children>
|
||||
<TextField fx:id="airlNameBox" layoutX="92.0" layoutY="2.0" prefHeight="25.0" prefWidth="137.0" promptText="Name">
|
||||
<TextField fx:id="airlNameBox" layoutX="97.0" layoutY="2.0" prefHeight="25.0" prefWidth="137.0" promptText="Name">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="airlAliasBox" layoutX="229.0" layoutY="2.0" prefHeight="25.0" prefWidth="125.0" promptText="Alias">
|
||||
<TextField fx:id="airlAliasBox" layoutX="234.0" layoutY="2.0" prefHeight="25.0" prefWidth="125.0" promptText="Alias">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="airlIATABox" layoutX="354.0" layoutY="2.0" prefHeight="25.0" prefWidth="67.0" promptText="IATA">
|
||||
<TextField fx:id="airlIATABox" layoutX="359.0" layoutY="2.0" prefHeight="25.0" prefWidth="67.0" promptText="IATA">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="airlICAOBox" layoutX="421.0" layoutY="2.0" prefHeight="25.0" prefWidth="69.0" promptText="ICAO">
|
||||
<TextField fx:id="airlICAOBox" layoutX="426.0" layoutY="2.0" prefHeight="25.0" prefWidth="69.0" promptText="ICAO">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="airlCallsignBox" layoutX="490.0" layoutY="2.0" prefHeight="25.0" prefWidth="87.0" promptText="Callsign">
|
||||
<TextField fx:id="airlCallsignBox" layoutX="495.0" layoutY="2.0" prefHeight="25.0" prefWidth="84.0" promptText="Callsign">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="airlCountryBox" layoutX="577.0" layoutY="2.0" prefHeight="25.0" prefWidth="87.0" promptText="Country">
|
||||
<TextField fx:id="airlCountryBox" layoutX="579.0" layoutY="2.0" prefHeight="25.0" prefWidth="102.0" promptText="Country">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="airlActiveBox" layoutX="664.0" layoutY="2.0" prefHeight="25.0" prefWidth="93.0" promptText="Active">
|
||||
<TextField fx:id="airlActiveBox" layoutX="681.0" layoutY="2.0" prefHeight="25.0" prefWidth="84.0" promptText="Active">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
@@ -90,10 +89,5 @@
|
||||
</Pane>
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane prefHeight="114.0" prefWidth="202.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
|
||||
<children>
|
||||
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="145.0" stroke="BLACK" strokeType="INSIDE" width="800.0" />
|
||||
</children>
|
||||
</Pane>
|
||||
</children>
|
||||
</GridPane>
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.shape.Rectangle?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.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">
|
||||
<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.AirportRDController">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
@@ -24,14 +23,14 @@
|
||||
<RowConstraints maxHeight="129.0" minHeight="10.0" prefHeight="111.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Pane prefHeight="141.0" prefWidth="600.0" GridPane.columnSpan="2">
|
||||
<Pane prefHeight="600.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowSpan="2">
|
||||
<children>
|
||||
<Label layoutX="14.0" layoutY="14.0" text="Airport Raw Data">
|
||||
<font>
|
||||
<Font size="29.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<ScrollPane hbarPolicy="ALWAYS" layoutX="14.0" layoutY="364.0" prefHeight="47.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="770.0" vbarPolicy="NEVER">
|
||||
<ScrollPane hbarPolicy="ALWAYS" layoutX="14.0" layoutY="474.0" prefHeight="47.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="772.0" vbarPolicy="NEVER">
|
||||
<content>
|
||||
<Pane prefHeight="29.0" prefWidth="1219.0">
|
||||
<children>
|
||||
@@ -95,11 +94,11 @@
|
||||
</Pane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<Button layoutX="10.0" layoutY="420.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
|
||||
<Button layoutX="661.0" layoutY="420.0" mnemonicParsing="false" onAction="#addAirportSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
|
||||
<Pane layoutX="15.0" layoutY="60.0" prefHeight="295.0" prefWidth="772.0">
|
||||
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
|
||||
<Button layoutX="662.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirportSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
|
||||
<Pane layoutX="15.0" layoutY="60.0" prefHeight="403.0" prefWidth="772.0">
|
||||
<children>
|
||||
<TableView fx:id="tableViewAirportRD" prefHeight="293.0" prefWidth="770.0">
|
||||
<TableView fx:id="tableViewAirportRD" prefHeight="403.0" prefWidth="772.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="airpIDcol" prefWidth="83.0" text="Airport ID" />
|
||||
<TableColumn fx:id="airpNamecol" prefWidth="137.0" text="Name" />
|
||||
@@ -118,10 +117,5 @@
|
||||
</children></Pane>
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane prefHeight="153.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
|
||||
<children>
|
||||
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="142.0" layoutY="1.0" stroke="BLACK" strokeType="INSIDE" width="800.0" />
|
||||
</children>
|
||||
</Pane>
|
||||
</children>
|
||||
</GridPane>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
<?import javafx.scene.control.TableView?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
@@ -11,84 +10,30 @@
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.shape.Rectangle?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.RouteRDController">
|
||||
<GridPane 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 hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="457.0" minHeight="10.0" prefHeight="403.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="129.0" minHeight="10.0" prefHeight="111.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="457.0" minHeight="10.0" prefHeight="403.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Pane prefHeight="141.0" prefWidth="306.0" GridPane.columnSpan="2">
|
||||
<Pane prefHeight="510.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowSpan="2">
|
||||
<children>
|
||||
<Label layoutX="14.0" layoutY="14.0" text="Route Raw Data">
|
||||
<font>
|
||||
<Font size="29.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<ScrollPane hbarPolicy="ALWAYS" layoutX="10.0" layoutY="364.0" prefHeight="47.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="776.0" vbarPolicy="NEVER">
|
||||
<content>
|
||||
<Pane prefHeight="49.0" prefWidth="1021.0">
|
||||
<Button layoutX="14.0" layoutY="524.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
|
||||
<Button layoutX="656.0" layoutY="524.0" mnemonicParsing="false" onAction="#addRouteSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
|
||||
<Pane layoutX="16.0" layoutY="53.0" prefHeight="403.0" prefWidth="765.0">
|
||||
<children>
|
||||
<TextField layoutX="6.0" layoutY="2.0" prefHeight="25.0" prefWidth="60.0" promptText="Airline">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField layoutX="66.0" layoutY="2.0" prefHeight="25.0" prefWidth="85.0" promptText="Airline ID">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField layoutX="151.0" layoutY="2.0" prefHeight="25.0" prefWidth="125.0" promptText="Source airport">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField layoutX="276.0" layoutY="2.0" prefHeight="25.0" prefWidth="142.0" promptText="Source airport ID">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField layoutX="418.0" layoutY="2.0" prefHeight="25.0" prefWidth="154.0" promptText="Destination airport">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField layoutX="572.0" layoutY="2.0" prefHeight="25.0" prefWidth="187.0" promptText="Destination airport ID">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="rCodeshareCol" layoutX="758.0" layoutY="2.0" prefHeight="25.0" prefWidth="99.0" promptText="Codeshare">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="rStopsCol" layoutX="857.0" layoutY="2.0" prefHeight="25.0" prefWidth="65.0" promptText="Stops">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="rEquipmentCol" layoutX="922.0" layoutY="2.0" prefHeight="25.0" prefWidth="98.0" promptText="Equipment">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
</children>
|
||||
</Pane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<Button layoutX="10.0" layoutY="420.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
|
||||
<Button layoutX="661.0" layoutY="420.0" mnemonicParsing="false" onAction="#addRouteSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
|
||||
<Pane layoutX="8.0" layoutY="53.0" prefHeight="300.0" prefWidth="776.0">
|
||||
<children>
|
||||
<TableView fx:id="tableViewRouteRD" layoutX="-1.0" prefHeight="300.0" prefWidth="784.0">
|
||||
<TableView fx:id="tableViewRouteRD" layoutX="-1.0" prefHeight="403.0" prefWidth="765.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="rAirlineCol" prefWidth="67.0" text="Airline" />
|
||||
<TableColumn fx:id="rAirlineIDCol" prefWidth="86.0" text="Airline ID" />
|
||||
@@ -96,18 +41,48 @@
|
||||
<TableColumn fx:id="rSourceIDCol" minWidth="0.0" prefWidth="141.0" text="Source airport ID" />
|
||||
<TableColumn fx:id="rDestCol" minWidth="0.0" prefWidth="160.0" text="Destination airport" />
|
||||
<TableColumn fx:id="rDestIDCol" minWidth="0.0" prefWidth="184.0" text="Destination airport ID" />
|
||||
<TableColumn minWidth="0.0" prefWidth="95.0" text="Codeshare" />
|
||||
<TableColumn minWidth="0.0" prefWidth="69.0" text="Stops" />
|
||||
<TableColumn prefWidth="98.0" text="Equipment" />
|
||||
<TableColumn fx:id="rCodeshareCol" minWidth="0.0" prefWidth="95.0" text="Codeshare" />
|
||||
<TableColumn fx:id="rStopsCol" minWidth="0.0" prefWidth="69.0" text="Stops" />
|
||||
<TableColumn fx:id="rEquipmentCol" prefWidth="98.0" text="Equipment" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane layoutX="16.0" layoutY="479.0" prefHeight="32.0" prefWidth="765.0">
|
||||
<children>
|
||||
<TextField fx:id="rAirlineBox" layoutX="90.0" layoutY="2.0" prefHeight="25.0" prefWidth="100.0" promptText="Airline">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="rSourceBox" layoutX="190.0" layoutY="2.0" prefHeight="25.0" prefWidth="150.0" promptText="Source airport">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="rDestBox" layoutX="340.0" layoutY="2.0" prefHeight="25.0" prefWidth="150.0" promptText="Destination airport">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="rCodeshareBox" layoutX="490.0" layoutY="2.0" prefHeight="25.0" prefWidth="100.0" promptText="Codeshare">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="rStopsBox" layoutX="590.0" layoutY="2.0" prefHeight="25.0" prefWidth="75.0" promptText="Stops">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<TextField fx:id="rEquipmentBox" layoutX="665.0" layoutY="2.0" prefHeight="25.0" prefWidth="100.0" promptText="Equipment">
|
||||
<padding>
|
||||
<Insets left="2.0" right="2.0" />
|
||||
</padding>
|
||||
</TextField>
|
||||
<Label layoutY="4.0" text="Enter Values:" />
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane prefHeight="114.0" prefWidth="202.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
|
||||
<children>
|
||||
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="144.0" layoutY="1.0" stroke="BLACK" strokeType="INSIDE" width="800.0" />
|
||||
</children>
|
||||
</Pane>
|
||||
</children>
|
||||
|
||||
@@ -90,31 +90,31 @@ public class AirportUnitTest {
|
||||
heathrow.addArrivalRoutes(route1);
|
||||
heathrow.addArrivalRoutes(routes);
|
||||
|
||||
assertEquals(heathrow.getArrivalRoutes().get(0).arrivesAt(), "LHR1");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(1).arrivesAt(), "LHR1");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(2).arrivesAt(), "LHR2");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(3).arrivesAt(), "LHR3");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(0).getArrivalAirport(), "LHR1");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(1).getArrivalAirport(), "LHR1");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(2).getArrivalAirport(), "LHR2");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(3).getArrivalAirport(), "LHR3");
|
||||
|
||||
//check add departrue routes;
|
||||
heathrow.addDepartureRoutes(route1);
|
||||
heathrow.addDepartureRoutes(routes);
|
||||
|
||||
assertEquals(heathrow.getDepartureRoutes().get(0).departsFrom(), "SIN1");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(1).departsFrom(), "SIN1");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(2).departsFrom(), "SIN2");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(3).departsFrom(), "SIN3");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(0).getDepartureAirport(), "SIN1");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(1).getDepartureAirport(), "SIN1");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(2).getDepartureAirport(), "SIN2");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(3).getDepartureAirport(), "SIN3");
|
||||
|
||||
//check set
|
||||
heathrow.setArrivalRoutes(routes);
|
||||
heathrow.setDepartureRoutes(routes);
|
||||
//Arrival check
|
||||
assertEquals(heathrow.getArrivalRoutes().get(0).arrivesAt(), "LHR1");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(1).arrivesAt(), "LHR2");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(2).arrivesAt(), "LHR3");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(0).getArrivalAirport(), "LHR1");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(1).getArrivalAirport(), "LHR2");
|
||||
assertEquals(heathrow.getArrivalRoutes().get(2).getArrivalAirport(), "LHR3");
|
||||
//departure check
|
||||
assertEquals(heathrow.getDepartureRoutes().get(0).departsFrom(), "SIN1");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(1).departsFrom(), "SIN2");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(2).departsFrom(), "SIN3");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(0).getDepartureAirport(), "SIN1");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(1).getDepartureAirport(), "SIN2");
|
||||
assertEquals(heathrow.getDepartureRoutes().get(2).getDepartureAirport(), "SIN3");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -28,8 +28,8 @@ public class RouteTest extends TestCase {
|
||||
//test getters
|
||||
//////////////
|
||||
assertEquals(route.getAirline(), "BA");
|
||||
assertEquals(route.departsFrom(), "SIN");
|
||||
assertEquals(route.arrivesAt(), "LHR");
|
||||
assertEquals(route.getDepartureAirport(), "SIN");
|
||||
assertEquals(route.getArrivalAirport(), "LHR");
|
||||
assertEquals(route.getCode(), "");
|
||||
assertEquals(route.getEquipment(), "744 777");
|
||||
///////////////
|
||||
@@ -43,8 +43,8 @@ public class RouteTest extends TestCase {
|
||||
route.setEquipment("747 840");
|
||||
|
||||
assertEquals(route.getAirline(), "BAH");
|
||||
assertEquals(route.departsFrom(), "SING-SONG");
|
||||
assertEquals(route.arrivesAt(), "LEFT-HAND-RULE");
|
||||
assertEquals(route.getDepartureAirport(), "SING-SONG");
|
||||
assertEquals(route.getArrivalAirport(), "LEFT-HAND-RULE");
|
||||
assertEquals(route.getCode(), "Y");
|
||||
assertEquals(route.getEquipment(), "747 840");
|
||||
////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user