From cd8e2b0c7f18ebb75ae7a02715c7d62c3bd22193 Mon Sep 17 00:00:00 2001 From: Liam Beckett Date: Sat, 17 Sep 2016 18:08:42 +1200 Subject: [PATCH] Implemented the delete option for the flight paths on the Summary and Raw Data pages. --- .../group9/GUI/FlightRDController.java | 12 +++- .../group9/GUI/FlightSummaryController.java | 63 +++++++++++++++++-- src/main/resources/flight_data_summary.fxml | 11 +++- 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/src/main/java/seng202/group9/GUI/FlightRDController.java b/src/main/java/seng202/group9/GUI/FlightRDController.java index 5514c80..2ade98d 100644 --- a/src/main/java/seng202/group9/GUI/FlightRDController.java +++ b/src/main/java/seng202/group9/GUI/FlightRDController.java @@ -180,7 +180,7 @@ public class FlightRDController extends Controller { } /** - * Creates a pop up dialog which prompts the user for two ICAO airport codes which will use when creating a new path + * Creates a pop up dialog which prompts the user for two ICAO airport codes which will use when creating a new path. */ public void newPath() { NewPathPopUp dialogBox = new NewPathPopUp(); @@ -194,7 +194,9 @@ public class FlightRDController extends Controller { flightPathListView(); } } - + /** + * Removes the selected point from the table and database. + */ public void deletePoint() { FlightPoint toDelete = flightTableView.getSelectionModel().getSelectedItem(); int pathID = toDelete.getIndex(); @@ -210,6 +212,9 @@ public class FlightRDController extends Controller { flightTableView.setItems(FXCollections.observableArrayList(flightPoints)); } + /** + * Removes the selected path from the list view of paths and from the database. + */ public void deletePath() { String toDeleteStr = flightPathListView.getSelectionModel().getSelectedItem(); String[] segments = toDeleteStr.split("_"); @@ -223,6 +228,9 @@ public class FlightRDController extends Controller { flightPathListView(); } + /** + * Will link to the flight analyser when implemented. + */ public void flightAnalyser(){ JOptionPane.showMessageDialog(null, "This is not Implemented yet"); } diff --git a/src/main/java/seng202/group9/GUI/FlightSummaryController.java b/src/main/java/seng202/group9/GUI/FlightSummaryController.java index 5fd7d93..60d2c07 100644 --- a/src/main/java/seng202/group9/GUI/FlightSummaryController.java +++ b/src/main/java/seng202/group9/GUI/FlightSummaryController.java @@ -2,14 +2,17 @@ package seng202.group9.GUI; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.ListView; +import javafx.scene.input.MouseEvent; import seng202.group9.Controller.App; import seng202.group9.Controller.Dataset; import seng202.group9.Controller.SceneCode; import seng202.group9.Core.FlightPath; +import seng202.group9.Core.FlightPoint; import java.net.URL; import java.util.ArrayList; @@ -22,31 +25,63 @@ import java.util.ResourceBundle; public class FlightSummaryController extends Controller { private Dataset theDataSet = null; + private int currentPathId = 0; + private int currentPathIndex = 0; - @FXML - private Button flightRawData; @FXML ListView flightPathListView; final ObservableList flightList = FXCollections.observableArrayList(); /** - * Changes to the Flight Raw Data Scene when the Raw Data Button is clicked + * Changes to the Flight Raw Data Scene when the Raw Data Button is clicked. */ public void handleRawDataButton() { replaceSceneContent(SceneCode.FLIGHT_RAW_DATA); } - public void airportSummaryButton() { - replaceSceneContent(SceneCode.AIRPORT_SUMMARY); - } + /** + * Changes to the Airport Summary Scene when the Airport is clicked. + */ + public void airportSummaryButton() { replaceSceneContent(SceneCode.AIRPORT_SUMMARY); } + + /** + * Changes to the Route Summary Scene when the Route Button is clicked. + */ public void routeSummaryButton() { replaceSceneContent(SceneCode.ROUTE_SUMMARY); } + + /** + * Changes to the Airline Summary Scene when the Airline Button is clicked. + */ public void airlineSummaryButton() { replaceSceneContent(SceneCode.AIRLINE_SUMMARY); } + /** + * Loads the Flight paths into the List View and waits for a mouse clicked event for which it will update the table + * to display the selected Flight paths points. Called from the MenuController. + */ + public void flightPathListView() { + try { + ArrayList flightPaths; + flightPaths = theDataSet.getFlightPaths(); + for(int i = 0; i + + @@ -45,7 +47,14 @@ - + + + + + + + +