From 541a6666fcaada7400b94acf71ffb5bb030ddf07 Mon Sep 17 00:00:00 2001 From: Vladimir ELazar Tokarev Date: Sat, 28 May 2016 17:45:34 +0300 Subject: [PATCH] Reformated the structure of single scene The meerkat gui is an project consist of scenes every scene is an panel, now every panel have the loader class which loads it content and the handler object which handles the visual effects as mouse clicked etc'... --- .../polling_station_dashboard.fxml | 2 +- .../SetUpCompleteController.java | 8 ----- .../{ => fxml}/set_up_complete.fxml | 16 +++------- .../java/SetUpCompleteController.java | 18 +++++++++++ .../java/SetUpCompleteLoader.java | 32 +++++++++++++++++++ .../fxml/spalsh_screen_on_boot.fxml | 7 +--- .../src/splash_screen_on_boot/java/Main.java | 6 +++- ...ler.java => SplashScreenOnBootLoader.java} | 25 +++++++-------- .../fxml/uploading_to_bulletin_board.fxml | 4 +-- .../UploadingToBulletinBoardController.java | 23 ++++--------- .../java/UploadingToBulletinBoardLoader.java | 32 +++++++++++++++++++ 11 files changed, 113 insertions(+), 60 deletions(-) delete mode 100644 voting-station-gui/src/set_up_complete/SetUpCompleteController.java rename voting-station-gui/src/set_up_complete/{ => fxml}/set_up_complete.fxml (89%) create mode 100644 voting-station-gui/src/set_up_complete/java/SetUpCompleteController.java create mode 100644 voting-station-gui/src/set_up_complete/java/SetUpCompleteLoader.java rename voting-station-gui/src/splash_screen_on_boot/java/{SplashScreenOnBootController.java => SplashScreenOnBootLoader.java} (72%) create mode 100644 voting-station-gui/src/uploading_to_bulletin_board/java/UploadingToBulletinBoardLoader.java diff --git a/voting-station-gui/src/polling_station_dashboard/polling_station_dashboard.fxml b/voting-station-gui/src/polling_station_dashboard/polling_station_dashboard.fxml index 71ff492..349b158 100644 --- a/voting-station-gui/src/polling_station_dashboard/polling_station_dashboard.fxml +++ b/voting-station-gui/src/polling_station_dashboard/polling_station_dashboard.fxml @@ -7,7 +7,7 @@ - + diff --git a/voting-station-gui/src/set_up_complete/SetUpCompleteController.java b/voting-station-gui/src/set_up_complete/SetUpCompleteController.java deleted file mode 100644 index f5c54b1..0000000 --- a/voting-station-gui/src/set_up_complete/SetUpCompleteController.java +++ /dev/null @@ -1,8 +0,0 @@ -package set_up_complete; - -/** - * Created by Vladimir Eliezer Tokarev on 28/05/2016. - */ -public class SetUpCompleteController { - -} diff --git a/voting-station-gui/src/set_up_complete/set_up_complete.fxml b/voting-station-gui/src/set_up_complete/fxml/set_up_complete.fxml similarity index 89% rename from voting-station-gui/src/set_up_complete/set_up_complete.fxml rename to voting-station-gui/src/set_up_complete/fxml/set_up_complete.fxml index 6b0fce6..13c6331 100644 --- a/voting-station-gui/src/set_up_complete/set_up_complete.fxml +++ b/voting-station-gui/src/set_up_complete/fxml/set_up_complete.fxml @@ -2,18 +2,12 @@ - - - - + + - - - - - + @@ -26,7 +20,7 @@ - + @@ -34,8 +28,6 @@ - - diff --git a/voting-station-gui/src/set_up_complete/java/SetUpCompleteController.java b/voting-station-gui/src/set_up_complete/java/SetUpCompleteController.java new file mode 100644 index 0000000..e45fcf5 --- /dev/null +++ b/voting-station-gui/src/set_up_complete/java/SetUpCompleteController.java @@ -0,0 +1,18 @@ +package set_up_complete.java; + +import javafx.stage.Stage; + +/** + * Created by Vladimir Eliezer Tokarev on 28/05/2016. + * SetUpCompleteController controls the behavior (buttons clicks mouse drags etc'...) + */ +public class SetUpCompleteController { + + private Stage currentStage; + + public void SetStage(Stage primaryStage) + { + this.currentStage = primaryStage; + } + +} diff --git a/voting-station-gui/src/set_up_complete/java/SetUpCompleteLoader.java b/voting-station-gui/src/set_up_complete/java/SetUpCompleteLoader.java new file mode 100644 index 0000000..08dc27a --- /dev/null +++ b/voting-station-gui/src/set_up_complete/java/SetUpCompleteLoader.java @@ -0,0 +1,32 @@ +package set_up_complete.java; + +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; +import uploading_to_bulletin_board.java.UploadingToBulletinBoardController; + +import java.io.IOException; + +/** + * Created by Vladimir Eliezer Tokarev on 28/05/2016. + * SetUpCompleteLoader represent the end state of subscription to bulletin board + */ +public class SetUpCompleteLoader { + private static final String SET_UP_COMPLETE_PATH = "../fxml/set_up_complete.fxml"; + + private Stage currentStage; + + public SetUpCompleteLoader (Stage primaryStage) throws IOException + { + currentStage = primaryStage; + FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(SET_UP_COMPLETE_PATH)); + Parent root = fxmlLoader.load(); + SetUpCompleteController controller = fxmlLoader.getController(); + controller.SetStage(currentStage); + + currentStage.setTitle("Set Up Complete"); + currentStage.setScene(new Scene(root, 560, 310)); + currentStage.show(); + } +} diff --git a/voting-station-gui/src/splash_screen_on_boot/fxml/spalsh_screen_on_boot.fxml b/voting-station-gui/src/splash_screen_on_boot/fxml/spalsh_screen_on_boot.fxml index d9362d6..c908ee4 100644 --- a/voting-station-gui/src/splash_screen_on_boot/fxml/spalsh_screen_on_boot.fxml +++ b/voting-station-gui/src/splash_screen_on_boot/fxml/spalsh_screen_on_boot.fxml @@ -5,14 +5,9 @@ - - - - - - + diff --git a/voting-station-gui/src/splash_screen_on_boot/java/Main.java b/voting-station-gui/src/splash_screen_on_boot/java/Main.java index 2d16e43..7ef3bc9 100644 --- a/voting-station-gui/src/splash_screen_on_boot/java/Main.java +++ b/voting-station-gui/src/splash_screen_on_boot/java/Main.java @@ -3,11 +3,15 @@ package splash_screen_on_boot.java; import javafx.application.Application; import javafx.stage.Stage; + +/** + * Created by Vladimir Eliezer Tokarev on 28/05/2016. + */ public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ - new SplashScreenOnBootController(primaryStage); + new SplashScreenOnBootLoader(primaryStage); primaryStage.setTitle("Meerkat"); primaryStage.show(); } diff --git a/voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootController.java b/voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootLoader.java similarity index 72% rename from voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootController.java rename to voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootLoader.java index 464f7dd..e83007c 100644 --- a/voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootController.java +++ b/voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootLoader.java @@ -5,23 +5,22 @@ import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; -import uploading_to_bulletin_board.java.UploadingToBulletinBoardController; +import uploading_to_bulletin_board.java.UploadingToBulletinBoardLoader; import java.io.IOException; /** - * SplashScreenOnBootController starts the entry point into meerkat it displays the loading + * Created by Vladimir Eliezer Tokarev on 28/05/2016. + * SplashScreenOnBootLoader starts the entry point into meerkat it displays the loading */ -public class SplashScreenOnBootController { +public class SplashScreenOnBootLoader { private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "../fxml/spalsh_screen_on_boot.fxml"; - private static final int TWO_SECONDS_TIMEOUT_IN_MILLISECONDS = 2000; + private static final int TWO_SECONDS_TIMEOUT_IN_MILLISECONDS = 1000; - /** The primary stage which displays data, should pass it to next controller **/ private Stage currentStage; - - public SplashScreenOnBootController(Stage primaryStage) throws IOException + public SplashScreenOnBootLoader(Stage primaryStage) throws IOException { Parent splashScreenOnBootRoot = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH)); currentStage = primaryStage; @@ -46,7 +45,7 @@ public class SplashScreenOnBootController { try { StartUploadingToBulletinBoard(); } catch (IOException e) { - System.out.println("Could not create new uploading to bulletin board scene!"); + e.printStackTrace(); } }); new Thread(sleeper).start(); @@ -55,12 +54,10 @@ public class SplashScreenOnBootController { /** * Creates instance of uploading to bulletin board and set it as the scene */ - private void StartUploadingToBulletinBoard() throws IOException { - new UploadingToBulletinBoardController(currentStage); + private void StartUploadingToBulletinBoard() throws IOException + { + new UploadingToBulletinBoardLoader(currentStage); } - /** - * Needed for normal output flow - */ - public SplashScreenOnBootController(){} + } diff --git a/voting-station-gui/src/uploading_to_bulletin_board/fxml/uploading_to_bulletin_board.fxml b/voting-station-gui/src/uploading_to_bulletin_board/fxml/uploading_to_bulletin_board.fxml index afa87e8..4477b42 100644 --- a/voting-station-gui/src/uploading_to_bulletin_board/fxml/uploading_to_bulletin_board.fxml +++ b/voting-station-gui/src/uploading_to_bulletin_board/fxml/uploading_to_bulletin_board.fxml @@ -13,7 +13,7 @@ - + @@ -141,7 +141,7 @@
-
diff --git a/voting-station-gui/src/uploading_to_bulletin_board/java/UploadingToBulletinBoardController.java b/voting-station-gui/src/uploading_to_bulletin_board/java/UploadingToBulletinBoardController.java index 880dd3d..77309b6 100644 --- a/voting-station-gui/src/uploading_to_bulletin_board/java/UploadingToBulletinBoardController.java +++ b/voting-station-gui/src/uploading_to_bulletin_board/java/UploadingToBulletinBoardController.java @@ -1,36 +1,27 @@ package uploading_to_bulletin_board.java; import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.scene.Scene; import javafx.stage.Stage; +import set_up_complete.java.SetUpCompleteLoader; import java.io.IOException; /** * Created by Vladimir Eliezer Tokarev on 28/05/2016. + * UploadingToBulletinBoardController controls the behavior (buttons clicks mouse drags etc'...) */ public class UploadingToBulletinBoardController { - private static final String UPLOADING_TO_BULLETIN_BOARD_FXM_PATH = "../fxml/uploading_to_bulletin_board.fxml"; - protected Parent UploadToBulletinBoardRoot; + private Stage currentStage; - public UploadingToBulletinBoardController(Stage primaryStage) throws IOException + public void SetStage(Stage primaryStage) { - UploadToBulletinBoardRoot = FXMLLoader.load(getClass().getResource(UPLOADING_TO_BULLETIN_BOARD_FXM_PATH)); - primaryStage.setScene(new Scene(UploadToBulletinBoardRoot, 565, 365)); - primaryStage.show(); + this.currentStage = primaryStage; } - - /** - * Method called when the override button had been clicked/pressed - */ @FXML - private void Override() - { - + private void Override() throws IOException { + new SetUpCompleteLoader(currentStage); } } diff --git a/voting-station-gui/src/uploading_to_bulletin_board/java/UploadingToBulletinBoardLoader.java b/voting-station-gui/src/uploading_to_bulletin_board/java/UploadingToBulletinBoardLoader.java new file mode 100644 index 0000000..0844f82 --- /dev/null +++ b/voting-station-gui/src/uploading_to_bulletin_board/java/UploadingToBulletinBoardLoader.java @@ -0,0 +1,32 @@ +package uploading_to_bulletin_board.java; + +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.io.IOException; + +/** + * Created by Vladimir Eliezer Tokarev on 28/05/2016. + * UploadingToBulletinBoardLoader uploads the given code to the bulletin board + */ +public class UploadingToBulletinBoardLoader { + private static final String UPLOADING_TO_BULLETIN_BOARD_FXM_PATH = "../fxml/uploading_to_bulletin_board.fxml"; + + private Stage currentStage; + + public UploadingToBulletinBoardLoader(Stage primaryStage) throws IOException + { + FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(UPLOADING_TO_BULLETIN_BOARD_FXM_PATH)); + Parent root = fxmlLoader.load(); + UploadingToBulletinBoardController controller = fxmlLoader.getController(); + + currentStage = primaryStage; + currentStage.setTitle("Uploading To Bulletin Board"); + currentStage.setScene(new Scene(root, 565, 365)); + currentStage.show(); + + controller.SetStage(currentStage); + } +}