Fixed the move up and down bugs on for the first and last points in a path.

This commit is contained in:
Liam Beckett
2016-10-01 15:02:45 +13:00
parent 805eee58af
commit e17bf9b055
@@ -250,7 +250,9 @@ public class FlightRDController extends Controller {
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
try{
theDataSet.moveFlightPoint(toMove, toMoveIndex-1);
if (toMoveIndex != 0) {
theDataSet.moveFlightPoint(toMove, toMoveIndex - 1);
}
} catch (DataException e) {
e.printStackTrace();
}
@@ -263,7 +265,9 @@ public class FlightRDController extends Controller {
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
try{
theDataSet.moveFlightPoint(toMove, toMoveIndex+1);
if (toMoveIndex != flightTableView.getItems().size()-1) {
theDataSet.moveFlightPoint(toMove, toMoveIndex + 1);
}
} catch (DataException e) {
e.printStackTrace();
}