Updated Javadoc and made a popup for not yet implemented button
This commit is contained in:
@@ -8,13 +8,15 @@ import seng202.group9.Controller.AirlineFilter;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Core.Airline;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public class AirlineRDController extends Controller {
|
||||
|
||||
//Setting up the table from the FXML file
|
||||
@FXML
|
||||
private TableView<Airline> tableViewAirlineRD;
|
||||
@FXML
|
||||
@@ -34,6 +36,7 @@ public class AirlineRDController extends Controller {
|
||||
@FXML
|
||||
private TableColumn<Airline, String> airlActivecol;
|
||||
|
||||
//Setting up text fields for adding data
|
||||
@FXML
|
||||
private TextField airlNameBox;
|
||||
@FXML
|
||||
@@ -49,6 +52,7 @@ public class AirlineRDController extends Controller {
|
||||
@FXML
|
||||
private ComboBox<String> airlActiveCBox;
|
||||
|
||||
//Setting up text fields for filtering data
|
||||
@FXML
|
||||
private TextField airlNameFilter;
|
||||
@FXML
|
||||
@@ -64,6 +68,7 @@ public class AirlineRDController extends Controller {
|
||||
@FXML
|
||||
private TextField airlActiveFilter;
|
||||
|
||||
//Set an empty Dataset to be assigned later.
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
/**
|
||||
@@ -71,6 +76,7 @@ public class AirlineRDController extends Controller {
|
||||
* Also sets up the dropdown menu options.
|
||||
*/
|
||||
public void load() {
|
||||
//Sets up the table columns to be ready for use for Airline data
|
||||
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
|
||||
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
||||
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
||||
@@ -80,9 +86,11 @@ public class AirlineRDController extends Controller {
|
||||
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
|
||||
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
||||
|
||||
//Assigning the Dataset to the current Dataset's airlines and displaying it in a table
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
|
||||
|
||||
//Initializes the value for the drop-down menu for Active for adding a new Airline
|
||||
airlActiveCBox.setValue("Y");
|
||||
airlActiveCBox.getItems().addAll("Y", "N");
|
||||
}
|
||||
@@ -93,6 +101,8 @@ public class AirlineRDController extends Controller {
|
||||
* @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(
|
||||
airlNameBox.getText(),
|
||||
@@ -126,6 +136,7 @@ public class AirlineRDController extends Controller {
|
||||
* @see Dataset
|
||||
*/
|
||||
public void deleteAirline() {
|
||||
//Gets an airline from the table and deletes it before updating the table
|
||||
Airline toDelete = tableViewAirlineRD.getSelectionModel().getSelectedItem();
|
||||
theDataSet.deleteAirline(toDelete);
|
||||
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
|
||||
@@ -138,6 +149,7 @@ public class AirlineRDController extends Controller {
|
||||
* @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());
|
||||
@@ -160,6 +172,15 @@ public class AirlineRDController extends Controller {
|
||||
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.
|
||||
* Currently not implemented yet.
|
||||
*/
|
||||
public void analyse_Button() {
|
||||
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ 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
|
||||
*/
|
||||
public class AirportRDController extends Controller{
|
||||
|
||||
//Setting up the table from the FXML file
|
||||
@FXML
|
||||
private TableView<Airport> tableViewAirportRD;
|
||||
@FXML
|
||||
@@ -45,6 +45,7 @@ public class AirportRDController extends Controller{
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpTzcol;
|
||||
|
||||
//Setting up text fields for adding data
|
||||
@FXML
|
||||
private TextField airpNameBox;
|
||||
@FXML
|
||||
@@ -68,6 +69,7 @@ public class AirportRDController extends Controller{
|
||||
@FXML
|
||||
private TextField airpTzBox;
|
||||
|
||||
//Setting up text fields for filtering data
|
||||
@FXML
|
||||
private TextField airpNameFilter;
|
||||
@FXML
|
||||
@@ -91,6 +93,7 @@ public class AirportRDController extends Controller{
|
||||
@FXML
|
||||
private TextField airpTzFilter;
|
||||
|
||||
//Set an empty Dataset to be assigned later
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
/**
|
||||
@@ -98,6 +101,7 @@ public class AirportRDController extends Controller{
|
||||
* Also sets up the dropdown menu options.
|
||||
*/
|
||||
public void load() {
|
||||
//Sets up the table columns to be ready for use for Airport data
|
||||
airpIDcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ID"));
|
||||
airpNamecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
||||
airpCitycol.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
|
||||
@@ -111,10 +115,12 @@ public class AirportRDController extends Controller{
|
||||
airpDSTcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("DST"));
|
||||
airpTzcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Tz"));
|
||||
|
||||
//Assigning the Dataset to the current Dataset's airports and displaying it in a table
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
|
||||
|
||||
airpDSTCBox.setValue("E");
|
||||
|
||||
airpDSTCBox.setValue("E");//Initializes the value for the drop-down menu for DST for adding a new Airport
|
||||
airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U");
|
||||
}
|
||||
|
||||
@@ -124,6 +130,8 @@ public class AirportRDController extends Controller{
|
||||
* @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(),
|
||||
@@ -158,16 +166,13 @@ public class AirportRDController extends Controller{
|
||||
}
|
||||
}
|
||||
|
||||
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(){
|
||||
//Gets an airport from the table and deletes it before updating the table
|
||||
Airport toDelete = tableViewAirportRD.getSelectionModel().getSelectedItem();
|
||||
theDataSet.deleteAirport(toDelete);
|
||||
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
|
||||
@@ -180,6 +185,7 @@ public class AirportRDController extends Controller{
|
||||
* @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());
|
||||
@@ -214,7 +220,13 @@ public class AirportRDController extends Controller{
|
||||
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.
|
||||
* @see AirportAnalyser
|
||||
*/
|
||||
public void analyse_Button(){ replaceSceneContent(SceneCode.AIRPORT_ANALYSER);}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ import seng202.group9.Core.Route;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public class RouteRDController extends Controller {
|
||||
|
||||
//Setting up the table from the FXML file
|
||||
@FXML
|
||||
private TableView<Route> tableViewRouteRD;
|
||||
@FXML
|
||||
@@ -37,6 +37,7 @@ public class RouteRDController extends Controller {
|
||||
@FXML
|
||||
private TableColumn<Route, String> rEquipmentCol;
|
||||
|
||||
//Setting up text fields for adding data
|
||||
@FXML
|
||||
private TextField rAirlineBox;
|
||||
@FXML
|
||||
@@ -50,6 +51,7 @@ public class RouteRDController extends Controller {
|
||||
@FXML
|
||||
private TextField rEquipmentBox;
|
||||
|
||||
//Setting up text fields for filtering data
|
||||
@FXML
|
||||
private TextField rAirlineFilter;
|
||||
@FXML
|
||||
@@ -63,6 +65,7 @@ public class RouteRDController extends Controller {
|
||||
@FXML
|
||||
private TextField rEquipmentFilter;
|
||||
|
||||
//Set an empty Dataset to be assigned later
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
/**
|
||||
@@ -70,6 +73,7 @@ public class RouteRDController extends Controller {
|
||||
* Also sets up the dropdown menu options.
|
||||
*/
|
||||
public void load() {
|
||||
//Sets up the table columns to be ready for use for Route data
|
||||
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
|
||||
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
|
||||
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
||||
@@ -80,9 +84,11 @@ public class RouteRDController extends Controller {
|
||||
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
|
||||
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
|
||||
|
||||
//Assigning the Dataset to the current Dataset's routes and displaying it in a table
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
|
||||
|
||||
//Initializes the value for the drop-down menu for Codeshare for adding a new Route
|
||||
rCodeshareCBox.setValue("");
|
||||
rCodeshareCBox.getItems().addAll("Y", "");
|
||||
}
|
||||
@@ -93,6 +99,8 @@ public class RouteRDController extends Controller {
|
||||
* @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(),
|
||||
@@ -125,6 +133,7 @@ public class RouteRDController extends Controller {
|
||||
* @see Dataset
|
||||
*/
|
||||
public void deleteRoute(){
|
||||
//Gets a route from the table and deletes it before updating the table
|
||||
Route toDelete = tableViewRouteRD.getSelectionModel().getSelectedItem();
|
||||
theDataSet.deleteRoute(toDelete);
|
||||
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
|
||||
@@ -137,6 +146,7 @@ public class RouteRDController extends Controller {
|
||||
* @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());
|
||||
@@ -156,9 +166,14 @@ public class RouteRDController extends Controller {
|
||||
if (rEquipmentFilter.getText() != null) {
|
||||
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.
|
||||
* @see RouteAnalyser
|
||||
*/
|
||||
public void analyse_Button() {
|
||||
replaceSceneContent(SceneCode.ROUTE_ANALYSER);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user