Linked Raw Data GUI together and tables have some data in them from the database.
This commit is contained in:
@@ -9,11 +9,11 @@ import java.util.ArrayList;
|
||||
|
||||
public class AirlineParser extends Parser {
|
||||
String filePath = "";
|
||||
ObservableList<Airline> parsedAirline;
|
||||
ArrayList<Airline> parsedAirline;
|
||||
|
||||
public AirlineParser(String filePath){
|
||||
this.filePath = filePath;
|
||||
parsedAirline = FXCollections.observableArrayList();
|
||||
parsedAirline = new ArrayList<Airline>();
|
||||
}
|
||||
|
||||
public String parse() throws DataException{
|
||||
@@ -122,7 +122,7 @@ public class AirlineParser extends Parser {
|
||||
"Entries With Errors: %2$d", successful, error);
|
||||
}
|
||||
|
||||
public ObservableList<Airline> getResult(){
|
||||
public ArrayList<Airline> getResult(){
|
||||
return parsedAirline;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package seng202.group9.Controller;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import seng202.group9.Core.Airport;
|
||||
import seng202.group9.Core.City;
|
||||
import seng202.group9.Core.Country;
|
||||
|
||||
import javax.jws.Oneway;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AirportParser extends Parser {
|
||||
|
||||
@@ -54,13 +54,13 @@ public class App extends Application
|
||||
e.printStackTrace();
|
||||
}
|
||||
primaryStage.show();
|
||||
/*
|
||||
|
||||
//testing out dataset
|
||||
try {
|
||||
currentDataset = new Dataset("test's", Dataset.getExisting);
|
||||
}catch (DataException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}/*
|
||||
//testing out airport parser
|
||||
try {
|
||||
System.out.println(currentDataset.importAirport("res/Samples/Airports.txt"));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package seng202.group9.Controller;
|
||||
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import seng202.group9.Core.*;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -13,7 +15,7 @@ import java.util.LinkedHashMap;
|
||||
public class Dataset {
|
||||
|
||||
String name;
|
||||
static boolean getExisting = true;//constructor variables for action
|
||||
public static boolean getExisting = true;//constructor variables for action
|
||||
static boolean createNew = false;//constructor variables for action
|
||||
ArrayList<Airline> airlines;
|
||||
ArrayList<Airport> airports;
|
||||
|
||||
@@ -195,9 +195,9 @@ public class Airport {
|
||||
* gets the IATA/FFA of the airport
|
||||
* @return IATA/FFA Code
|
||||
*/
|
||||
public String IATA_FFA(){
|
||||
return IATA_FFA;
|
||||
}
|
||||
// public String IATA_FFA(){
|
||||
// return IATA_FFA;
|
||||
// }
|
||||
/**
|
||||
* gets the altitude of the airport
|
||||
* @return Altitude of Airport
|
||||
@@ -292,6 +292,7 @@ public class Airport {
|
||||
/**
|
||||
* Information of the airport returned in String format.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return this.city+" Airport has ICAO: "+this.ICAO+", IATA/FFA: "+this.IATA_FFA+" and is located at ("+this.latitude+", "+this.longitude
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import seng202.group9.Controller.DataException;
|
||||
import seng202.group9.Controller.App;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Core.Airline;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Sunguin on 2016/09/13.
|
||||
*/
|
||||
public class AirlineRDController extends MenuController implements Initializable{
|
||||
public class AirlineRDController extends MenuController {
|
||||
|
||||
@FXML
|
||||
private TableView<Airline> tableView;
|
||||
@@ -57,13 +53,13 @@ public class AirlineRDController extends MenuController implements Initializable
|
||||
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
public AirlineRDController(){
|
||||
App parent;
|
||||
|
||||
public void setApp(App parent){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
//Initializes the table.
|
||||
//Uses dummy data since I have no idea how the data is connected together.
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
public void loadTables() {
|
||||
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
|
||||
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
||||
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
||||
@@ -73,17 +69,13 @@ public class AirlineRDController extends MenuController implements Initializable
|
||||
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Country"));
|
||||
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
||||
|
||||
try {
|
||||
theDataSet = new Dataset("test's", Dataset.getExisting);
|
||||
}catch (DataException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
try{
|
||||
System.out.println(theDataSet.importAirline("res/Samples/Airlines.txt"));
|
||||
} catch (DataException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
tableView.setItems(theDataSet.getAirlines());
|
||||
theDataSet = this.parent.getCurrentDataset();
|
||||
// try{
|
||||
// System.out.println(theDataSet.importAirline("res/Samples/Airlines.txt"));
|
||||
// } catch (DataException e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
tableView.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
|
||||
}
|
||||
|
||||
//Dummy function to test the add button.
|
||||
|
||||
@@ -1,12 +1,98 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.beans.InvalidationListener;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.util.Callback;
|
||||
import seng202.group9.Controller.App;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Core.Airport;
|
||||
import seng202.group9.Core.City;
|
||||
import seng202.group9.Core.Country;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Sunguin on 2016/09/13.
|
||||
*/
|
||||
public class AirportRDController extends MenuController implements Initializable {
|
||||
public class AirportRDController extends MenuController{
|
||||
|
||||
public AirportRDController(){
|
||||
@FXML
|
||||
private TableView<Airport> tableViewAirportRD;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpIDcol;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpNamecol;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpCitycol;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpCountrycol;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpIATAFFAcol;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpICAOcol;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpLatitudecol;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpLongitudecol;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> airpAltitudecol;
|
||||
@FXML
|
||||
private TableColumn<Airport, City> airpTimezonecol;
|
||||
@FXML
|
||||
private TableColumn<Airport, Country> airpDSTcol;
|
||||
@FXML
|
||||
private TableColumn<Airport, City> airpTzcol;
|
||||
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
App parent;
|
||||
|
||||
public void setApp(App parent){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void loadTables() {
|
||||
theDataSet = this.parent.getCurrentDataset();
|
||||
|
||||
airpIDcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ID"));
|
||||
airpNamecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
||||
airpCitycol.setCellValueFactory(new PropertyValueFactory<Airport, String>("City"));
|
||||
airpCountrycol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Country"));
|
||||
airpIATAFFAcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA"));
|
||||
airpICAOcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ICAO"));
|
||||
airpLatitudecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Latitude"));
|
||||
airpLongitudecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Longitude"));
|
||||
airpAltitudecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
|
||||
airpTimezonecol.setCellValueFactory(new PropertyValueFactory<Airport, City>("Timezone"));
|
||||
airpDSTcol.setCellValueFactory(new PropertyValueFactory<Airport, Country>("DST"));
|
||||
airpTzcol.setCellValueFactory(new PropertyValueFactory<Airport, City>("Tz"));
|
||||
|
||||
// airpTimezonecol.setCellFactory(new Callback<TableColumn<Airport, String>, TableCell<Airport, City>>() {
|
||||
//
|
||||
// @Override
|
||||
// public TableCell<Airport, City> call(TableColumn<Airport, City> param) {
|
||||
// TableCell<Airport, City> timeZoneCell = new TableCell<Airport, City>() {
|
||||
// @Override
|
||||
// protected void updateItem(City timezone, boolean empty) {
|
||||
// if (timezone != null) {
|
||||
// Label timeZoneLabel = new Label(timezone.getTimeOlson());
|
||||
// setGraphic(timeZoneLabel);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// return timeZoneCell;
|
||||
// }
|
||||
// });
|
||||
|
||||
tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,8 +37,29 @@ public class MenuController implements Initializable{
|
||||
*/
|
||||
public void viewAirlineRawData() {
|
||||
try {
|
||||
parent.replaceSceneContent("menu.fxml");
|
||||
System.out.println("Loaded Airline Raw Data.");
|
||||
AirlineRDController summaryController = (AirlineRDController) parent.replaceSceneContent("airline_raw_data.fxml");
|
||||
summaryController.setApp(parent);
|
||||
summaryController.loadTables();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void viewAirportRawData() {
|
||||
try {
|
||||
AirportRDController summaryController = (AirportRDController) parent.replaceSceneContent("airport_raw_data.fxml");
|
||||
summaryController.setApp(parent);
|
||||
summaryController.loadTables();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void viewRouteRawData() {
|
||||
try {
|
||||
RouteRDController summaryController = (RouteRDController) parent.replaceSceneContent("route_raw_data.fxml");
|
||||
summaryController.setApp(parent);
|
||||
//summaryController.loadTables();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -74,6 +95,7 @@ public class MenuController implements Initializable{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void initialize(URL arg0, ResourceBundle arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import seng202.group9.Controller.App;
|
||||
|
||||
/**
|
||||
* Created by Sunguin on 2016/09/14.
|
||||
*/
|
||||
public class RouteRDController extends MenuController {
|
||||
App parent;
|
||||
|
||||
public void setApp(App parent){
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user