package seng202.group9.GUI; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.ListView; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseEvent; import seng202.group9.Controller.App; import seng202.group9.Controller.Dataset; import seng202.group9.Core.FlightPath; import seng202.group9.Core.FlightPoint; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.ResourceBundle; /** * Controller for the Flights Raw Data Scene. * Created by Liam Beckett on 13/09/2016. */ public class FlightRawDataController implements Initializable { private Dataset theDataSet = null; App parent; public void setApp(App parent){ this.parent = parent; } @FXML private TableView flightTableView; @FXML private TableColumn flightIdCol; @FXML private TableColumn flightNameCol; @FXML private TableColumn flightTypeCol; @FXML private TableColumn flightViaCol; @FXML private TableColumn flightAltitudeCol; @FXML private TableColumn flightLatCol; @FXML private TableColumn flightLongCol; @FXML private TableColumn flightHeadCol; @FXML private TableColumn flightLegDisCol; @FXML private TableColumn flightTotDisCol; @FXML ListView flightPathListView; final ObservableList flightList = FXCollections.observableArrayList(); public void flightPathListView() { try { ArrayList flightPaths = new ArrayList(); flightPaths = theDataSet.getFlightPaths(); for(int i = 0; i() { public void handle(MouseEvent event) { String flightPathDisplayNameClicked = flightPathListView.getSelectionModel().getSelectedItem(); String[] segments = flightPathDisplayNameClicked.split("_"); String pathIdClicked = segments[0]; ArrayList flightPaths; flightPaths = theDataSet.getFlightPaths(); ArrayList flightPoints = flightPaths.get(Integer.parseInt(pathIdClicked)-1).getFlight(); flightTableView.setItems(FXCollections.observableArrayList(flightPoints)); } }); flightPathListView.setItems(flightList); } catch (Exception e) { e.printStackTrace(); } } public void loadTables() { flightIdCol.setCellValueFactory(new PropertyValueFactory("ID")); flightNameCol.setCellValueFactory(new PropertyValueFactory("Name")); flightTypeCol.setCellValueFactory(new PropertyValueFactory("Type")); flightViaCol.setCellValueFactory(new PropertyValueFactory("Via")); flightAltitudeCol.setCellValueFactory(new PropertyValueFactory("Altitude")); flightLatCol.setCellValueFactory(new PropertyValueFactory("Latitude")); flightLongCol.setCellValueFactory(new PropertyValueFactory("Longitude")); flightHeadCol.setCellValueFactory(new PropertyValueFactory("Heading")); flightLegDisCol.setCellValueFactory(new PropertyValueFactory("Leg_Dist")); flightTotDisCol.setCellValueFactory(new PropertyValueFactory("Tot_Dist")); theDataSet = this.parent.getCurrentDataset(); ArrayList flightPaths; flightPaths = theDataSet.getFlightPaths(); int firstID = flightPaths.get(0).getID(); ArrayList flightPoints = flightPaths.get(0).getFlight(); flightTableView.setItems(FXCollections.observableArrayList(flightPoints)); } public static void updateTable(int pathID) { } public void initialize(URL arg0, ResourceBundle arg1) { // TODO Auto-generated method stub } }