Fixed the error when the user clicks on empty path fields in the flight path list view

main
Liam Beckett 10 years ago
parent e17bf9b055
commit 6ec38bcb87

Binary file not shown.

@ -28,7 +28,7 @@ public class FlightPath {
}
/**
* COnstructor for FlightPath from dataset add later the ID needs to be set from database.
* Constructor for FlightPath from dataset add later the ID needs to be set from database.
* @param departureAirport
* @param arrivalAirport
*/

@ -92,6 +92,7 @@ public class FlightRDController extends Controller {
flightPathListView.setOnMouseClicked(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) {
String flightPathDisplayNameClicked = flightPathListView.getSelectionModel().getSelectedItem();
if (flightPathDisplayNameClicked!=null) {
String[] segments = flightPathDisplayNameClicked.split("_");
String pathIdClicked = segments[0];
@ -103,6 +104,7 @@ public class FlightRDController extends Controller {
flightPaths = theDataSet.getFlightPaths();
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
}
}
});
@ -246,6 +248,9 @@ public class FlightRDController extends Controller {
flightPathListView();
}
/**
* Function for the 'Move Up' right click option on the points in the flight table.
*/
public void movePointUp(){
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
@ -258,9 +263,11 @@ public class FlightRDController extends Controller {
}
updateTable(currentPathIndex);
updatePaths();
}
/**
* Function for the 'Move Down' right click option on the points in the flight table.
*/
public void movePointDown(){
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
@ -287,6 +294,9 @@ public class FlightRDController extends Controller {
flightTableView.refresh();
}
/**
* Updates the flight path list view so that it displays the correct names for the paths
*/
private void updatePaths(){
try {
flightPathListView.getItems().clear();

@ -158,6 +158,7 @@ public class FlightSummaryController extends Controller {
flightPathListView.setOnMouseClicked(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) {
String flightPathDisplayNameClicked = flightPathListView.getSelectionModel().getSelectedItem();
if (flightPathDisplayNameClicked!=null) {
String[] segments = flightPathDisplayNameClicked.split("_");
String pathIdClicked = segments[0];
@ -165,6 +166,7 @@ public class FlightSummaryController extends Controller {
.get(Integer.parseInt(pathIdClicked)));
currentPathId = Integer.parseInt(pathIdClicked);
}
}
});
flightPathListView.setItems(flightList);
} catch (Exception e) {

Loading…
Cancel
Save