Merge branch 'WIP_Flight_Path_List' into 'master'

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

See merge request !5
main
Liam Beckett 9 years ago
commit 8192c59bb4

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

@ -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();
}

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

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

Loading…
Cancel
Save