Fixed Dataset Changing Error and Selected Table Item Indices Error
This commit is contained in:
@@ -93,6 +93,13 @@ public class App extends Application
|
|||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
if (session.getCurrentDataset() != null){
|
||||||
|
for (int i = 0; i < datasets.size(); i ++) {
|
||||||
|
if (datasets.get(i).getName().equals(session.getCurrentDataset())) {
|
||||||
|
currentDataset = datasets.get(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//after all loading then load the previous session
|
//after all loading then load the previous session
|
||||||
if (session.getSceneDisplayed() != null) {
|
if (session.getSceneDisplayed() != null) {
|
||||||
menuController.replaceSceneContent(session.getSceneDisplayed());
|
menuController.replaceSceneContent(session.getSceneDisplayed());
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class AirlineSummaryController extends Controller{
|
|||||||
map = new Map(mapView, new RoutePath());
|
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= currentData.getAirlines().get(tableView.getSelectionModel().getSelectedIndices().get(0));
|
Airline selectedAirline= tableView.getSelectionModel().getSelectedItems().get(0);
|
||||||
for (int i = 0 ; i < currentData.getAirports().size(); i ++){
|
for (int i = 0 ; i < currentData.getAirports().size(); i ++){
|
||||||
if (currentData.getAirports().get(i).getCountryName().equals(selectedAirline.getCountryName())){
|
if (currentData.getAirports().get(i).getCountryName().equals(selectedAirline.getCountryName())){
|
||||||
map.displayAirport(new RoutePath(new Position(currentData.getAirports().get(i).getLatitude(), currentData.getAirports().get(i).getLongitude())));
|
map.displayAirport(new RoutePath(new Position(currentData.getAirports().get(i).getLatitude(), currentData.getAirports().get(i).getLongitude())));
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class AirportSummaryController extends Controller{
|
|||||||
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");
|
System.out.println("loading");
|
||||||
Airport selectedAirport= currentData.getAirports().get(tableView.getSelectionModel().getSelectedIndices().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())));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class RouteSummaryController extends Controller{
|
|||||||
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");
|
System.out.println("loading");
|
||||||
Route selectedRoute= currentData.getRoutes().get(tableView.getSelectionModel().getSelectedIndices().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(
|
||||||
new Position(selectedRoute.getSourceAirport().getLatitude(), selectedRoute.getSourceAirport().getLongitude()),
|
new Position(selectedRoute.getSourceAirport().getLatitude(), selectedRoute.getSourceAirport().getLongitude()),
|
||||||
|
|||||||
Reference in New Issue
Block a user