Added javadoc for airline, airport and route raw data controller classes.

main
Sunguin Peng 9 years ago
parent 724f63956a
commit b2cba96dc1

Binary file not shown.

@ -9,6 +9,8 @@ import seng202.group9.Controller.Dataset;
import seng202.group9.Core.Airline; import seng202.group9.Core.Airline;
/** /**
* The GUI controller class for airline_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/13. * Created by Sunguin on 2016/09/13.
*/ */
public class AirlineRDController extends Controller { public class AirlineRDController extends Controller {
@ -64,6 +66,32 @@ public class AirlineRDController extends Controller {
private Dataset theDataSet = null; private Dataset theDataSet = null;
/**
* Loads the initial airline data to the GUI table.
* Also sets up the dropdown menu options.
*/
public void load() {
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
airlICAOcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO"));
airlCallsigncol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign"));
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
theDataSet = getParent().getCurrentDataset();
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
airlActiveCBox.setValue("Y");
airlActiveCBox.getItems().addAll("Y", "N");
}
/**
* Adds a single airline entry to the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addAirlineSingle() { public void addAirlineSingle() {
try { try {
theDataSet.addAirline( theDataSet.addAirline(
@ -92,29 +120,23 @@ public class AirlineRDController extends Controller {
} }
} }
public void load() { /**
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID")); * Deletes a single selected airline entry from the database.
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name")); * Updates the GUI accordingly.
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias")); * @see Dataset
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA")); */
airlICAOcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO"));
airlCallsigncol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign"));
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
theDataSet = getParent().getCurrentDataset();
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
airlActiveCBox.setValue("Y");
airlActiveCBox.getItems().addAll("Y", "N");
}
public void deleteAirline() { public void deleteAirline() {
Airline toDelete = tableViewAirlineRD.getSelectionModel().getSelectedItem(); Airline toDelete = tableViewAirlineRD.getSelectionModel().getSelectedItem();
theDataSet.deleteAirline(toDelete); theDataSet.deleteAirline(toDelete);
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines())); 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() { public void filterAirlines() {
AirlineFilter filter = new AirlineFilter(theDataSet.getAirlines()); AirlineFilter filter = new AirlineFilter(theDataSet.getAirlines());
if (airlNameFilter.getText() != null) { if (airlNameFilter.getText() != null) {

@ -12,6 +12,8 @@ import seng202.group9.Core.Airport;
import static javafx.collections.FXCollections.observableArrayList; import static javafx.collections.FXCollections.observableArrayList;
/** /**
* The GUI controller class for airport_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/13. * Created by Sunguin on 2016/09/13.
*/ */
public class AirportRDController extends Controller{ public class AirportRDController extends Controller{
@ -91,6 +93,10 @@ public class AirportRDController extends Controller{
private Dataset theDataSet = null; private Dataset theDataSet = null;
/**
* Loads the initial airport data to the GUI table.
* Also sets up the dropdown menu options.
*/
public void load() { public void load() {
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"));
@ -112,6 +118,11 @@ public class AirportRDController extends Controller{
airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U"); airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U");
} }
/**
* Adds a single airport entry in the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addAirportSingle() { public void addAirportSingle() {
try { try {
theDataSet.addAirport( theDataSet.addAirport(
@ -146,16 +157,28 @@ public class AirportRDController extends Controller{
alert.showAndWait(); alert.showAndWait();
} }
} }
public void airportAnalyserButton() { public void airportAnalyserButton() {
replaceSceneContent(SceneCode.AIRPORT_ANALYSER); replaceSceneContent(SceneCode.AIRPORT_ANALYSER);
} }
/**
* Deletes a single selected airport entry from the database.
* Updates the GUI accordingly.
* @see Dataset
*/
public void deleteAirport(){ public void deleteAirport(){
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()));
} }
/**
* 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() { public void filterAirports() {
AirportFilter filter = new AirportFilter(theDataSet.getAirports()); AirportFilter filter = new AirportFilter(theDataSet.getAirports());
if (airpNameFilter.getText() != null) { if (airpNameFilter.getText() != null) {

@ -4,14 +4,14 @@ import javafx.collections.FXCollections;
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.DataException;
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.Core.Route; import seng202.group9.Core.Route;
/** /**
* Controller class for the Routes Raw Data scene. * The GUI controller class for route_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/14. * Created by Sunguin on 2016/09/14.
*/ */
public class RouteRDController extends Controller { public class RouteRDController extends Controller {
@ -66,8 +66,31 @@ public class RouteRDController extends Controller {
private Dataset theDataSet = null; private Dataset theDataSet = null;
/** /**
* Adds a single route to the Route database. * Loads the initial route data to the GUI table.
* Takes in values written from the GUI. * Also sets up the dropdown menu options.
*/
public void load() {
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
rSourceIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("SourceID"));
rDestCol.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
rDestIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DestID"));
rCodeshareCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Code"));
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
theDataSet = getParent().getCurrentDataset();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
rCodeshareCBox.setValue("");
rCodeshareCBox.getItems().addAll("Y", "");
}
/**
* Adds a single route entry in the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/ */
public void addRouteSingle() { public void addRouteSingle() {
try { try {
@ -96,31 +119,23 @@ public class RouteRDController extends Controller {
} }
} }
public void load() { /**
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName")); * Deletes a single selected route entry from the database.
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID")); * Updates the GUI accordingly.
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport")); * @see Dataset
rSourceIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("SourceID")); */
rDestCol.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
rDestIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DestID"));
rCodeshareCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Code"));
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
theDataSet = getParent().getCurrentDataset();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
rCodeshareCBox.setValue("");
rCodeshareCBox.getItems().addAll("Y", "");
}
public void deleteRoute(){ public void deleteRoute(){
Route toDelete = tableViewRouteRD.getSelectionModel().getSelectedItem(); Route toDelete = tableViewRouteRD.getSelectionModel().getSelectedItem();
theDataSet.deleteRoute(toDelete); theDataSet.deleteRoute(toDelete);
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes())); tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
} }
/**
* 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(){ public void filterRoutes(){
RouteFilter filter = new RouteFilter(theDataSet.getRoutes()); RouteFilter filter = new RouteFilter(theDataSet.getRoutes());
if (rAirlineFilter.getText() != null) { if (rAirlineFilter.getText() != null) {

Loading…
Cancel
Save