Fixed up some of the javadocs and did some refactoring removing unneccesary code.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
@@ -11,6 +10,7 @@ import seng202.group9.Controller.Session;
|
||||
import seng202.group9.Core.FlightPoint;
|
||||
|
||||
/**
|
||||
* Controller for the Flights Edit Point Pop up Scene.
|
||||
* Created by Liam Beckett on 23/09/2016.
|
||||
*/
|
||||
public class FlightEditorController extends Controller{
|
||||
@@ -32,17 +32,16 @@ public class FlightEditorController extends Controller{
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
/**
|
||||
* Adds a single airport entry in the database.
|
||||
* Takes in values from the GUI the user has typed in.
|
||||
* Edits a single flight entry in the database.
|
||||
* Takes in values from the field the user right clicked.
|
||||
* @see Dataset
|
||||
*/
|
||||
public void editFlight() {
|
||||
//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.
|
||||
//Data is pre-loaded into the text fields and any accepted changes will be implemented.
|
||||
//Otherwise an error message will pop up with what is wrong with edit
|
||||
try {
|
||||
Session session = getParent().getSession();
|
||||
int flightPointID = session.getCurrentFlightPointID();
|
||||
int flightPathID = session.getCurrentFlightPathID();
|
||||
|
||||
theDataSet.editFlight(
|
||||
theDataSet.getFlightPointDictionary().get(flightPointID),
|
||||
@@ -79,10 +78,9 @@ public class FlightEditorController extends Controller{
|
||||
}
|
||||
}
|
||||
|
||||
public void loadValues(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Loader which is used to load the selected information into the text fields for editing.
|
||||
*/
|
||||
public void load() {
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.LinkedHashMap;
|
||||
* Controller for the Flights Raw Data Scene.
|
||||
* Created by Liam Beckett on 13/09/2016.
|
||||
*/
|
||||
|
||||
public class FlightRDController extends Controller {
|
||||
|
||||
private Dataset theDataSet = null;
|
||||
@@ -201,7 +200,7 @@ public class FlightRDController extends Controller {
|
||||
pathID = toDelete.getIndex();
|
||||
} catch (DataException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Point is Undeletable as the Index ID is not set.");
|
||||
System.err.println("Point is Undeletable as the Index ID is not set.");
|
||||
return;
|
||||
}
|
||||
LinkedHashMap<Integer, FlightPath> flightPathDict = theDataSet.getFlightPathDictionary();
|
||||
@@ -213,6 +212,9 @@ public class FlightRDController extends Controller {
|
||||
updateTable(currentPathIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the pop up for the edit data scene and updates the table when the window is closed.
|
||||
*/
|
||||
public void editPoint() {
|
||||
FlightPoint toEdit = flightTableView.getSelectionModel().getSelectedItem();
|
||||
try {
|
||||
@@ -221,7 +223,7 @@ public class FlightRDController extends Controller {
|
||||
session.setCurrentFlightPathtID(currentPathId);
|
||||
} catch (DataException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Point is Uneditable as the Index ID is not set.");
|
||||
System.err.println("Point is Uneditable as the Index ID is not set.");
|
||||
return;
|
||||
}
|
||||
createPopUpStage(SceneCode.FLIGHT_EDITOR, 600, 289);
|
||||
@@ -244,7 +246,11 @@ public class FlightRDController extends Controller {
|
||||
flightPathListView();
|
||||
}
|
||||
|
||||
public void updateTable(int currentPathIndex) {
|
||||
/**
|
||||
* Updates the table so that when the database is changed (deleted or edited) it still shows the correct data values.
|
||||
* @param currentPathIndex The index of the current path in the Path array list.
|
||||
*/
|
||||
private void updateTable(int currentPathIndex) {
|
||||
ArrayList<FlightPath> flightPaths;
|
||||
flightPaths = theDataSet.getFlightPaths();
|
||||
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
|
||||
@@ -255,7 +261,7 @@ public class FlightRDController extends Controller {
|
||||
/**
|
||||
* Will link to the flight analyser when implemented.
|
||||
*/
|
||||
public void flightAnalyser(){
|
||||
private void flightAnalyser(){
|
||||
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user