Fixed bug with flight pages and an empty dataset

This commit is contained in:
Liam Beckett
2016-10-01 16:43:28 +13:00
parent 04481661c4
commit e51aaaa7f2
3 changed files with 53 additions and 48 deletions
BIN
View File
Binary file not shown.
@@ -115,6 +115,7 @@ public class FlightRDController extends Controller {
* Used to load the table for the Flight points initially from the MenuController * Used to load the table for the Flight points initially from the MenuController
*/ */
public void load() { public void load() {
if (theDataSet != null) {
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
try { try {
currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path currentPathId = theDataSet.getFlightPaths().get(0).getID(); //Sets the default to the 1st Path
@@ -136,6 +137,7 @@ public class FlightRDController extends Controller {
ArrayList<FlightPoint> flightPoints = flightPaths.get(0).getFlight(); ArrayList<FlightPoint> flightPoints = flightPaths.get(0).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints)); flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
} }
}
/** /**
* Will take the inputs from the text fields and adds the point to the current flight path. * Will take the inputs from the text fields and adds the point to the current flight path.
@@ -318,7 +320,9 @@ public class FlightRDController extends Controller {
@Override @Override
public void loadOnce(){ public void loadOnce(){
if (theDataSet != null) {
flightPathListView(); flightPathListView();
} }
}
} }
@@ -177,6 +177,7 @@ public class FlightSummaryController extends Controller {
* Used to load the page from the MenuController. * Used to load the page from the MenuController.
*/ */
public void load() { public void load() {
if (theDataSet != null) {
try { try {
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
ArrayList<FlightPath> flightPaths; ArrayList<FlightPath> flightPaths;
@@ -190,7 +191,6 @@ public class FlightSummaryController extends Controller {
} }
flightPathListView.setItems(flightList); flightPathListView.setItems(flightList);
flightSummaryListView(); flightSummaryListView();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -208,6 +208,7 @@ public class FlightSummaryController extends Controller {
} }
}); });
} }
}
/** /**
* Removes the selected path from the list view of paths and from the database. * Removes the selected path from the list view of paths and from the database.
*/ */