From b76bd768543713e4122d8d78a0655dd958004479 Mon Sep 17 00:00:00 2001 From: Dasha-1 Date: Fri, 20 May 2016 12:10:17 +0300 Subject: [PATCH] Created loader of all next fxmls Now we display the spalsh screen on boot then load all of the fxmls --- .../{Gifs/712 (1).gif => gifs/loadingGif.gif} | Bin voting-station-gui/src/sample/Controller.java | 4 -- voting-station-gui/src/sample/Main.java | 23 ------- .../src/splash_screen_on_boot/Controller.java | 4 ++ .../src/splash_screen_on_boot/Main.java | 56 ++++++++++++++++++ .../fxmls/spalsh_screen_on_boot.fxml} | 4 +- 6 files changed, 62 insertions(+), 29 deletions(-) rename voting-station-gui/src/{Gifs/712 (1).gif => gifs/loadingGif.gif} (100%) delete mode 100644 voting-station-gui/src/sample/Controller.java delete mode 100644 voting-station-gui/src/sample/Main.java create mode 100644 voting-station-gui/src/splash_screen_on_boot/Controller.java create mode 100644 voting-station-gui/src/splash_screen_on_boot/Main.java rename voting-station-gui/src/{sample/sample.fxml => splash_screen_on_boot/fxmls/spalsh_screen_on_boot.fxml} (97%) diff --git a/voting-station-gui/src/Gifs/712 (1).gif b/voting-station-gui/src/gifs/loadingGif.gif similarity index 100% rename from voting-station-gui/src/Gifs/712 (1).gif rename to voting-station-gui/src/gifs/loadingGif.gif diff --git a/voting-station-gui/src/sample/Controller.java b/voting-station-gui/src/sample/Controller.java deleted file mode 100644 index 54e5bd1..0000000 --- a/voting-station-gui/src/sample/Controller.java +++ /dev/null @@ -1,4 +0,0 @@ -package sample; - -public class Controller { -} diff --git a/voting-station-gui/src/sample/Main.java b/voting-station-gui/src/sample/Main.java deleted file mode 100644 index 5e8b302..0000000 --- a/voting-station-gui/src/sample/Main.java +++ /dev/null @@ -1,23 +0,0 @@ -package sample; - -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.stage.Stage; - -public class Main extends Application { - - @Override - public void start(Stage primaryStage) throws Exception{ - Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); - primaryStage.setTitle("Voting Station"); - primaryStage.setScene(new Scene(root, 560, 360)); - primaryStage.show(); - } - - - public static void main(String[] args) { - launch(args); - } -} diff --git a/voting-station-gui/src/splash_screen_on_boot/Controller.java b/voting-station-gui/src/splash_screen_on_boot/Controller.java new file mode 100644 index 0000000..1a82be7 --- /dev/null +++ b/voting-station-gui/src/splash_screen_on_boot/Controller.java @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000..313567c --- /dev/null +++ b/voting-station-gui/src/splash_screen_on_boot/Main.java @@ -0,0 +1,56 @@ +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.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class Main extends Application { + + private List listFilesForFolder(File folder) { + List filesNames = new ArrayList<>(); + for (final File fileEntry : folder.listFiles()) + { + filesNames.add(fileEntry.getName()); + } + + return filesNames; + } + + private List getNamesOfAllFxmls() throws IOException { + String fxmlsFolderPath = getClass().getResource("fxmls/").getPath().replace("%20", " "); + List filesNames = listFilesForFolder(new File(fxmlsFolderPath)); + return filesNames; + } + + private List Boards; + + private void loadAllFxmls() throws IOException { + Boards = new ArrayList<>(); + for (String filename : getNamesOfAllFxmls()) { + Boards.add(FXMLLoader.load(getClass().getResource("fxmls/" + filename))); + } + } + + @Override + public void start(Stage primaryStage) throws Exception{ + + Parent root = FXMLLoader.load(getClass().getResource("fxmls/spalsh_screen_on_boot.fxml")); + primaryStage.setTitle("Voting Station"); + primaryStage.setScene(new Scene(root, 560, 360)); + primaryStage.show(); + + loadAllFxmls(); + } + + + public static void main(String[] args) { + launch(args); + } +} diff --git a/voting-station-gui/src/sample/sample.fxml b/voting-station-gui/src/splash_screen_on_boot/fxmls/spalsh_screen_on_boot.fxml similarity index 97% rename from voting-station-gui/src/sample/sample.fxml rename to voting-station-gui/src/splash_screen_on_boot/fxmls/spalsh_screen_on_boot.fxml index f5832dc..6d15a1d 100644 --- a/voting-station-gui/src/sample/sample.fxml +++ b/voting-station-gui/src/splash_screen_on_boot/fxmls/spalsh_screen_on_boot.fxml @@ -11,7 +11,7 @@ - + @@ -61,7 +61,7 @@ - +