Added in the right click, delete option for the flight points in the table.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user