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;
|
package seng202.group9.GUI;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -11,6 +10,7 @@ import seng202.group9.Controller.Session;
|
|||||||
import seng202.group9.Core.FlightPoint;
|
import seng202.group9.Core.FlightPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Controller for the Flights Edit Point Pop up Scene.
|
||||||
* Created by Liam Beckett on 23/09/2016.
|
* Created by Liam Beckett on 23/09/2016.
|
||||||
*/
|
*/
|
||||||
public class FlightEditorController extends Controller{
|
public class FlightEditorController extends Controller{
|
||||||
@@ -32,17 +32,16 @@ public class FlightEditorController extends Controller{
|
|||||||
private Dataset theDataSet = null;
|
private Dataset theDataSet = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a single airport entry in the database.
|
* Edits a single flight entry in the database.
|
||||||
* Takes in values from the GUI the user has typed in.
|
* Takes in values from the field the user right clicked.
|
||||||
* @see Dataset
|
* @see Dataset
|
||||||
*/
|
*/
|
||||||
public void editFlight() {
|
public void editFlight() {
|
||||||
//Tries to add a new airport and clears the fields to their initial state if successful.
|
//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 the manual data.
|
//Otherwise an error message will pop up with what is wrong with edit
|
||||||
try {
|
try {
|
||||||
Session session = getParent().getSession();
|
Session session = getParent().getSession();
|
||||||
int flightPointID = session.getCurrentFlightPointID();
|
int flightPointID = session.getCurrentFlightPointID();
|
||||||
int flightPathID = session.getCurrentFlightPathID();
|
|
||||||
|
|
||||||
theDataSet.editFlight(
|
theDataSet.editFlight(
|
||||||
theDataSet.getFlightPointDictionary().get(flightPointID),
|
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() {
|
public void load() {
|
||||||
theDataSet = getParent().getCurrentDataset();
|
theDataSet = getParent().getCurrentDataset();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.LinkedHashMap;
|
|||||||
* Controller for the Flights Raw Data Scene.
|
* Controller for the Flights Raw Data Scene.
|
||||||
* Created by Liam Beckett on 13/09/2016.
|
* Created by Liam Beckett on 13/09/2016.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class FlightRDController extends Controller {
|
public class FlightRDController extends Controller {
|
||||||
|
|
||||||
private Dataset theDataSet = null;
|
private Dataset theDataSet = null;
|
||||||
@@ -201,7 +200,7 @@ public class FlightRDController extends Controller {
|
|||||||
pathID = toDelete.getIndex();
|
pathID = toDelete.getIndex();
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
e.printStackTrace();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
LinkedHashMap<Integer, FlightPath> flightPathDict = theDataSet.getFlightPathDictionary();
|
LinkedHashMap<Integer, FlightPath> flightPathDict = theDataSet.getFlightPathDictionary();
|
||||||
@@ -213,6 +212,9 @@ public class FlightRDController extends Controller {
|
|||||||
updateTable(currentPathIndex);
|
updateTable(currentPathIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the pop up for the edit data scene and updates the table when the window is closed.
|
||||||
|
*/
|
||||||
public void editPoint() {
|
public void editPoint() {
|
||||||
FlightPoint toEdit = flightTableView.getSelectionModel().getSelectedItem();
|
FlightPoint toEdit = flightTableView.getSelectionModel().getSelectedItem();
|
||||||
try {
|
try {
|
||||||
@@ -221,7 +223,7 @@ public class FlightRDController extends Controller {
|
|||||||
session.setCurrentFlightPathtID(currentPathId);
|
session.setCurrentFlightPathtID(currentPathId);
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
e.printStackTrace();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
createPopUpStage(SceneCode.FLIGHT_EDITOR, 600, 289);
|
createPopUpStage(SceneCode.FLIGHT_EDITOR, 600, 289);
|
||||||
@@ -244,7 +246,11 @@ public class FlightRDController extends Controller {
|
|||||||
flightPathListView();
|
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;
|
ArrayList<FlightPath> flightPaths;
|
||||||
flightPaths = theDataSet.getFlightPaths();
|
flightPaths = theDataSet.getFlightPaths();
|
||||||
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
|
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
|
||||||
@@ -255,7 +261,7 @@ public class FlightRDController extends Controller {
|
|||||||
/**
|
/**
|
||||||
* Will link to the flight analyser when implemented.
|
* Will link to the flight analyser when implemented.
|
||||||
*/
|
*/
|
||||||
public void flightAnalyser(){
|
private void flightAnalyser(){
|
||||||
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
|
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user