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

main
Liam Beckett 9 years ago
parent 805eee58af
commit e17bf9b055

@ -250,7 +250,9 @@ public class FlightRDController extends Controller {
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem(); FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex(); int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
try{ try{
theDataSet.moveFlightPoint(toMove, toMoveIndex-1); if (toMoveIndex != 0) {
theDataSet.moveFlightPoint(toMove, toMoveIndex - 1);
}
} catch (DataException e) { } catch (DataException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -263,7 +265,9 @@ public class FlightRDController extends Controller {
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem(); FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex(); int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
try{ try{
theDataSet.moveFlightPoint(toMove, toMoveIndex+1); if (toMoveIndex != flightTableView.getItems().size()-1) {
theDataSet.moveFlightPoint(toMove, toMoveIndex + 1);
}
} catch (DataException e) { } catch (DataException e) {
e.printStackTrace(); e.printStackTrace();
} }

Loading…
Cancel
Save