Javadoc added for airline raw data
This commit is contained in:
@@ -278,7 +278,7 @@ public class Airline{
|
||||
if (!this.ICAO.equals("") && this.ICAO.equals(airline.getICAO())){
|
||||
throw new DataException("This ICAO Code already Exists, Please Choose Another.");
|
||||
}
|
||||
if (!this.alias.equals("") && this.alias.equals(airline.getAlias())){
|
||||
if (!this.alias.equals("") && !this.alias.equals("\\N") && !this.alias.equals("\\n") && this.alias.equals(airline.getAlias())){
|
||||
throw new DataException("This Alias already Exists, Please Choose Another.");
|
||||
}
|
||||
if (!this.callSign.equals("") && this.callSign.equals(airline.getCallSign())){
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
@@ -9,10 +8,12 @@ import javafx.stage.Stage;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
|
||||
/**
|
||||
* Created by Sunguin on 2016/09/22.
|
||||
* The GUI controller class for airline_add_form.fxml.
|
||||
* Extends from the abstract class {@link Controller}.
|
||||
* Created by Sunguin
|
||||
*/
|
||||
public class AirlineAddController extends Controller {
|
||||
//Setting up text fields for adding data
|
||||
//Setting up text fields for adding data.
|
||||
@FXML
|
||||
private TextField airlNameAdd;
|
||||
@FXML
|
||||
@@ -30,8 +31,16 @@ public class AirlineAddController extends Controller {
|
||||
@FXML
|
||||
private Button addButton;
|
||||
|
||||
//Set an empty Dataset to be assigned to the current dataset.
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
/**
|
||||
* Loads up the current dataset.
|
||||
*/
|
||||
public void load() {
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single airline entry to the database.
|
||||
* Takes in values from the GUI the user has typed in.
|
||||
@@ -58,26 +67,23 @@ public class AirlineAddController extends Controller {
|
||||
airlCountryAdd.clear();
|
||||
airlActiveAdd.clear();
|
||||
|
||||
//Saying to the user that the airline has successfully added.
|
||||
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();
|
||||
|
||||
//Closes the add form.
|
||||
Stage stage = (Stage) addButton.getScene().getWindow();
|
||||
stage.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
//Tells the user what and where the error is.
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@ import seng202.group9.Controller.EntryParser;
|
||||
import seng202.group9.Controller.Session;
|
||||
import seng202.group9.Core.Airline;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Created by Sunguin on 2016/09/24.
|
||||
* The GUI controller class for airline_edit_form.fxml.
|
||||
* Extends from the abstract class {@link Controller}.
|
||||
* Created by Sunguin
|
||||
*/
|
||||
public class AirlineEditController extends Controller {
|
||||
//Setting up text fields for editing data
|
||||
//Setting up text fields for editing data.
|
||||
@FXML
|
||||
private TextField airlNameEdit;
|
||||
@FXML
|
||||
@@ -36,12 +36,43 @@ public class AirlineEditController extends Controller {
|
||||
@FXML
|
||||
private Button applyButton;
|
||||
|
||||
//Sets up an empty Dataset to be assigned to the current dataset.
|
||||
private Dataset theDataSet = null;
|
||||
//Sets up an empty session to be assigned to the current session.
|
||||
private Session currentSession = null;
|
||||
|
||||
//Sets up an empty airline to be assigned to the airline being edited.
|
||||
private Airline toEdit = null;
|
||||
|
||||
|
||||
/**
|
||||
* Loads up the current dataset and current session.
|
||||
* Also gets the airline to be edited from the table.
|
||||
* Sets the text fields as the airline selected.
|
||||
*/
|
||||
public void load() {
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
currentSession = getParent().getSession();
|
||||
|
||||
toEdit = theDataSet.getAirlineDictionary().get(currentSession.getAirlineToEdit());
|
||||
|
||||
airlNameEdit.setText(toEdit.getName());
|
||||
airlAliasEdit.setText(toEdit.getAlias());
|
||||
airlIATAEdit.setText(toEdit.getIATA());
|
||||
airlICAOEdit.setText(toEdit.getICAO());
|
||||
airlCallsignEdit.setText(toEdit.getCallSign());
|
||||
airlCountryEdit.setText(toEdit.getCountryName());
|
||||
airlActiveEdit.setText(toEdit.getActive());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Edits the current airline and closes the popup window.
|
||||
* Takes in the values from the text fields.
|
||||
* @see Dataset
|
||||
*/
|
||||
public void editAirline() {
|
||||
//Tries to edit an airport and comes up with a popup if successful and exits the popup.
|
||||
//Otherwise an error message will pop up with what is wrong.
|
||||
try {
|
||||
EntryParser parser = new EntryParser();
|
||||
parser.parseAirline(airlNameEdit.getText(), airlAliasEdit.getText(), airlIATAEdit.getText(),
|
||||
@@ -61,19 +92,4 @@ public class AirlineEditController extends Controller {
|
||||
System.err.println("RIP Harambe: " + e.getMessage() + "IT WAS TOO SOON");
|
||||
}
|
||||
}
|
||||
|
||||
public void load() {
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
currentSession = getParent().getSession();
|
||||
|
||||
toEdit = theDataSet.getAirlineDictionary().get(currentSession.getAirlineToEdit());
|
||||
|
||||
airlNameEdit.setText(toEdit.getName());
|
||||
airlAliasEdit.setText(toEdit.getAlias());
|
||||
airlIATAEdit.setText(toEdit.getIATA());
|
||||
airlICAOEdit.setText(toEdit.getICAO());
|
||||
airlCallsignEdit.setText(toEdit.getCallSign());
|
||||
airlCountryEdit.setText(toEdit.getCountryName());
|
||||
airlActiveEdit.setText(toEdit.getActive());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Created by Sunguin on 2016/09/22.
|
||||
* The GUI controller class for airline_filter_form.fxml.
|
||||
* Extends from the abstract class {@link Controller}.
|
||||
* Created by Sunguin
|
||||
*/
|
||||
public class AirlineFilterController extends Controller {
|
||||
|
||||
@@ -42,6 +44,14 @@ public class AirlineFilterController extends Controller {
|
||||
private Dataset theDataSet = null;
|
||||
private Session currentSession = null;
|
||||
|
||||
/**
|
||||
* Loads up the current dataset and current session.
|
||||
*/
|
||||
public void load() {
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
currentSession = getParent().getSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters airlines by any field.
|
||||
* These are specified by what the user has typed in the filter boxes.
|
||||
@@ -79,22 +89,17 @@ public class AirlineFilterController extends Controller {
|
||||
alert.setContentText("Your airline data has been successfully filtered.");
|
||||
alert.showAndWait();
|
||||
|
||||
//currentSession.setFilteredAirlines(FXCollections.observableArrayList(filter.getFilteredData()));
|
||||
|
||||
//Creates a new hashmap for airlines and fills it with airlines that fit the criteria specified by the user.
|
||||
//Saves it into the current session.
|
||||
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);
|
||||
|
||||
//Closes the popup.
|
||||
Stage stage = (Stage) applyButton.getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
||||
public void load() {
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
currentSession = getParent().getSession();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class AirlineRDController extends Controller {
|
||||
|
||||
|
||||
/**
|
||||
* Opens the Airline add form.
|
||||
* Opens the Airline Add form.
|
||||
*/
|
||||
public void openAdd() {
|
||||
createPopUpStage(SceneCode.AIRLINE_ADD, 600, 370);
|
||||
@@ -118,6 +118,9 @@ public class AirlineRDController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the Airline Edit form.
|
||||
*/
|
||||
public void editAirline() {
|
||||
Airline toEdit = tableViewAirlineRD.getSelectionModel().getSelectedItem();
|
||||
currentSession.setAirlineToEdit(toEdit.getName());
|
||||
@@ -137,6 +140,9 @@ public class AirlineRDController extends Controller {
|
||||
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
|
||||
}
|
||||
|
||||
/**
|
||||
* Goes to the airline summary page.
|
||||
*/
|
||||
public void airlineSummaryButton() {
|
||||
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user