# Conflicts: # src/main/java/seng202/group9/GUI/FlightRDController.java # src/main/resources/flight_raw_data.fxmlmain
commit
e34e0bafee
@ -0,0 +1,75 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Controller.Session;
|
||||
|
||||
/**
|
||||
* Created by Sunguin on 2016/10/01.
|
||||
*/
|
||||
public class FlightAddController extends Controller {
|
||||
//Set up text fields for adding data
|
||||
@FXML
|
||||
private TextField fNameAdd;
|
||||
@FXML
|
||||
private TextField fTypeAdd;
|
||||
@FXML
|
||||
private TextField fViaAdd;
|
||||
@FXML
|
||||
private TextField fAltitudeAdd;
|
||||
@FXML
|
||||
private TextField fLatitudeAdd;
|
||||
@FXML
|
||||
private TextField fLongitudeAdd;
|
||||
@FXML
|
||||
private TextField fHeadingAdd;
|
||||
@FXML
|
||||
private TextField fLegDistAdd;
|
||||
@FXML
|
||||
private TextField fTotDistAdd;
|
||||
@FXML
|
||||
private Button flightAddButton;
|
||||
|
||||
//Set an empty Dataset to be assigned later
|
||||
private Dataset theDataSet = null;
|
||||
|
||||
private Session currentSession = null;
|
||||
|
||||
public void load() {
|
||||
theDataSet = getParent().getCurrentDataset();
|
||||
currentSession = getParent().getSession();
|
||||
}
|
||||
|
||||
public void addFlight() {
|
||||
try {
|
||||
theDataSet.addFlightPointToPath(currentSession.getCurrentFlightPathID(),
|
||||
fNameAdd.getText(),
|
||||
fTypeAdd.getText(),
|
||||
fViaAdd.getText(),
|
||||
fAltitudeAdd.getText(),
|
||||
fLatitudeAdd.getText(),
|
||||
fLongitudeAdd.getText(),
|
||||
fHeadingAdd.getText(),
|
||||
fLegDistAdd.getText(),
|
||||
fTotDistAdd.getText());
|
||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||
alert.setTitle("Flight Point Add Successful");
|
||||
alert.setHeaderText("New Flight Point added!");
|
||||
alert.setContentText("Your new flight point has been successfully added into the database.");
|
||||
alert.showAndWait();
|
||||
|
||||
Stage stage = (Stage) flightAddButton.getScene().getWindow();
|
||||
stage.close();
|
||||
} catch ( Exception e ) {
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||
alert.setTitle("Flight Point Data Error");
|
||||
alert.setHeaderText("Error adding a custom flight point entry.");
|
||||
alert.setContentText(e.getMessage());
|
||||
alert.showAndWait();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,78 +1,174 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.control.TreeView;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextFlow;
|
||||
|
||||
/**
|
||||
* Created by spe76 on 30/09/16.
|
||||
* The GUI controller class for help.fxml.
|
||||
* Extends from the abstract class {@link Controller}.
|
||||
* Created by Sunguin.
|
||||
*/
|
||||
public class HelpController extends Controller {
|
||||
@FXML
|
||||
private ListView listView;
|
||||
private TreeView treeView;
|
||||
@FXML
|
||||
private TextFlow textArea;
|
||||
|
||||
public static final ObservableList menu = FXCollections.observableArrayList();
|
||||
Text text = new Text();
|
||||
|
||||
//The TreeItems for the TreeView.
|
||||
TreeItem main_root = new TreeItem("Main Root");
|
||||
|
||||
TreeItem importing = new TreeItem("Importing Data");
|
||||
TreeItem importing_start = new TreeItem("Importing on Startup");
|
||||
TreeItem importing_after = new TreeItem("Importing after Startup");
|
||||
|
||||
TreeItem viewing = new TreeItem("Viewing Data");
|
||||
TreeItem summary_viewing = new TreeItem("Viewing Summary Data");
|
||||
TreeItem raw_viewing = new TreeItem("Viewing Raw Data");
|
||||
|
||||
TreeItem manipulating = new TreeItem("Manipulating Data");
|
||||
TreeItem adding = new TreeItem("Adding Data");
|
||||
TreeItem filter = new TreeItem("Filtering Data");
|
||||
TreeItem edit = new TreeItem("Editing Data");
|
||||
TreeItem delete = new TreeItem("Deleting Data");
|
||||
|
||||
TreeItem analysing = new TreeItem("Analysing Data");
|
||||
TreeItem graphing = new TreeItem("Graphs");
|
||||
TreeItem distance = new TreeItem("Distance Calculator");
|
||||
|
||||
/**
|
||||
* Loads the TreeView and sets up the TreeView.
|
||||
*/
|
||||
public void load() {
|
||||
menu.addAll("Importing Data", "Viewing Data", "Manipulating Data", "Analysis");
|
||||
treeView.setRoot(main_root);
|
||||
treeView.setShowRoot(false);
|
||||
|
||||
main_root.getChildren().add(importing);
|
||||
importing.getChildren().add(importing_start);
|
||||
importing.getChildren().add(importing_after);
|
||||
|
||||
main_root.getChildren().add(viewing);
|
||||
viewing.getChildren().add(summary_viewing);
|
||||
viewing.getChildren().add(raw_viewing);
|
||||
|
||||
main_root.getChildren().add(manipulating);
|
||||
manipulating.getChildren().add(adding);
|
||||
manipulating.getChildren().add(filter);
|
||||
manipulating.getChildren().add(edit);
|
||||
manipulating.getChildren().add(delete);
|
||||
|
||||
main_root.getChildren().add(analysing);
|
||||
analysing.getChildren().add(graphing);
|
||||
analysing.getChildren().add(distance);
|
||||
|
||||
text = new Text("Please select an option on the left side menu to display its contents.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
listView.setItems(menu);
|
||||
}
|
||||
|
||||
public void sss() {
|
||||
String menuValue = listView.getSelectionModel().getSelectedItem().toString();
|
||||
textArea.getChildren().clear();
|
||||
if (menuValue == "Importing Data") {
|
||||
text = new Text("You can import data from the first start up of the application and " +
|
||||
"from the 'File' menu on the top of the screen.\nTo import data, select the type " +
|
||||
"of data you wish to import. Then select the file (.csv and .txt file) from the " +
|
||||
"file selector. The data will be loaded into the program and taken to the " +
|
||||
"corresponding summary page.");
|
||||
textArea.getChildren().add(text);
|
||||
} else if (menuValue == "Viewing Data") {
|
||||
text = new Text("There are two types of views available: Summary view and Raw Data view. " +
|
||||
"These are accessable from the menu on the top of the screen under the " +
|
||||
"'View' tab. You first choose which set of data you want to view and then you can select" +
|
||||
" either 'Summary' or 'Raw Data'.\n" +
|
||||
"The summary view does not have every column but provides a map of where the " +
|
||||
"place is.\nThe raw data view allows the user to view the full data table.");
|
||||
textArea.getChildren().add(text);
|
||||
} else if (menuValue == "Manipulating Data") {
|
||||
text = new Text("Data manipulation is all available in the Raw Data views. There are four " +
|
||||
"ways to manipulate data: 'Add', 'Filter', 'Edit' and 'Delete'.\n" +
|
||||
"Add: To add a new entry, first go to the raw data view for that data type. Then click " +
|
||||
"on the add button located on the bottom of the page. Then fill out the entries in the " +
|
||||
"pop-up box and click add at the bottom of the screen. If there is an error with your entry, " +
|
||||
"a message will pop up to help you.\n" +
|
||||
"Filter: To filter all current entries, click on the filter option and a pop " +
|
||||
"up will appear. Then type in the fields you wish to filter by and press the filter button. " +
|
||||
"The table should update with the fields specified.\n" +
|
||||
"Edit: The edit function can be accessed by right clicking on the entry you wish to edit and" +
|
||||
" clicking the edit option. This will lead to a pop up where you can edit the current entry. " +
|
||||
" When the edit has been completed, you can press the apply button on the bottom of the pop up. " +
|
||||
"Again, when the program detects an invalid field, a message will pop up.\n" +
|
||||
"Delete: The delete function is also accessed by right clicking an entry and pressing the delete field. " +
|
||||
"This will come up with a pop up to confirm your delete. When you press ok, the entry will be deleted " +
|
||||
"from the program. The program also allows multiple deletes.");
|
||||
textArea.getChildren().add(text);
|
||||
} else if (menuValue == "Analysis") {
|
||||
text = new Text("There are two ways to do analysis.\nThe first method is to go to the raw data page and " +
|
||||
"press analyse. This will come up with specific graphs that are related to the set of data." +
|
||||
"\nThe second method is by accessing the 'Analysis' button on the menu on the top of the page. " +
|
||||
"You can select which type of analysis you want from here.");
|
||||
textArea.getChildren().add(text);
|
||||
}
|
||||
/**
|
||||
* Changes the text in the TextFlow depending on which option has been selected in the TreeView.
|
||||
*/
|
||||
public void changeView() {
|
||||
treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
|
||||
|
||||
public void changed(ObservableValue observable, Object oldValue,
|
||||
Object newValue) {
|
||||
TreeItem<String> selectedItem = (TreeItem<String>) newValue;
|
||||
String menuValue = selectedItem.getValue();
|
||||
|
||||
if ( menuValue != null ){
|
||||
textArea.getChildren().clear();
|
||||
if (menuValue.equals("Importing on Startup")) {
|
||||
text = new Text("Importing on Startup\n" + "You can import data from the first start up of the application." +
|
||||
"\nTo import data, select the type of data you wish to import along the bottom of the screen." +
|
||||
" Then select the file (.csv and .txt file) from the " +
|
||||
"file selector. The data will be loaded into the program and taken to the " +
|
||||
"corresponding summary page.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Importing after Startup")) {
|
||||
text = new Text("Importing after Startup\n" +
|
||||
"You can import data from the 'File' menu on the top of the screen.\n" +
|
||||
"To import data, select the type of data you wish to import. " +
|
||||
"Then select the file (.csv and .txt file) from the file selector. " +
|
||||
"The data will be loaded into the program and taken to the corresponding summary page.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Viewing Summary Data")) {
|
||||
text = new Text("Viewing Summary Data\n" +
|
||||
"The summary data view consists of a reduced version of the data and a map of the currently selected value. " +
|
||||
"The flight summary data also has a flight path selector to select which flight points you want to view.\n" +
|
||||
"The summary views are accessible from the menu on the top of the screen under the " +
|
||||
"'View' tab. You first choose which set of data you want to view and then you can select 'Summary'." +
|
||||
"\nEach summary page also has buttons that lead to their corresponding raw data view and the other summary views.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Viewing Raw Data")) {
|
||||
text = new Text("Viewing Raw Data\n" +
|
||||
"The raw data view allows the user to view the full data table." +
|
||||
"The user can also add, filter, edit and delete data values as well.\n" +
|
||||
"These are accessible from the menu on the top of the screen under the " +
|
||||
"'View' tab. You first choose which set of data you want to view and then you can select 'Raw Data'.\n" +
|
||||
"The summary view does not have every column but provides a map of where the " +
|
||||
"The raw data page also has buttons that lead to the analysis of that type of data and to go back to the" +
|
||||
" corresponding summary page.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Adding Data")) {
|
||||
text = new Text("Adding Data\n" +
|
||||
"To add a new entry, first go to the raw data view for that data type. Then click " +
|
||||
"on the add button located on the bottom of the page. Then fill out the entries in the " +
|
||||
"pop-up box and click add at the bottom of the screen. " +
|
||||
"When the program detects an invalid field, a message will pop up and state where the error is.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Filtering Data")) {
|
||||
text = new Text("Filtering Data\n" +
|
||||
"To filter all current entries, click on the filter option and a pop " +
|
||||
"up will appear. Then type in the fields the values you wish to filter by and press the filter button. " +
|
||||
"The table should update with the fields specified.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Editing Data")) {
|
||||
text = new Text("Editing Data\n" +
|
||||
"The edit function can be accessed by right clicking on the entry you wish to edit and" +
|
||||
" clicking the edit option. This will lead to a pop up where you can edit the current entry." +
|
||||
" When the edit has been completed, you can press the apply button on the bottom of the pop up. " +
|
||||
"When the program detects an invalid field, a message will pop up and state where the error is.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Deleting Data")) {
|
||||
text = new Text("Deleting Data\n" +
|
||||
"The delete function is accessed by right clicking an entry and pressing the delete option. " +
|
||||
"This will come up with a pop up to confirm your delete. When you press OK, the entry will be deleted " +
|
||||
"from the program. The program also allows multiple deletes.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Graphs")) {
|
||||
text = new Text("Graphs\n" + "The program has the ability to produce graphs according to the type of data.\n" +
|
||||
"This is done by going to the raw data page for the data you wish to graph. Then press the analyse data button" +
|
||||
" on the bottom of the screen. This will produce a graph specific for that type of data.");
|
||||
textArea.getChildren().add(text);
|
||||
|
||||
} else if (menuValue.equals("Distance Calculator")) {
|
||||
text = new Text("Distance Calculator\n" + "You can calculate the distance between two airports.\n" +
|
||||
"First, go to the 'Analysis' tab on the top of the menu bar. You will be taken to a page that " +
|
||||
"allows them to select two airports, one from each column and press 'Calculate' to get the distance between" +
|
||||
" the two airports.");
|
||||
textArea.getChildren().add(text);
|
||||
} else {
|
||||
text = new Text("Please select an option on the left side menu to display its contents.");
|
||||
textArea.getChildren().add(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
<?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.TextField?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.FlightAddController">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="125.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="515.0" minWidth="10.0" prefWidth="402.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="30.0" minHeight="0.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="4.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</padding>
|
||||
<children>
|
||||
<Label text="Add Flight Point" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.valignment="TOP">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="Name" GridPane.halignment="LEFT" GridPane.rowIndex="1">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<Label text="Type" GridPane.halignment="LEFT" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<Label text="Altitude" GridPane.halignment="LEFT" GridPane.rowIndex="4">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<Label text="Latitude" GridPane.halignment="LEFT" GridPane.rowIndex="5">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<Label text="Longitude" GridPane.halignment="LEFT" GridPane.rowIndex="6">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<Button fx:id="flightAddButton" mnemonicParsing="false" onAction="#addFlight" text="Add Flight" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="10" />
|
||||
<TextField fx:id="fNameAdd" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
|
||||
<TextField fx:id="fTypeAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
|
||||
<TextField fx:id="fAltitudeAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
|
||||
<TextField fx:id="fLatitudeAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
|
||||
<TextField fx:id="fLongitudeAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
|
||||
<Label text="Via" GridPane.rowIndex="3">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<Label text="Heading" GridPane.rowIndex="7">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<Label text="Leg Distance" GridPane.rowIndex="8">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<Label text="Total Distance" GridPane.rowIndex="9">
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
|
||||
</GridPane.margin>
|
||||
</Label>
|
||||
<TextField fx:id="fViaAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
|
||||
<TextField fx:id="fHeadingAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
|
||||
<TextField fx:id="fLegDistAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="8" />
|
||||
<TextField fx:id="fTotDistAdd" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="9" />
|
||||
</children>
|
||||
</GridPane>
|
||||
Loading…
Reference in new issue