From c97910644f8bf62372462d56cd966b376e3cd0e5 Mon Sep 17 00:00:00 2001 From: Vladimir ELazar Tokarev Date: Sat, 28 May 2016 14:15:05 +0300 Subject: [PATCH] Creating splash screen on boot then the uploader BB --- .../polling_station_dashboard.fxml | 2 +- .../src/set_up_complete/set_up_complete.fxml | 2 +- .../src/splash_screen_on_boot/Controller.java | 4 -- .../src/splash_screen_on_boot/Main.java | 31 ---------- .../{ => fxml}/spalsh_screen_on_boot.fxml | 4 +- .../src/splash_screen_on_boot/java/Main.java | 18 ++++++ .../java/SplashScreenOnBootController.java | 62 +++++++++++++++++++ .../uploading_to_bulletin_board.fxml | 2 +- 8 files changed, 85 insertions(+), 40 deletions(-) delete mode 100644 voting-station-gui/src/splash_screen_on_boot/Controller.java delete mode 100644 voting-station-gui/src/splash_screen_on_boot/Main.java rename voting-station-gui/src/splash_screen_on_boot/{ => fxml}/spalsh_screen_on_boot.fxml (98%) create mode 100644 voting-station-gui/src/splash_screen_on_boot/java/Main.java create mode 100644 voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootController.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 a22c41d..d92993b 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 @@ -5,7 +5,7 @@ - + diff --git a/voting-station-gui/src/set_up_complete/set_up_complete.fxml b/voting-station-gui/src/set_up_complete/set_up_complete.fxml index dc7321f..48d8d02 100644 --- a/voting-station-gui/src/set_up_complete/set_up_complete.fxml +++ b/voting-station-gui/src/set_up_complete/set_up_complete.fxml @@ -11,7 +11,7 @@ - + diff --git a/voting-station-gui/src/splash_screen_on_boot/Controller.java b/voting-station-gui/src/splash_screen_on_boot/Controller.java deleted file mode 100644 index 1a82be7..0000000 --- a/voting-station-gui/src/splash_screen_on_boot/Controller.java +++ /dev/null @@ -1,4 +0,0 @@ -package splash_screen_on_boot; - -public class Controller { -} diff --git a/voting-station-gui/src/splash_screen_on_boot/Main.java b/voting-station-gui/src/splash_screen_on_boot/Main.java deleted file mode 100644 index 952c8c7..0000000 --- a/voting-station-gui/src/splash_screen_on_boot/Main.java +++ /dev/null @@ -1,31 +0,0 @@ -package splash_screen_on_boot; - -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.stage.Stage; - -import java.io.IOException; - -public class Main extends Application { - - private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "../fxmls/spalsh_screen_on_boot.fxml"; - - private Parent loadStartingPanel(Stage primaryStage) throws IOException { - Parent root = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH)); - primaryStage.setTitle("Voting Station"); - primaryStage.setScene(new Scene(root, 560, 360)); - primaryStage.show(); - return root; - } - - @Override - public void start(Stage primaryStage) throws Exception{ - loadStartingPanel(primaryStage); - } - - public static void main(String[] args) throws InterruptedException { - launch(args); - } -} diff --git a/voting-station-gui/src/splash_screen_on_boot/spalsh_screen_on_boot.fxml b/voting-station-gui/src/splash_screen_on_boot/fxml/spalsh_screen_on_boot.fxml similarity index 98% rename from voting-station-gui/src/splash_screen_on_boot/spalsh_screen_on_boot.fxml rename to voting-station-gui/src/splash_screen_on_boot/fxml/spalsh_screen_on_boot.fxml index 1808651..856be2f 100644 --- a/voting-station-gui/src/splash_screen_on_boot/spalsh_screen_on_boot.fxml +++ b/voting-station-gui/src/splash_screen_on_boot/fxml/spalsh_screen_on_boot.fxml @@ -10,7 +10,7 @@ - + @@ -57,7 +57,7 @@
- +
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 new file mode 100644 index 0000000..2d16e43 --- /dev/null +++ b/voting-station-gui/src/splash_screen_on_boot/java/Main.java @@ -0,0 +1,18 @@ +package splash_screen_on_boot.java; + +import javafx.application.Application; +import javafx.stage.Stage; + +public class Main extends Application { + + @Override + public void start(Stage primaryStage) throws Exception{ + new SplashScreenOnBootController(primaryStage); + primaryStage.setTitle("Meerkat"); + primaryStage.show(); + } + + public static void main(String[] args) throws InterruptedException { + launch(args); + } +} diff --git a/voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootController.java b/voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootController.java new file mode 100644 index 0000000..e96fbb8 --- /dev/null +++ b/voting-station-gui/src/splash_screen_on_boot/java/SplashScreenOnBootController.java @@ -0,0 +1,62 @@ +package splash_screen_on_boot.java; + +import javafx.concurrent.Task; +import javafx.concurrent.WorkerStateEvent; +import javafx.event.EventHandler; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.io.IOException; + +/** + * SplashScreenOnBootController starts the entry point into meerkat it displays the loading + */ +public class SplashScreenOnBootController { + 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; + + protected Parent SplashScreenOnBootRoot; + + public SplashScreenOnBootController(Stage primaryStage) throws IOException + { + SplashScreenOnBootRoot = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH)); + primaryStage.setScene(new Scene(SplashScreenOnBootRoot, 565, 365)); + IntroSleep(); + } + + /** + * After the splash screen displayed wait - + * two seconds and than continue to StartUploadingToBulletinBoard + */ + private void IntroSleep() + { + Task sleeper = new Task() { + @Override + protected Void call() throws Exception { + try { + Thread.sleep(TWO_SECONDS_TIMEOUT_IN_MILLISECONDS); + } catch (InterruptedException e) { + } + return null; + } + }; + sleeper.setOnSucceeded(event -> StartUploadingToBulletinBoard()); + new Thread(sleeper).start(); + } + + /** + * Creates instance of uploading to bulletin board and set it as the scene + */ + private void StartUploadingToBulletinBoard() + { + + } + + /** + * Needed for normal output fllow + */ + public SplashScreenOnBootController(){} + +} diff --git a/voting-station-gui/src/uploading_to_bulletin_board/uploading_to_bulletin_board.fxml b/voting-station-gui/src/uploading_to_bulletin_board/uploading_to_bulletin_board.fxml index f9cc007..d1cee9c 100644 --- a/voting-station-gui/src/uploading_to_bulletin_board/uploading_to_bulletin_board.fxml +++ b/voting-station-gui/src/uploading_to_bulletin_board/uploading_to_bulletin_board.fxml @@ -11,7 +11,7 @@ - +