Made the first one of each Airline, Airport and Route tables load each load

main
YaFedImYaEatIm 9 years ago
parent 1e65e8ef37
commit f930f7664e

@ -60,7 +60,6 @@ public class AirlineSummaryController extends Controller{
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines())); tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines()));
//Sets up map. //Sets up map.
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airline>() { tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airline>() {
public void changed(ObservableValue<? extends Airline> observable, Airline oldValue, Airline newValue) { public void changed(ObservableValue<? extends Airline> observable, Airline oldValue, Airline newValue) {
Airline selectedAirline= tableView.getSelectionModel().getSelectedItems().get(0); Airline selectedAirline= tableView.getSelectionModel().getSelectedItems().get(0);
@ -72,6 +71,7 @@ public class AirlineSummaryController extends Controller{
} }
} }
}); });
map = new Map(mapView, new RoutePath(), tableView);
} }
/** /**

@ -82,14 +82,13 @@ public class AirportSummaryController extends Controller{
columnTotalRoutes.setCellValueFactory(new PropertyValueFactory<Airport, String>("TotalRoutes")); columnTotalRoutes.setCellValueFactory(new PropertyValueFactory<Airport, String>("TotalRoutes"));
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getAirports())); tableView.setItems(FXCollections.observableArrayList(currentData.getAirports()));
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airport>() { tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airport>() {
public void changed(ObservableValue<? extends Airport> observable, Airport oldValue, Airport newValue) { public void changed(ObservableValue<? extends Airport> observable, Airport oldValue, Airport newValue) {
System.out.println("loading");
Airport selectedAirport= tableView.getSelectionModel().getSelectedItems().get(0); Airport selectedAirport= tableView.getSelectionModel().getSelectedItems().get(0);
map.displayAirport(new RoutePath( new Position(selectedAirport.getLatitude(), selectedAirport.getLongitude()))); map.displayAirport(new RoutePath( new Position(selectedAirport.getLatitude(), selectedAirport.getLongitude())));
} }
}); });
map = new Map(mapView, new RoutePath(), tableView);
} }

@ -53,10 +53,8 @@ public class RouteSummaryController extends Controller{
columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment")); columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getRoutes())); tableView.setItems(FXCollections.observableArrayList(currentData.getRoutes()));
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Route>() { tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Route>() {
public void changed(ObservableValue<? extends Route> observable, Route oldValue, Route newValue) { public void changed(ObservableValue<? extends Route> observable, Route oldValue, Route newValue) {
System.out.println("loading");
Route selectedRoute= tableView.getSelectionModel().getSelectedItems().get(0); Route selectedRoute= tableView.getSelectionModel().getSelectedItems().get(0);
if (selectedRoute.getSourceAirport() != null && selectedRoute.getDestinationAirport() != null) { if (selectedRoute.getSourceAirport() != null && selectedRoute.getDestinationAirport() != null) {
map.displayRoute(new RoutePath( map.displayRoute(new RoutePath(
@ -74,6 +72,7 @@ public class RouteSummaryController extends Controller{
} }
} }
}); });
map = new Map(mapView, new RoutePath(), tableView);
} }
/** /**

Loading…
Cancel
Save