Started work on the ordering of flight points

main
Liam Beckett 9 years ago
parent 9dde2ca025
commit 70645e7307

Binary file not shown.

@ -2100,9 +2100,6 @@ public class Dataset {
int curIndex = flightPath.getFlightPoints().indexOf(flightPoint);
flightPath.getFlightPoints().remove(flightPoint);
int indexToAdd = index;
if (curIndex < index){
indexToAdd --;
}
flightPath.getFlightPoints().add(indexToAdd, flightPoint);
Connection c = null;

@ -246,6 +246,29 @@ public class FlightRDController extends Controller {
flightPathListView();
}
public void movePointUp(){
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
try{
theDataSet.moveFlightPoint(toMove, toMoveIndex-1);
} catch (DataException e) {
e.printStackTrace();
}
updateTable(currentPathIndex);
}
public void movePointDown(){
FlightPoint toMove = flightTableView.getSelectionModel().getSelectedItem();
int toMoveIndex = flightTableView.getSelectionModel().getSelectedIndex();
try{
theDataSet.moveFlightPoint(toMove, toMoveIndex+1);
} catch (DataException e) {
e.printStackTrace();
}
updateTable(currentPathIndex);
}
/**
* Updates the table so that when the database is changed (deleted or edited) it still shows the correct data values.
* @param currentPathIndex The index of the current path in the Path array list.

@ -96,12 +96,8 @@ public class FlightSummaryController extends Controller {
Airport sourceAirport = null;
Airport destinationAirport = null;
System.out.println(firstPointICAO);
System.out.println(lastPointICAO);
for (int i=0; i < airportList.size(); i++){
Airport current = airportList.get(i);
System.out.println(current.getICAO());
if(current.getICAO().equals(firstPointICAO)){
sourceAirport = current;
}

@ -155,6 +155,8 @@
<items>
<MenuItem mnemonicParsing="false" onAction="#editPoint" text="Edit" />
<MenuItem mnemonicParsing="false" onAction="#deletePoint" text="Delete" />
<MenuItem mnemonicParsing="false" onAction="#movePointUp" text="Move Up" />
<MenuItem mnemonicParsing="false" onAction="#movePointDown" text="Move Down" />
</items>
</ContextMenu>
</contextMenu>

Loading…
Cancel
Save