Added backend controllers which pass the selected options to their respected graphs when creating the graph.
This commit is contained in:
@@ -11,7 +11,7 @@ public enum SceneCode {
|
|||||||
FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.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"), AIRLINE_ADD("airline_add_form.fxml"), AIRLINE_FILTER("airline_filter_form.fxml"),
|
AIRPORT_DIST_CALC("airport_dist_calc.fxml"), AIRLINE_ADD("airline_add_form.fxml"), AIRLINE_FILTER("airline_filter_form.fxml"),
|
||||||
AIRPORT_ADD("airport_add_form.fxml"), AIRPORT_FILTER("airport_filter_form.fxml"), ROUTE_ADD("route_add_form.fxml"),
|
AIRPORT_ADD("airport_add_form.fxml"), AIRPORT_FILTER("airport_filter_form.fxml"), ROUTE_ADD("route_add_form.fxml"),
|
||||||
ROUTE_FILTER("route_filter_form.fxml"),AIRPORT_DIST_CALC("airport_dist_calc.fxml"), ANALYSER_TAB("analyser_main_page.fxml"),
|
ROUTE_FILTER("route_filter_form.fxml"),ANALYSER_TAB("analyser_main_page.fxml"),
|
||||||
BAR_GRAPH_CHOOSER("bar_graph_chooser.fxml"), PIE_GRAPH_CHOOSER("pie_graph_chooser.fxml");
|
BAR_GRAPH_CHOOSER("bar_graph_chooser.fxml"), PIE_GRAPH_CHOOSER("pie_graph_chooser.fxml");
|
||||||
|
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package seng202.group9.Controller;
|
package seng202.group9.Controller;
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import seng202.group9.Core.Airline;
|
import seng202.group9.Core.Airline;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,10 +12,38 @@ import java.util.HashMap;
|
|||||||
* Users last session state is store here.
|
* Users last session state is store here.
|
||||||
*/
|
*/
|
||||||
public class Session implements Serializable {
|
public class Session implements Serializable {
|
||||||
|
|
||||||
private SceneCode sceneDisplayed;
|
private SceneCode sceneDisplayed;
|
||||||
private HashMap<Integer, String> filteredAirlines;
|
private HashMap<Integer, String> filteredAirlines;
|
||||||
private HashMap<Integer, String> filteredAirports;
|
private HashMap<Integer, String> filteredAirports;
|
||||||
private HashMap<Integer, String> filteredRoutes;
|
private HashMap<Integer, String> filteredRoutes;
|
||||||
|
private String selectedgraphagainst;
|
||||||
|
private ArrayList<String> selectedgraphoptions;
|
||||||
|
private Boolean usefilter;
|
||||||
|
|
||||||
|
public String getSelectedgraphagainst() {
|
||||||
|
return selectedgraphagainst;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedgraphagainst(String selectedgraphagainst) {
|
||||||
|
this.selectedgraphagainst = selectedgraphagainst;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getSelectedgraphoptions() {
|
||||||
|
return selectedgraphoptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedgraphoptions(ArrayList<String> selectedgraphoptions) {
|
||||||
|
this.selectedgraphoptions = selectedgraphoptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getUsefilter() {
|
||||||
|
return usefilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsefilter(Boolean usefilter) {
|
||||||
|
this.usefilter = usefilter;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a new session
|
* Constructor for a new session
|
||||||
@@ -71,4 +100,5 @@ public class Session implements Serializable {
|
|||||||
public HashMap<Integer, String> getFilteredRoutes() {
|
public HashMap<Integer, String> getFilteredRoutes() {
|
||||||
return filteredRoutes;
|
return filteredRoutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import javafx.beans.value.ObservableValue;
|
|||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ChoiceBox;
|
import javafx.scene.control.ChoiceBox;
|
||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import javafx.scene.control.SelectionMode;
|
import javafx.scene.control.SelectionMode;
|
||||||
import seng202.group9.Controller.SceneCode;
|
import seng202.group9.Controller.SceneCode;
|
||||||
|
import seng202.group9.Controller.Session;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -24,6 +26,8 @@ public class BarChooserController extends Controller{
|
|||||||
ListView graph_against;
|
ListView graph_against;
|
||||||
@FXML
|
@FXML
|
||||||
ListView graph_options;
|
ListView graph_options;
|
||||||
|
@FXML
|
||||||
|
CheckBox usefilter;
|
||||||
|
|
||||||
ObservableList airportOptions = FXCollections.observableArrayList("ID", "Name", "ICAO", "IATA FFA", "Altitude",
|
ObservableList airportOptions = FXCollections.observableArrayList("ID", "Name", "ICAO", "IATA FFA", "Altitude",
|
||||||
"Latitude", "Longitude", "City", "Country");
|
"Latitude", "Longitude", "City", "Country");
|
||||||
@@ -37,10 +41,17 @@ public class BarChooserController extends Controller{
|
|||||||
ArrayList<ObservableList> allOptions = new ArrayList<ObservableList>();
|
ArrayList<ObservableList> allOptions = new ArrayList<ObservableList>();
|
||||||
|
|
||||||
public void buildGraph() {
|
public void buildGraph() {
|
||||||
|
Session currentsession = this.getParent().getSession();
|
||||||
|
ArrayList<String> temp = new ArrayList<String>();
|
||||||
|
temp.addAll(graph_options.getSelectionModel().getSelectedItems());
|
||||||
|
currentsession.setSelectedgraphoptions(temp);
|
||||||
|
currentsession.setUsefilter(usefilter.isSelected());
|
||||||
|
currentsession.setSelectedgraphagainst(graph_options.getSelectionModel().getSelectedItem().toString());
|
||||||
|
currentsession.setUsefilter(usefilter.isSelected());
|
||||||
|
replaceSceneContent(SceneCode.ROUTE_ANALYSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void returnToSelection(){replaceSceneContent(SceneCode.ANALYSER_TAB);}
|
public void returnToSelection(){replaceSceneContent(SceneCode.PIE_GRAPH_CHOOSER);}
|
||||||
|
|
||||||
public void changeTables(){
|
public void changeTables(){
|
||||||
int temp = datatypechooser.getSelectionModel().getSelectedIndex();
|
int temp = datatypechooser.getSelectionModel().getSelectedIndex();
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import javafx.beans.value.ObservableValue;
|
|||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ChoiceBox;
|
import javafx.scene.control.ChoiceBox;
|
||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import javafx.scene.control.SelectionMode;
|
import javafx.scene.control.SelectionMode;
|
||||||
import seng202.group9.Controller.SceneCode;
|
import seng202.group9.Controller.SceneCode;
|
||||||
|
import seng202.group9.Controller.Session;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -22,6 +24,9 @@ public class PieChooserController extends Controller{
|
|||||||
ChoiceBox datatypechooser;
|
ChoiceBox datatypechooser;
|
||||||
@FXML
|
@FXML
|
||||||
ListView graph_options;
|
ListView graph_options;
|
||||||
|
@FXML
|
||||||
|
CheckBox usefilter;
|
||||||
|
|
||||||
|
|
||||||
ObservableList airportOptions = FXCollections.observableArrayList("ID", "Name", "ICAO", "IATA FFA", "Altitude",
|
ObservableList airportOptions = FXCollections.observableArrayList("ID", "Name", "ICAO", "IATA FFA", "Altitude",
|
||||||
"Latitude", "Longitude", "City", "Country");
|
"Latitude", "Longitude", "City", "Country");
|
||||||
@@ -34,12 +39,17 @@ public class PieChooserController extends Controller{
|
|||||||
|
|
||||||
ArrayList<ObservableList> allOptions = new ArrayList<ObservableList>();
|
ArrayList<ObservableList> allOptions = new ArrayList<ObservableList>();
|
||||||
|
|
||||||
|
|
||||||
|
public void toBarGraphChooser(){replaceSceneContent(SceneCode.BAR_GRAPH_CHOOSER);}
|
||||||
|
|
||||||
public void buildGraph() {
|
public void buildGraph() {
|
||||||
|
Session currentsession = this.getParent().getSession();
|
||||||
|
ArrayList<String> temp = new ArrayList<String>();
|
||||||
|
currentsession.setSelectedgraphagainst(graph_options.getSelectionModel().getSelectedItem().toString());
|
||||||
|
currentsession.setUsefilter(usefilter.isSelected());
|
||||||
|
replaceSceneContent(SceneCode.AIRPORT_ANALYSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void returnToSelection(){replaceSceneContent(SceneCode.ANALYSER_TAB);}
|
|
||||||
|
|
||||||
public void changeTables(){
|
public void changeTables(){
|
||||||
int temp = datatypechooser.getSelectionModel().getSelectedIndex();
|
int temp = datatypechooser.getSelectionModel().getSelectedIndex();
|
||||||
graph_options.setItems(allOptions.get(temp));
|
graph_options.setItems(allOptions.get(temp));
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class RouteAnalyser extends Controller {
|
|||||||
seriesArivals.getData().add(new XYChart.Data(airport,temp.get(0)));
|
seriesArivals.getData().add(new XYChart.Data(airport,temp.get(0)));
|
||||||
seriesDeparts.getData().add(new XYChart.Data(airport,temp.get(1)));
|
seriesDeparts.getData().add(new XYChart.Data(airport,temp.get(1)));
|
||||||
}
|
}
|
||||||
|
System.out.println(useddata.keySet().size());
|
||||||
//Gives the formatted data to the graph.
|
//Gives the formatted data to the graph.
|
||||||
analyserGraph.getData().addAll(seriesArivals,seriesDeparts);
|
analyserGraph.getData().addAll(seriesArivals,seriesDeparts);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.ChoiceBox?>
|
<?import javafx.scene.control.ChoiceBox?>
|
||||||
@@ -12,7 +17,7 @@
|
|||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<?import javafx.scene.text.Text?>
|
<?import javafx.scene.text.Text?>
|
||||||
|
|
||||||
<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">
|
<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">
|
||||||
<children>
|
<children>
|
||||||
<ScrollPane prefHeight="800.0" prefWidth="800.0">
|
<ScrollPane prefHeight="800.0" prefWidth="800.0">
|
||||||
<content>
|
<content>
|
||||||
@@ -58,6 +63,7 @@
|
|||||||
</HBox>
|
</HBox>
|
||||||
<Button layoutX="244.0" layoutY="400.0" mnemonicParsing="false" onAction="#buildGraph" text="Build Graph" />
|
<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="400.0" layoutY="400.0" mnemonicParsing="false" onAction="#returnToSelection" text="Change Graph Type" />
|
||||||
|
<CheckBox fx:id="usefilter" layoutX="277.0" layoutY="449.0" mnemonicParsing="false" text="Use filters from Raw Data or here." />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</content>
|
</content>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.ChoiceBox?>
|
<?import javafx.scene.control.ChoiceBox?>
|
||||||
@@ -12,7 +17,7 @@
|
|||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<?import javafx.scene.text.Text?>
|
<?import javafx.scene.text.Text?>
|
||||||
|
|
||||||
<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">
|
<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">
|
||||||
<children>
|
<children>
|
||||||
<ScrollPane prefHeight="800.0" prefWidth="800.0">
|
<ScrollPane prefHeight="800.0" prefWidth="800.0">
|
||||||
<content>
|
<content>
|
||||||
@@ -49,6 +54,8 @@
|
|||||||
</padding>
|
</padding>
|
||||||
<children>
|
<children>
|
||||||
<ChoiceBox fx:id="datatypechooser" layoutY="14.0" prefWidth="150.0" />
|
<ChoiceBox fx:id="datatypechooser" layoutY="14.0" prefWidth="150.0" />
|
||||||
|
<Label layoutX="-6.0" layoutY="120.0" text="Values to be Graphed." />
|
||||||
|
<Label layoutX="15.0" layoutY="-7.0" text="Data Type Used" />
|
||||||
</children>
|
</children>
|
||||||
</Pane>
|
</Pane>
|
||||||
</children>
|
</children>
|
||||||
@@ -56,7 +63,8 @@
|
|||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<Button layoutX="234.0" layoutY="413.0" mnemonicParsing="false" onAction="#buildGraph" text="Build Graph" />
|
<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" />
|
<Button layoutX="462.0" layoutY="413.0" mnemonicParsing="false" onAction="#toBarGraphChooser" text="Change Graph Type" />
|
||||||
|
<CheckBox fx:id="usefilter" layoutX="356.0" layoutY="464.0" mnemonicParsing="false" text="Use filters from Raw Data" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</content>
|
</content>
|
||||||
|
|||||||
Reference in New Issue
Block a user