Added controllers for the chart option chooser menus and linked it to the rest of the app.

main
Michael Wilson 9 years ago
parent c2ac9410aa
commit d8057352f0

@ -9,7 +9,8 @@ public enum SceneCode {
AIRPORT_SUMMARY("airport_summary.fxml"), AIRPORT_RAW_DATA("airport_raw_data.fxml"),
ROUTE_SUMMARY("routes_summary.fxml"), ROUTE_RAW_DATA("route_raw_data.fxml"), FLIGHT_SUMMARY("flight_data_summary.fxml"),
FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.fxml"),
AIRPORT_DIST_CALC("airport_dist_calc.fxml");
AIRPORT_DIST_CALC("airport_dist_calc.fxml"), ANALYSER_TAB("analyser_main_page.fxml"),
BAR_GRAPH_CHOOSER("bar_graph_chooser.fxml"), PIE_GRAPH_CHOOSER("pie_graph_chooser.fxml");
private String filePath;

@ -0,0 +1,19 @@
package seng202.group9.GUI;
import seng202.group9.Controller.SceneCode;
/**
* Created by michael on 24/09/2016.
*/
public class AnalyserController extends Controller{
public void barGraphButton(){
replaceSceneContent(SceneCode.BAR_GRAPH_CHOOSER);
}
public void pieGraphButton(){
replaceSceneContent(SceneCode.PIE_GRAPH_CHOOSER);
}
public void load() {}
}

@ -0,0 +1,66 @@
package seng202.group9.GUI;
import javafx.beans.Observable;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
import seng202.group9.Controller.SceneCode;
import java.util.ArrayList;
/**
* Created by michael on 24/09/2016.
*/
public class BarChooserController extends Controller{
@FXML
ChoiceBox datatypechooser;
@FXML
ListView graph_against;
@FXML
ListView graph_options;
ObservableList airportOptions = FXCollections.observableArrayList("ID", "Name", "ICAO", "IATA FFA", "Altitude",
"Latitude", "Longitude", "City", "Country");
ObservableList airlineOptions = FXCollections.observableArrayList("ID", "Name", "ICAO", "IATA", "Alias",
"Call Sign", "Active", "Country");
ObservableList routeOptions = FXCollections.observableArrayList("ID", "Stops", "Codeshare", "Equipment", "Airline",
"Departure Airport", "Arival airport");
ArrayList<ObservableList> allOptions = new ArrayList<ObservableList>();
public void buildGraph() {
}
public void returnToSelection(){replaceSceneContent(SceneCode.ANALYSER_TAB);}
public void changeTables(){
int temp = datatypechooser.getSelectionModel().getSelectedIndex();
graph_against.setItems(allOptions.get(temp));
graph_options.setItems(allOptions.get(temp));
}
public void load(){
datatypechooser.setItems(FXCollections.observableArrayList("Airports","Airlines","Routes"));
datatypechooser.getSelectionModel().selectFirst();
datatypechooser.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
changeTables();
}
});
graph_against.setItems(airportOptions);
graph_options.setItems(airportOptions);
graph_options.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
allOptions.add(airportOptions);
allOptions.add(airlineOptions);
allOptions.add(routeOptions);
}
}

@ -60,6 +60,8 @@ public class MenuController extends Controller{
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
}
public void viewAnalyserMain() { replaceSceneContent(SceneCode.ANALYSER_TAB);}
/**
* Load Flight Summary Function.
*/

@ -0,0 +1,62 @@
package seng202.group9.GUI;
import javafx.beans.Observable;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
import seng202.group9.Controller.SceneCode;
import java.util.ArrayList;
/**
* Created by michael on 24/09/2016.
*/
public class PieChooserController extends Controller{
@FXML
ChoiceBox datatypechooser;
@FXML
ListView graph_options;
ObservableList airportOptions = FXCollections.observableArrayList("ID", "Name", "ICAO", "IATA FFA", "Altitude",
"Latitude", "Longitude", "City", "Country");
ObservableList airlineOptions = FXCollections.observableArrayList("ID", "Name", "ICAO", "IATA", "Alias",
"Call Sign", "Active", "Country");
ObservableList routeOptions = FXCollections.observableArrayList("ID", "Stops", "Codeshare", "Equipment", "Airline",
"Departure Airport", "Arival airport");
ArrayList<ObservableList> allOptions = new ArrayList<ObservableList>();
public void buildGraph() {
}
public void returnToSelection(){replaceSceneContent(SceneCode.ANALYSER_TAB);}
public void changeTables(){
int temp = datatypechooser.getSelectionModel().getSelectedIndex();
graph_options.setItems(allOptions.get(temp));
}
public void load(){
datatypechooser.setItems(FXCollections.observableArrayList("Airports","Airlines","Routes"));
datatypechooser.getSelectionModel().selectFirst();
datatypechooser.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
changeTables();
}
});
graph_options.setItems(airportOptions);
allOptions.add(airportOptions);
allOptions.add(airlineOptions);
allOptions.add(routeOptions);
}
}

@ -38,7 +38,6 @@ public class RouteAnalyser extends Controller {
XYChart.Series seriesDeparts = new XYChart.Series();
seriesArivals.setName("Arriving routes");
seriesDeparts.setName("Departs routes");
System.out.println(useddata.keySet().size());
for (String airport : useddata.keySet()){
ArrayList<Integer> temp = useddata.get(airport);
seriesArivals.getData().add(new XYChart.Data(airport,temp.get(0)));

@ -1,25 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.web.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.web.WebView?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.BarChooserController">
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.BarChooserController">
<children>
<ScrollPane prefHeight="800.0" prefWidth="800.0">
<content>

@ -3,7 +3,6 @@
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.MenuController">
@ -47,6 +46,7 @@
</items></Menu>
<Menu mnemonicParsing="false" text="Analysis">
<items>
<MenuItem mnemonicParsing="false" onAction="#viewAnalyserMain" text="Graphs" />
<MenuItem mnemonicParsing="false" onAction="#veiwDistCalc" text="Calculate distance between Airports" />
</items></Menu>
</menus>

@ -1,25 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.web.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.web.WebView?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.PieChooserController">
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.PieChooserController">
<children>
<ScrollPane prefHeight="800.0" prefWidth="800.0">
<content>
@ -38,7 +31,6 @@
</Text>
</children>
</Pane>
<ListView fx:id="graph_against" layoutX="116.0" layoutY="150.0" prefHeight="200.0" prefWidth="200.0" />
</children>
</AnchorPane>
<AnchorPane prefHeight="300.0" prefWidth="253.0">
@ -48,7 +40,7 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<children>
<ListView fx:id="graph_options" layoutX="104.0" layoutY="-50.0" prefHeight="200.0" prefWidth="200.0" />
<ListView fx:id="graph_options" layoutX="-35.0" layoutY="-50.0" prefHeight="200.0" prefWidth="200.0" />
</children>
</Pane>
<Pane prefHeight="200.0" prefWidth="253.0">
@ -63,8 +55,8 @@
</AnchorPane>
</children>
</HBox>
<Button layoutX="244.0" layoutY="400.0" mnemonicParsing="false" onAction="#buildGraph" text="Build Graph" />
<Button layoutX="400.0" layoutY="400.0" mnemonicParsing="false" onAction="#returnToSelection" text="Change Graph Type" />
<Button layoutX="234.0" layoutY="413.0" mnemonicParsing="false" onAction="#buildGraph" text="Build Graph" />
<Button layoutX="462.0" layoutY="413.0" mnemonicParsing="false" onAction="#returnToSelection" text="Change Graph Type" />
</children>
</AnchorPane>
</content>

Loading…
Cancel
Save