|
|
|
@ -17,6 +17,7 @@ import seng202.group9.Core.FlightPoint;
|
|
|
|
import javax.swing.*;
|
|
|
|
import javax.swing.*;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Controller for the Flights Raw Data Scene.
|
|
|
|
* Controller for the Flights Raw Data Scene.
|
|
|
|
@ -117,8 +118,8 @@ public class FlightRDController extends Controller {
|
|
|
|
* Used to load the table for the Flight points initially from the MenuController
|
|
|
|
* Used to load the table for the Flight points initially from the MenuController
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void load() {
|
|
|
|
public void load() {
|
|
|
|
if (theDataSet != null) {
|
|
|
|
|
|
|
|
theDataSet = getParent().getCurrentDataset();
|
|
|
|
theDataSet = getParent().getCurrentDataset();
|
|
|
|
|
|
|
|
if (theDataSet != null) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
|
|
|
|
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
|
|
|
|
} catch (DataException e) {
|
|
|
|
} catch (DataException e) {
|
|
|
|
@ -172,6 +173,13 @@ public class FlightRDController extends Controller {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void deletePoint() {
|
|
|
|
public void deletePoint() {
|
|
|
|
FlightPoint toDelete = flightTableView.getSelectionModel().getSelectedItem();
|
|
|
|
FlightPoint toDelete = flightTableView.getSelectionModel().getSelectedItem();
|
|
|
|
|
|
|
|
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
|
|
|
|
|
|
|
alert.setTitle("Flight Point Delete Confirmation");
|
|
|
|
|
|
|
|
alert.setHeaderText("You are about to delete some data.");
|
|
|
|
|
|
|
|
alert.setContentText("Are you sure you want to delete the selected flight point?");
|
|
|
|
|
|
|
|
//alert.showAndWait();
|
|
|
|
|
|
|
|
Optional<ButtonType> result = alert.showAndWait();
|
|
|
|
|
|
|
|
if (result.isPresent() && result.get() == ButtonType.OK) {
|
|
|
|
int pathID;
|
|
|
|
int pathID;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
pathID = toDelete.getIndex();
|
|
|
|
pathID = toDelete.getIndex();
|
|
|
|
@ -188,6 +196,7 @@ 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.
|
|
|
|
* Loads the pop up for the edit data scene and updates the table when the window is closed.
|
|
|
|
|