From c80aa8efc1df26d7a557bc231c65805de3827b46 Mon Sep 17 00:00:00 2001 From: Vladimir ELazar Tokarev Date: Sun, 12 Jun 2016 13:18:01 +0300 Subject: [PATCH] Removed the adding/removing logic from PSD controller The only thing that the controller of the Polling Station Dashboard suppose to do is to handle events (not manage the llogic of adding or removing actual parts/panels to the main stage ) this is why this logic is now mainteined in saparated objects as Settings Visual Updater or Status Log Visual Updater --- .../StatusLog/fxml/status_log.fxml | 2 +- .../StatusLog/java/StatusLogController.java | 14 --- .../StatusLog/java/StatusLogLoader.java | 5 +- .../fxml/polling_station_dashboard.fxml | 8 +- .../PollingStationDashboardController.java | 115 ++++-------------- .../java/PollingStationDashboardLoader.java | 27 ++-- .../settings/fxml/settings.fxml | 2 +- .../settings/java/SettingsVisualUpdater.java | 60 +++++++++ .../settings/java/settingsController.java | 12 -- .../settings/java/settingsLoader.java | 5 +- .../java/StatusLogVisualUpdater.java | 63 ++++++++++ 11 files changed, 174 insertions(+), 139 deletions(-) create mode 100644 voting-station-gui/src/polling_station_dashboard/settings/java/SettingsVisualUpdater.java create mode 100644 voting-station-gui/src/polling_station_dashboard/statusLog/java/StatusLogVisualUpdater.java diff --git a/voting-station-gui/src/polling_station_dashboard/StatusLog/fxml/status_log.fxml b/voting-station-gui/src/polling_station_dashboard/StatusLog/fxml/status_log.fxml index eb1a5b0..180f299 100644 --- a/voting-station-gui/src/polling_station_dashboard/StatusLog/fxml/status_log.fxml +++ b/voting-station-gui/src/polling_station_dashboard/StatusLog/fxml/status_log.fxml @@ -9,7 +9,7 @@ - +
diff --git a/voting-station-gui/src/polling_station_dashboard/StatusLog/java/StatusLogController.java b/voting-station-gui/src/polling_station_dashboard/StatusLog/java/StatusLogController.java index aeda2d5..05541e8 100644 --- a/voting-station-gui/src/polling_station_dashboard/StatusLog/java/StatusLogController.java +++ b/voting-station-gui/src/polling_station_dashboard/StatusLog/java/StatusLogController.java @@ -1,6 +1,5 @@ package polling_station_dashboard.statusLog.java; -import javafx.fxml.FXML; import javafx.stage.Stage; /** @@ -10,21 +9,8 @@ import javafx.stage.Stage; public class StatusLogController { private Stage primaryStage; - private StatusLogUpdate statusLogUpdater; - - public void SetStatusLogUpdater(StatusLogUpdate updater){ - statusLogUpdater = updater; - } public void SetStage(Stage stage){ primaryStage = stage; } - - @FXML - private void CloseStatusLog(){ - // UpdateStatusLog is called from open status log object which means that - // the current UpdateStatusLog will close it - statusLogUpdater.UpdateStatusLog(); - } - } diff --git a/voting-station-gui/src/polling_station_dashboard/StatusLog/java/StatusLogLoader.java b/voting-station-gui/src/polling_station_dashboard/StatusLog/java/StatusLogLoader.java index 1824bfe..9c725ca 100644 --- a/voting-station-gui/src/polling_station_dashboard/StatusLog/java/StatusLogLoader.java +++ b/voting-station-gui/src/polling_station_dashboard/StatusLog/java/StatusLogLoader.java @@ -16,12 +16,10 @@ public class StatusLogLoader { private Stage currentStage; private FXMLLoader fxmlLoader; - private StatusLogUpdate statusLogUpdater; - public StatusLogLoader (Stage primaryStage, StatusLogUpdate updater) throws IOException + public StatusLogLoader (Stage primaryStage) throws IOException { currentStage = primaryStage; - statusLogUpdater = updater; fxmlLoader = new FXMLLoader(getClass().getResource(STATUS_LOG_FXML_PATH)); } @@ -29,7 +27,6 @@ public class StatusLogLoader { GridPane StatusLog = fxmlLoader.load(); StatusLogController controller = fxmlLoader.getController(); controller.SetStage(currentStage); - controller.SetStatusLogUpdater(statusLogUpdater); return StatusLog; } diff --git a/voting-station-gui/src/polling_station_dashboard/fxml/polling_station_dashboard.fxml b/voting-station-gui/src/polling_station_dashboard/fxml/polling_station_dashboard.fxml index b3af86e..b870502 100644 --- a/voting-station-gui/src/polling_station_dashboard/fxml/polling_station_dashboard.fxml +++ b/voting-station-gui/src/polling_station_dashboard/fxml/polling_station_dashboard.fxml @@ -25,7 +25,7 @@ -