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

main
Liam Beckett 9 years ago
parent 9912f2c3af
commit f212be8dbd

@ -425,7 +425,7 @@ public class Dataset {
return message; return message;
} }
/** /**
* Imports Airline files to the dataset * Imports Airport files to the dataset
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -559,7 +559,7 @@ public class Dataset {
} }
/** /**
* Imports Airline files to dataset * Imports Route files to dataset
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -634,13 +634,11 @@ public class Dataset {
} }
/** /**
* Imports Airline files to dataset * Imports Flight files to dataset
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
*/ */
public String importFlight(String filePath) throws DataException { public String importFlight(String filePath) throws DataException {
FlightPathParser parser = new FlightPathParser(filePath); FlightPathParser parser = new FlightPathParser(filePath);
//remember this still has to append the duplicate message to it. //remember this still has to append the duplicate message to it.

@ -1,8 +1,10 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.control.ListView;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
@ -21,6 +23,12 @@ import java.util.ResourceBundle;
*/ */
public class FlightRawDataController implements Initializable { public class FlightRawDataController implements Initializable {
private Dataset theDataSet = null;
App parent;
public void setApp(App parent){
this.parent = parent;
}
@FXML @FXML
private TableView<FlightPoint> flightTableView; private TableView<FlightPoint> flightTableView;
@ -45,13 +53,29 @@ public class FlightRawDataController implements Initializable {
@FXML @FXML
private TableColumn<FlightPoint, String> flightTotDisCol; private TableColumn<FlightPoint, String> flightTotDisCol;
private Dataset theDataSet = null; @FXML
App parent; ListView<String> flightPathListView;
final ObservableList<String> flightList = FXCollections.observableArrayList();
public void setApp(App parent){ public void flightPathListView() {
this.parent = parent; 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() { public void loadTables() {
flightIdCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("ID")); flightIdCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("ID"));
@ -66,11 +90,7 @@ public class FlightRawDataController implements Initializable {
flightTotDisCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Tot_Dist")); flightTotDisCol.setCellValueFactory(new PropertyValueFactory<FlightPoint, String>("Tot_Dist"));
theDataSet = this.parent.getCurrentDataset(); theDataSet = this.parent.getCurrentDataset();
// try{
// System.out.println(theDataSet.importAirline("res/Samples/Airlines.txt"));
// } catch (DataException e){
// e.printStackTrace();
// }
ArrayList<FlightPath> flightPaths = new ArrayList(); ArrayList<FlightPath> flightPaths = new ArrayList();
flightPaths = theDataSet.getFlightPaths(); flightPaths = theDataSet.getFlightPaths();
int firstID = flightPaths.get(0).getID(); int firstID = flightPaths.get(0).getID();

@ -1,9 +1,16 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.control.ListView;
import seng202.group9.Controller.App; import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.FlightPath;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle; import java.util.ResourceBundle;
/** /**
@ -11,12 +18,37 @@ import java.util.ResourceBundle;
*/ */
public class FlightSummaryController implements Initializable { public class FlightSummaryController implements Initializable {
App parent; private Dataset theDataSet = null;
App parent;
public void setApp(App parent){ public void setApp(App parent){
this.parent = 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) { public void initialize(URL arg0, ResourceBundle arg1) {
// TODO Auto-generated method stub // TODO Auto-generated method stub

@ -76,6 +76,7 @@ public class MenuController implements Initializable{
try { try {
FlightSummaryController summaryController = (FlightSummaryController) parent.replaceSceneContent("flight_data_summary.fxml"); FlightSummaryController summaryController = (FlightSummaryController) parent.replaceSceneContent("flight_data_summary.fxml");
summaryController.setApp(parent); summaryController.setApp(parent);
summaryController.flightPathListView();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -90,6 +91,7 @@ public class MenuController implements Initializable{
parent.replaceSceneContent("flight_raw_data.fxml"); parent.replaceSceneContent("flight_raw_data.fxml");
rawDataController.setApp(parent); rawDataController.setApp(parent);
rawDataController.loadTables(); rawDataController.loadTables();
rawDataController.flightPathListView();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -44,11 +44,8 @@
<children> <children>
<Pane prefHeight="461.0" prefWidth="175.0" GridPane.rowIndex="1"> <Pane prefHeight="461.0" prefWidth="175.0" GridPane.rowIndex="1">
<children> <children>
<ListView layoutX="20.0" layoutY="-1.0" prefHeight="432.0" prefWidth="125.0"> <ListView fx:id="flightPathListView" layoutX="20.0" layoutY="27.0" prefHeight="404.0" prefWidth="125.0" />
<padding> <Label layoutX="26.0" layoutY="4.0" text="Flight Path File(s)">
<Insets top="20.0" />
</padding></ListView>
<Label layoutX="32.0" layoutY="4.0" text="Flight Path Files">
<font> <font>
<Font size="15.0" /> <Font size="15.0" />
</font> </font>

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?> <?import javafx.scene.control.ListView?>
@ -44,12 +43,8 @@
<children> <children>
<Pane prefHeight="434.0" prefWidth="304.0"> <Pane prefHeight="434.0" prefWidth="304.0">
<children> <children>
<ListView layoutX="25.0" prefHeight="411.0" prefWidth="125.0"> <ListView fx:id="flightPathListView" layoutX="25.0" layoutY="27.0" prefHeight="384.0" prefWidth="125.0" />
<padding> <Label layoutX="31.0" layoutY="4.0" text="Flight Path File(s)">
<Insets top="20.0" />
</padding>
</ListView>
<Label layoutX="36.0" layoutY="4.0" text="Flight Path Files">
<font> <font>
<Font size="15.0" /> <Font size="15.0" />
</font> </font>

Loading…
Cancel
Save