From 213ab2a4ea51b6a071cf180a1da15a308bcdbeb7 Mon Sep 17 00:00:00 2001 From: Vladimir ELazar Tokarev Date: Sat, 28 May 2016 13:12:30 +0300 Subject: [PATCH] Created spesific package for every fxml I have come to conclusoin (after few projects inspection) thatevery fxml should have his own conroller and its own java class that represents it and loads it. --- .../polling_station_dashboard.fxml | 0 .../set_up_complete.fxml | 0 .../src/splash_screen_on_boot/Main.java | 41 +------------------ .../spalsh_screen_on_boot.fxml | 0 .../uploading_to_bulletin_board.fxml | 0 5 files changed, 1 insertion(+), 40 deletions(-) rename voting-station-gui/src/{fxmls => polling_station_dashboard}/polling_station_dashboard.fxml (100%) rename voting-station-gui/src/{fxmls => set_up_complete}/set_up_complete.fxml (100%) rename voting-station-gui/src/{fxmls => splash_screen_on_boot}/spalsh_screen_on_boot.fxml (100%) rename voting-station-gui/src/{fxmls => uploading_to_bulletin_board}/uploading_to_bulletin_board.fxml (100%) diff --git a/voting-station-gui/src/fxmls/polling_station_dashboard.fxml b/voting-station-gui/src/polling_station_dashboard/polling_station_dashboard.fxml similarity index 100% rename from voting-station-gui/src/fxmls/polling_station_dashboard.fxml rename to voting-station-gui/src/polling_station_dashboard/polling_station_dashboard.fxml diff --git a/voting-station-gui/src/fxmls/set_up_complete.fxml b/voting-station-gui/src/set_up_complete/set_up_complete.fxml similarity index 100% rename from voting-station-gui/src/fxmls/set_up_complete.fxml rename to voting-station-gui/src/set_up_complete/set_up_complete.fxml diff --git a/voting-station-gui/src/splash_screen_on_boot/Main.java b/voting-station-gui/src/splash_screen_on_boot/Main.java index 50a8388..952c8c7 100644 --- a/voting-station-gui/src/splash_screen_on_boot/Main.java +++ b/voting-station-gui/src/splash_screen_on_boot/Main.java @@ -2,46 +2,15 @@ package splash_screen_on_boot; import javafx.application.Application; import javafx.fxml.FXMLLoader; -import javafx.scene.Node; 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; -import java.util.concurrent.ThreadFactory; public class Main extends Application { private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "../fxmls/spalsh_screen_on_boot.fxml"; - private static final String FXMLS_DIRECTORY_PATH = "../fxmls/"; - - 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_DIRECTORY_PATH).getPath().replace("%20", " "); - List filesNames = listFilesForFolder(new File(fxmlsFolderPath)); - return filesNames; - } - - private List Boards; - - private void loadAllFxmls() throws IOException, InterruptedException { - Boards = new ArrayList<>(); - for (String filename : getNamesOfAllFxmls()) { - Boards.add(FXMLLoader.load(getClass().getResource(FXMLS_DIRECTORY_PATH + filename))); - } - } private Parent loadStartingPanel(Stage primaryStage) throws IOException { Parent root = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH)); @@ -51,17 +20,9 @@ public class Main extends Application { return root; } - private void removeLoadingGif(Parent root) throws InterruptedException { - Node loadingGif = root.lookup("#LoadingGif"); - loadingGif.setVisible(false); - } - @Override public void start(Stage primaryStage) throws Exception{ - Parent root = loadStartingPanel(primaryStage); - System.out.println(0); - loadAllFxmls(); - //removeLoadingGif(root); + loadStartingPanel(primaryStage); } public static void main(String[] args) throws InterruptedException { diff --git a/voting-station-gui/src/fxmls/spalsh_screen_on_boot.fxml b/voting-station-gui/src/splash_screen_on_boot/spalsh_screen_on_boot.fxml similarity index 100% rename from voting-station-gui/src/fxmls/spalsh_screen_on_boot.fxml rename to voting-station-gui/src/splash_screen_on_boot/spalsh_screen_on_boot.fxml diff --git a/voting-station-gui/src/fxmls/uploading_to_bulletin_board.fxml b/voting-station-gui/src/uploading_to_bulletin_board/uploading_to_bulletin_board.fxml similarity index 100% rename from voting-station-gui/src/fxmls/uploading_to_bulletin_board.fxml rename to voting-station-gui/src/uploading_to_bulletin_board/uploading_to_bulletin_board.fxml