Implemented the list view of the different paths in the database. Currently only displays the names without any response when clicked. Also made slight adjustments to the summary and raw data Flight GUIs
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
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;
|
||||
@@ -21,6 +23,12 @@ import java.util.ResourceBundle;
|
||||
*/
|
||||
public class FlightRawDataController implements Initializable {
|
||||
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
App parent;
|
||||
public void setApp(App parent){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@FXML
|
||||
private TableView<FlightPoint> flightTableView;
|
||||
@@ -45,14 +53,30 @@ public class FlightRawDataController implements Initializable {
|
||||
@FXML
|
||||
private TableColumn<FlightPoint, String> flightTotDisCol;
|
||||
|
||||
private Dataset theDataSet = null;
|
||||
App parent;
|
||||
@FXML
|
||||
ListView<String> flightPathListView;
|
||||
final ObservableList<String> flightList = FXCollections.observableArrayList();
|
||||
|
||||
|
||||
public void setApp(App parent){
|
||||
this.parent = parent;
|
||||
public void flightPathListView() {
|
||||
try {
|
||||
ArrayList<FlightPath> flightPaths = new ArrayList();
|
||||
flightPaths = theDataSet.getFlightPaths();
|
||||
for(int i = 0; i<flightPaths.size(); i++ ){
|
||||
int pathID = flightPaths.get(i).getID();
|
||||
String pathSource = flightPaths.get(i).departsFrom();
|
||||
String pathDestin = flightPaths.get(i).arrivesAt();
|
||||
String flightPathDisplayName = Integer.toString(pathID) + "_" + pathSource + "_" + pathDestin;
|
||||
flightList.add(flightPathDisplayName);
|
||||
}
|
||||
flightPathListView.setItems(flightList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void loadTables() {
|
||||
flightIdCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("ID"));
|
||||
flightNameCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Name"));
|
||||
@@ -66,11 +90,7 @@ public class FlightRawDataController implements Initializable {
|
||||
flightTotDisCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Tot_Dist"));
|
||||
|
||||
theDataSet = this.parent.getCurrentDataset();
|
||||
// try{
|
||||
// System.out.println(theDataSet.importAirline("res/Samples/Airlines.txt"));
|
||||
// } catch (DataException e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
ArrayList<FlightPath> flightPaths = new ArrayList();
|
||||
flightPaths = theDataSet.getFlightPaths();
|
||||
int firstID = flightPaths.get(0).getID();
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.ListView;
|
||||
import seng202.group9.Controller.App;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Core.FlightPath;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
@@ -11,12 +18,37 @@ import java.util.ResourceBundle;
|
||||
*/
|
||||
public class FlightSummaryController implements Initializable {
|
||||
|
||||
App parent;
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
App parent;
|
||||
public void setApp(App parent){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
ListView<String> flightPathListView;
|
||||
final ObservableList<String> flightList = FXCollections.observableArrayList();
|
||||
|
||||
public void flightPathListView() {
|
||||
try {
|
||||
theDataSet = this.parent.getCurrentDataset();
|
||||
ArrayList<FlightPath> flightPaths = new ArrayList();
|
||||
flightPaths = theDataSet.getFlightPaths();
|
||||
for(int i = 0; i<flightPaths.size(); i++ ){
|
||||
int pathID = flightPaths.get(i).getID();
|
||||
String pathSource = flightPaths.get(i).departsFrom();
|
||||
String pathDestin = flightPaths.get(i).arrivesAt();
|
||||
String flightPathDisplayName = Integer.toString(pathID) + "_" + pathSource + "_" + pathDestin;
|
||||
flightList.add(flightPathDisplayName);
|
||||
}
|
||||
flightPathListView.setItems(flightList);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ public class MenuController implements Initializable{
|
||||
try {
|
||||
FlightSummaryController summaryController = (FlightSummaryController) parent.replaceSceneContent("flight_data_summary.fxml");
|
||||
summaryController.setApp(parent);
|
||||
summaryController.flightPathListView();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -90,6 +91,7 @@ public class MenuController implements Initializable{
|
||||
parent.replaceSceneContent("flight_raw_data.fxml");
|
||||
rawDataController.setApp(parent);
|
||||
rawDataController.loadTables();
|
||||
rawDataController.flightPathListView();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user