Started work on the ordering of flight points
This commit is contained in:
Binary file not shown.
@@ -2100,9 +2100,6 @@ public class Dataset {
|
|||||||
int curIndex = flightPath.getFlightPoints().indexOf(flightPoint);
|
int curIndex = flightPath.getFlightPoints().indexOf(flightPoint);
|
||||||
flightPath.getFlightPoints().remove(flightPoint);
|
flightPath.getFlightPoints().remove(flightPoint);
|
||||||
int indexToAdd = index;
|
int indexToAdd = index;
|
||||||
if (curIndex < index){
|
|
||||||
indexToAdd --;
|
|
||||||
}
|
|
||||||
flightPath.getFlightPoints().add(indexToAdd, flightPoint);
|
flightPath.getFlightPoints().add(indexToAdd, flightPoint);
|
||||||
|
|
||||||
Connection c = null;
|
Connection c = null;
|
||||||
|
|||||||
@@ -246,6 +246,29 @@ public class FlightRDController extends Controller {
|
|||||||
flightPathListView();
|
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.
|
* 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.
|
* @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 sourceAirport = null;
|
||||||
Airport destinationAirport = null;
|
Airport destinationAirport = null;
|
||||||
|
|
||||||
System.out.println(firstPointICAO);
|
|
||||||
System.out.println(lastPointICAO);
|
|
||||||
|
|
||||||
for (int i=0; i < airportList.size(); i++){
|
for (int i=0; i < airportList.size(); i++){
|
||||||
Airport current = airportList.get(i);
|
Airport current = airportList.get(i);
|
||||||
System.out.println(current.getICAO());
|
|
||||||
if(current.getICAO().equals(firstPointICAO)){
|
if(current.getICAO().equals(firstPointICAO)){
|
||||||
sourceAirport = current;
|
sourceAirport = current;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,8 @@
|
|||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false" onAction="#editPoint" text="Edit" />
|
<MenuItem mnemonicParsing="false" onAction="#editPoint" text="Edit" />
|
||||||
<MenuItem mnemonicParsing="false" onAction="#deletePoint" text="Delete" />
|
<MenuItem mnemonicParsing="false" onAction="#deletePoint" text="Delete" />
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#movePointUp" text="Move Up" />
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#movePointDown" text="Move Down" />
|
||||||
</items>
|
</items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</contextMenu>
|
</contextMenu>
|
||||||
|
|||||||
Reference in New Issue
Block a user