From b7308f19207a2f5c8ca2de1c07bac75135aabc85 Mon Sep 17 00:00:00 2001 From: Sunguin Date: Mon, 26 Sep 2016 14:50:49 +1300 Subject: [PATCH 1/8] Added a controller and a fxml file for getting started. --- .../java/seng202/group9/Controller/App.java | 38 ++++++---- .../seng202/group9/Controller/SceneCode.java | 2 +- .../group9/GUI/GettingStartedController.java | 33 ++++++++ .../seng202/group9/GUI/MenuController.java | 4 + src/main/resources/getting_started.fxml | 76 +++++++++++++++++++ src/main/resources/menu.fxml | 10 ++- src/main/resources/route_raw_data.fxml | 20 ++++- 7 files changed, 165 insertions(+), 18 deletions(-) create mode 100644 src/main/java/seng202/group9/GUI/GettingStartedController.java create mode 100644 src/main/resources/getting_started.fxml diff --git a/src/main/java/seng202/group9/Controller/App.java b/src/main/java/seng202/group9/Controller/App.java index bc481ea..a7cf27d 100644 --- a/src/main/java/seng202/group9/Controller/App.java +++ b/src/main/java/seng202/group9/Controller/App.java @@ -50,6 +50,23 @@ public class App extends Application @Override public void start(Stage primaryStage) { this.primaryStage = primaryStage; + //after all loading then load the previous session + try{ + FileInputStream fileIn = new FileInputStream("res/session.ser"); + ObjectInputStream objectIn = new ObjectInputStream(fileIn); + session = (Session) objectIn.readObject(); + objectIn.close(); + fileIn.close(); + }catch(IOException e){ + session = new Session(); + System.out.println("New Session File Created"); + }catch(ClassNotFoundException e){ + System.out.println("Missing Session Class"); + System.exit(1); + } catch (Exception e) { + session = new Session(); + e.printStackTrace(); + } //load the menu and the first container try { FXMLLoader loader = new FXMLLoader(); @@ -61,6 +78,9 @@ public class App extends Application primaryStage.sizeToScene(); menuController = (MenuController) loader.getController(); menuController.setApp(this); + + menuController.replaceSceneContent(SceneCode.INITIAL); + in.close(); } catch (Exception e) { e.printStackTrace(); @@ -78,25 +98,13 @@ public class App extends Application }catch (DataException e){ e.printStackTrace(); } - //after all loading then load the previous session - try{ - FileInputStream fileIn = new FileInputStream("res/session.ser"); - ObjectInputStream objectIn = new ObjectInputStream(fileIn); - session = (Session) objectIn.readObject(); - Controller controller = (Controller) replaceSceneContent(session.getSceneDisplayed()); + Controller controller = null; + try { + controller = (Controller) replaceSceneContent(session.getSceneDisplayed()); controller.setApp(this); controller.load(); controller.loadOnce(); - objectIn.close(); - fileIn.close(); - }catch(IOException e){ - session = new Session(); - System.out.println("New Session File Created"); - }catch(ClassNotFoundException e){ - System.out.println("Missing Session Class"); - System.exit(1); } catch (Exception e) { - session = new Session(); e.printStackTrace(); } } diff --git a/src/main/java/seng202/group9/Controller/SceneCode.java b/src/main/java/seng202/group9/Controller/SceneCode.java index eb6844b..e8d103e 100644 --- a/src/main/java/seng202/group9/Controller/SceneCode.java +++ b/src/main/java/seng202/group9/Controller/SceneCode.java @@ -5,7 +5,7 @@ package seng202.group9.Controller; * SceneCode enum is used for Serialization of sessions as well as changing the GUI state from one to the other. */ public enum SceneCode { - INITIAL(""), AIRLINE_SUMMARY("airline_summary.fxml"), AIRLINE_RAW_DATA("airline_raw_data.fxml"), + INITIAL("getting_started.fxml"), AIRLINE_SUMMARY("airline_summary.fxml"), AIRLINE_RAW_DATA("airline_raw_data.fxml"), 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"), diff --git a/src/main/java/seng202/group9/GUI/GettingStartedController.java b/src/main/java/seng202/group9/GUI/GettingStartedController.java new file mode 100644 index 0000000..c241f96 --- /dev/null +++ b/src/main/java/seng202/group9/GUI/GettingStartedController.java @@ -0,0 +1,33 @@ +package seng202.group9.GUI; + +import seng202.group9.Controller.SceneCode; + +/** + * Created by spe76 on 26/09/16. + */ +public class GettingStartedController extends Controller { + + public void load() { + + } + + public void importAirlines() { + Importer importer = new Importer(SceneCode.AIRLINE_RAW_DATA, getParent(), getParent().getPrimaryStage()); + } + + public void importAirports() { + Importer importer = new Importer(SceneCode.AIRPORT_RAW_DATA, getParent(), getParent().getPrimaryStage()); + } + + public void importRoutes() { + Importer importer = new Importer(SceneCode.ROUTE_RAW_DATA, getParent(), getParent().getPrimaryStage()); + } + + public void importFlightData() { + Importer importer = new Importer(SceneCode.FLIGHT_RAW_DATA, getParent(), getParent().getPrimaryStage()); + } + + public void goToAirlineSummary() { + replaceSceneContent(SceneCode.AIRLINE_SUMMARY); + } +} diff --git a/src/main/java/seng202/group9/GUI/MenuController.java b/src/main/java/seng202/group9/GUI/MenuController.java index f530c9e..96eab73 100644 --- a/src/main/java/seng202/group9/GUI/MenuController.java +++ b/src/main/java/seng202/group9/GUI/MenuController.java @@ -74,6 +74,10 @@ public class MenuController extends Controller{ replaceSceneContent(SceneCode.FLIGHT_RAW_DATA); } + public void goToGettingStarted() { + replaceSceneContent(SceneCode.INITIAL); + } + public void load() { //nothing to load } diff --git a/src/main/resources/getting_started.fxml b/src/main/resources/getting_started.fxml new file mode 100644 index 0000000..da88619 --- /dev/null +++ b/src/main/resources/getting_started.fxml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/menu.fxml b/src/main/resources/menu.fxml index e6d61d5..4a9cd9e 100644 --- a/src/main/resources/menu.fxml +++ b/src/main/resources/menu.fxml @@ -1,12 +1,15 @@ + + + - + @@ -49,6 +52,11 @@ + + + + + diff --git a/src/main/resources/route_raw_data.fxml b/src/main/resources/route_raw_data.fxml index 80775bf..3a7a3ce 100644 --- a/src/main/resources/route_raw_data.fxml +++ b/src/main/resources/route_raw_data.fxml @@ -1,5 +1,10 @@ + + + + + @@ -13,7 +18,7 @@ - + @@ -80,5 +85,18 @@ + + From c799c722b8d48f32d4ae991a5ace8cec92a3c402 Mon Sep 17 00:00:00 2001 From: Sunguin Date: Fri, 30 Sep 2016 12:55:53 +1300 Subject: [PATCH 2/8] Added a help pop up pane. --- .../seng202/group9/Controller/SceneCode.java | 2 +- .../seng202/group9/GUI/HelpController.java | 69 +++++++++++++++++++ .../seng202/group9/GUI/MenuController.java | 4 ++ src/main/resources/getting_started.fxml | 2 +- src/main/resources/help.fxml | 43 ++++++++++++ src/main/resources/menu.fxml | 1 + 6 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 src/main/java/seng202/group9/GUI/HelpController.java create mode 100644 src/main/resources/help.fxml diff --git a/src/main/java/seng202/group9/Controller/SceneCode.java b/src/main/java/seng202/group9/Controller/SceneCode.java index e8d103e..563cefd 100644 --- a/src/main/java/seng202/group9/Controller/SceneCode.java +++ b/src/main/java/seng202/group9/Controller/SceneCode.java @@ -12,7 +12,7 @@ public enum SceneCode { 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"), ROUTE_FILTER("route_filter_form.fxml"), AIRLINE_EDIT("airline_edit_form.fxml"), AIRPORT_EDIT("airport_edit_form.fxml"), - ROUTE_EDIT("route_edit_form.fxml"), FLIGHT_EDITOR("flight_editor_form.fxml"); + ROUTE_EDIT("route_edit_form.fxml"), FLIGHT_EDITOR("flight_editor_form.fxml"), HELP("help.fxml"); private String filePath; diff --git a/src/main/java/seng202/group9/GUI/HelpController.java b/src/main/java/seng202/group9/GUI/HelpController.java new file mode 100644 index 0000000..3d2744b --- /dev/null +++ b/src/main/java/seng202/group9/GUI/HelpController.java @@ -0,0 +1,69 @@ +package seng202.group9.GUI; + +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.fxml.FXML; +import javafx.scene.control.ListView; +import javafx.scene.control.TextArea; +import javafx.scene.text.Text; +import javafx.scene.text.TextFlow; + +/** + * Created by spe76 on 30/09/16. + */ +public class HelpController extends Controller { + @FXML + private ListView listView; + @FXML + private TextArea textArea; + + public static final ObservableList menu = FXCollections.observableArrayList(); + + public void load() { + menu.addAll("Importing Data", "Viewing Data", "Manipulating Data", "Analysis"); + + textArea.setStyle("-fx-text-alignment: justify"); + listView.setItems(menu); + } + + public void sss() { + String menuValue = listView.getSelectionModel().getSelectedItem().toString(); + if (menuValue == "Importing Data") { + textArea.setText("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."); + } else if (menuValue == "Viewing Data") { + textArea.setText("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."); + } else if (menuValue == "Manipulating Data") { + textArea.setText("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."); + } else if (menuValue == "Analysis") { + textArea.setText("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."); + } + } + +} \ No newline at end of file diff --git a/src/main/java/seng202/group9/GUI/MenuController.java b/src/main/java/seng202/group9/GUI/MenuController.java index 96eab73..3bbbaea 100644 --- a/src/main/java/seng202/group9/GUI/MenuController.java +++ b/src/main/java/seng202/group9/GUI/MenuController.java @@ -78,6 +78,10 @@ public class MenuController extends Controller{ replaceSceneContent(SceneCode.INITIAL); } + public void goToHelp() { + createPopUpStage(SceneCode.HELP, 600, 400); + } + public void load() { //nothing to load } diff --git a/src/main/resources/getting_started.fxml b/src/main/resources/getting_started.fxml index da88619..f8510bc 100644 --- a/src/main/resources/getting_started.fxml +++ b/src/main/resources/getting_started.fxml @@ -40,7 +40,7 @@ -