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;
/**
* The GUI controller class for airline_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/13.
*/
public class AirlineRDController extends Controller {
@ -64,6 +66,32 @@ public class AirlineRDController extends Controller {
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() {
try {
theDataSet.addAirline(
@ -92,29 +120,23 @@ public class AirlineRDController extends Controller {
}
}
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");
}
/**
* Deletes a single selected airline entry from the database.
* Updates the GUI accordingly.
* @see Dataset
*/
public void deleteAirline() {
Airline toDelete = tableViewAirlineRD.getSelectionModel().getSelectedItem();
theDataSet.deleteAirline(toDelete);
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() {
AirlineFilter filter = new AirlineFilter(theDataSet.getAirlines());
if (airlNameFilter.getText() != null) {

@ -12,6 +12,8 @@ import seng202.group9.Core.Airport;
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.
*/
public class AirportRDController extends Controller{
@ -91,6 +93,10 @@ public class AirportRDController extends Controller{
private Dataset theDataSet = null;
/**
* Loads the initial airport data to the GUI table.
* Also sets up the dropdown menu options.
*/
public void load() {
airpIDcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ID"));
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");
}
/**
* Adds a single airport entry in the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addAirportSingle() {
try {
theDataSet.addAirport(
@ -146,16 +157,28 @@ public class AirportRDController extends Controller{
alert.showAndWait();
}
}
public void airportAnalyserButton() {
replaceSceneContent(SceneCode.AIRPORT_ANALYSER);
}
/**
* Deletes a single selected airport entry from the database.
* Updates the GUI accordingly.
* @see Dataset
*/
public void deleteAirport(){
Airport toDelete = tableViewAirportRD.getSelectionModel().getSelectedItem();
theDataSet.deleteAirport(toDelete);
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() {
AirportFilter filter = new AirportFilter(theDataSet.getAirports());
if (airpNameFilter.getText() != null) {

@ -4,14 +4,14 @@ import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode;
import seng202.group9.Controller.RouteFilter;
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.
*/
public class RouteRDController extends Controller {
@ -66,8 +66,31 @@ public class RouteRDController extends Controller {
private Dataset theDataSet = null;
/**
* Adds a single route to the Route database.
* Takes in values written from the GUI.
* Loads the initial route data to the GUI table.
* 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() {
try {
@ -96,31 +119,23 @@ public class RouteRDController extends Controller {
}
}
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", "");
}
/**
* Deletes a single selected route entry from the database.
* Updates the GUI accordingly.
* @see Dataset
*/
public void deleteRoute(){
Route toDelete = tableViewRouteRD.getSelectionModel().getSelectedItem();
theDataSet.deleteRoute(toDelete);
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(){
RouteFilter filter = new RouteFilter(theDataSet.getRoutes());
if (rAirlineFilter.getText() != null) {

Loading…
Cancel
Save