Added in the right click, delete option for the flight points in the table.

This commit is contained in:
Liam Beckett
2016-09-17 17:37:39 +12:00
parent be3413a373
commit 3508518cdd
2 changed files with 32 additions and 12 deletions
@@ -17,6 +17,7 @@ import javax.swing.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.ResourceBundle;
/**
@@ -194,6 +195,21 @@ public class FlightRDController extends Controller {
}
}
public void deletePoint() {
FlightPoint toDelete = flightTableView.getSelectionModel().getSelectedItem();
int pathID = toDelete.getIndex();
LinkedHashMap<Integer, FlightPath> flightPathDict = theDataSet.getFlightPathDictionary();
FlightPath toDeletesPath = flightPathDict.get(pathID);
theDataSet.deleteFlightPoint(toDelete, toDeletesPath);
currentPathIndex = theDataSet.getFlightPaths().indexOf(theDataSet.getFlightPathDictionary().get(pathID));
ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths();
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
}
public void flightAnalyser(){
JOptionPane.showMessageDialog(null, "This is not Implemented yet");
}