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 1ceabb0..5753f6e 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
@@ -12,7 +12,7 @@ import java.io.IOException;
*/
public class StatusLogLoader {
- private static final String POLLING_STATION_DASHBOARD_FXML_PATH = "../fxml/settings.fxml";
+ private static final String STATUS_LOG_FXML_PATH = "../fxml/status_log.fxml";
private Stage currentStage;
private FXMLLoader fxmlLoader;
@@ -22,7 +22,7 @@ public class StatusLogLoader {
{
currentStage = primaryStage;
statusLogUpdater = updater;
- fxmlLoader = new FXMLLoader(getClass().getResource(POLLING_STATION_DASHBOARD_FXML_PATH));
+ fxmlLoader = new FXMLLoader(getClass().getResource(STATUS_LOG_FXML_PATH));
}
public GridPane GetStatusLogInstance() throws IOException {
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 f755ce7..b3af86e 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
@@ -72,9 +72,9 @@
-
+
-
+
diff --git a/voting-station-gui/src/polling_station_dashboard/java/PollingStationDashboardController.java b/voting-station-gui/src/polling_station_dashboard/java/PollingStationDashboardController.java
index 234ea19..0884fe6 100644
--- a/voting-station-gui/src/polling_station_dashboard/java/PollingStationDashboardController.java
+++ b/voting-station-gui/src/polling_station_dashboard/java/PollingStationDashboardController.java
@@ -14,10 +14,15 @@ import polling_station_dashboard.settings.java.SettingsUpdate;
*/
public class PollingStationDashboardController implements StatusLogUpdate, SettingsUpdate {
+ private static final int STATUS_LOG_WIDTH_EXPANSION_VALUE = 400;
+ private static final int SETTINGS_HEIGHT_EXPANSION_VALUE = 60;
+
private Stage currentStage;
private GridPane statusLog;
+ private GridPane settings;
private boolean statusLogOpened = false;
+ private boolean settingsOpened = false;
public void SetStage(Stage primaryStage) {
this.currentStage = primaryStage;
@@ -27,49 +32,89 @@ public class PollingStationDashboardController implements StatusLogUpdate, Setti
this.statusLog = statusLog;
}
+
+ @FXML
+ private void OnStatusLogPressed() {
+ UpdateStatusLog();
+ }
+
@Override
public void UpdateStatusLog(){
showStatusLogButton(statusLogOpened);
if (!statusLogOpened) {
- SetStatusLogSize(400);
+ SetStatusLogSize(STATUS_LOG_WIDTH_EXPANSION_VALUE);
addStatusLog();
}
else {
- SetStatusLogSize(-400);
+ SetStatusLogSize(-STATUS_LOG_WIDTH_EXPANSION_VALUE);
removeStatusLog();
}
statusLogOpened = !statusLogOpened;
}
- @Override
- public void UpdateSettings() {
-
- }
-
-
private void showStatusLogButton(boolean showOrNot){
Button statusLogButton = (Button) currentStage.getScene().lookup("#StatusLogButton");
statusLogButton.setVisible(showOrNot);
}
private void addStatusLog() {
- Pane statusLogPane = (Pane) currentStage.getScene().lookup("#StatusLog");
- statusLogPane.getChildren().add(statusLog);
+ Pane statusLog = (Pane) currentStage.getScene().lookup("#StatusLog");
+ statusLog.getChildren().add(this.statusLog);
}
private void removeStatusLog(){
- Pane statusLogPane = (Pane) currentStage.getScene().lookup("#StatusLog");
- statusLogPane.getChildren().remove(statusLog);
+ Pane statusLog = (Pane) currentStage.getScene().lookup("#StatusLog");
+ statusLog.getChildren().remove(this.statusLog);
}
private void SetStatusLogSize(int expansionWidth) {
currentStage.setWidth(currentStage.getWidth() + expansionWidth);
- Pane statusLogPane = (Pane) currentStage.getScene().lookup("#StatusLog");
- statusLogPane.setPrefWidth(expansionWidth);
+ Pane statusLog = (Pane) currentStage.getScene().lookup("#StatusLog");
+ statusLog.setPrefWidth(expansionWidth);
}
@FXML
- private void OnStatusLogPressed() {
- UpdateStatusLog();
+ private void OnSettingsPressed() {
+ UpdateSettings();
+ }
+
+ public void SetSettings(GridPane settings){
+ this.settings = settings;
+ }
+
+ @Override
+ public void UpdateSettings() {
+ showSettingsButton(settingsOpened);
+ System.out.println(settingsOpened);
+ if (!settingsOpened) {
+ SetSettingsSize(SETTINGS_HEIGHT_EXPANSION_VALUE);
+ addSettings();
+ }
+ else {
+ SetSettingsSize(-SETTINGS_HEIGHT_EXPANSION_VALUE);
+ removeSettings();
+ }
+ settingsOpened = !settingsOpened;
+ }
+
+ private void SetSettingsSize(int expansionHeight) {
+ currentStage.setHeight(currentStage.getHeight() + expansionHeight);
+ Pane statusLog = (Pane) currentStage.getScene().lookup("#Settings");
+ statusLog.setPrefHeight(expansionHeight);
+ }
+
+ private void showSettingsButton(boolean showOrNot){
+ Button settings = (Button) currentStage.getScene().lookup("#SettingsButton");
+ settings.setVisible(showOrNot);
+ }
+
+ private void addSettings() {
+ Pane settingsPane = (Pane) currentStage.getScene().lookup("#Settings");
+ settingsPane.getChildren().add(settings);
+ }
+
+ private void removeSettings(){
+ Pane settingsPane = (Pane) currentStage.getScene().lookup("#Settings");
+ settingsPane.getChildren().remove(settings);
}
}
diff --git a/voting-station-gui/src/polling_station_dashboard/java/PollingStationDashboardLoader.java b/voting-station-gui/src/polling_station_dashboard/java/PollingStationDashboardLoader.java
index 1a030dd..baf782e 100644
--- a/voting-station-gui/src/polling_station_dashboard/java/PollingStationDashboardLoader.java
+++ b/voting-station-gui/src/polling_station_dashboard/java/PollingStationDashboardLoader.java
@@ -5,6 +5,7 @@ import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import polling_station_dashboard.StatusLog.java.StatusLogLoader;
+import polling_station_dashboard.settings.java.settingsLoader;
import java.io.IOException;
@@ -20,6 +21,9 @@ public class PollingStationDashboardLoader {
public PollingStationDashboardLoader (Stage primaryStage) throws IOException
{
+ primaryStage.setX(100);
+ primaryStage.setY(100);
+
currentStage = primaryStage;
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(POLLING_STATION_DASHBOARD_FXML_PATH));
Parent root = fxmlLoader.load();
@@ -29,9 +33,14 @@ public class PollingStationDashboardLoader {
currentStage.setScene(new Scene(root, 850, 615));
currentStage.show();
+ // create the status log object
StatusLogLoader statusLogLoader = new StatusLogLoader(currentStage, controller);
controller.SetStage(currentStage);
controller.SetStatusLog(statusLogLoader.GetStatusLogInstance());
+ // create the settings object
+ settingsLoader settingsLoader = new settingsLoader(currentStage, controller);
+ controller.SetSettings(settingsLoader.GetSettingsInstance());
+
}
}
diff --git a/voting-station-gui/src/polling_station_dashboard/settings/fxml/settings.fxml b/voting-station-gui/src/polling_station_dashboard/settings/fxml/settings.fxml
index 4ca13cc..66b18bd 100644
--- a/voting-station-gui/src/polling_station_dashboard/settings/fxml/settings.fxml
+++ b/voting-station-gui/src/polling_station_dashboard/settings/fxml/settings.fxml
@@ -6,7 +6,7 @@
-
+
@@ -19,7 +19,7 @@
-
+
diff --git a/voting-station-gui/src/polling_station_dashboard/settings/java/settingsController.java b/voting-station-gui/src/polling_station_dashboard/settings/java/settingsController.java
index 0bdb122..84fdc53 100644
--- a/voting-station-gui/src/polling_station_dashboard/settings/java/settingsController.java
+++ b/voting-station-gui/src/polling_station_dashboard/settings/java/settingsController.java
@@ -1,5 +1,6 @@
package polling_station_dashboard.settings.java;
+import javafx.fxml.FXML;
import javafx.stage.Stage;
/**
@@ -19,4 +20,10 @@ public class settingsController {
this.settingsUpdater = updater;
}
+ @FXML
+ private void CloseSettings(){
+ // UpdateStatusLog is called from open status log object which means that
+ // the current UpdateStatusLog will close it
+ this.settingsUpdater.UpdateSettings();
+ }
}
diff --git a/voting-station-gui/src/polling_station_dashboard/settings/java/settingsLoader.java b/voting-station-gui/src/polling_station_dashboard/settings/java/settingsLoader.java
index 31e6557..f5bf59d 100644
--- a/voting-station-gui/src/polling_station_dashboard/settings/java/settingsLoader.java
+++ b/voting-station-gui/src/polling_station_dashboard/settings/java/settingsLoader.java
@@ -14,7 +14,7 @@ import java.io.IOException;
*/
public class settingsLoader {
- private static final String POLLING_STATION_DASHBOARD_FXML_PATH = "../fxml/settings.fxml";
+ private static final String SETTINGS_FXML_PATH = "../fxml/settings.fxml";
private Stage currentStage;
private FXMLLoader fxmlLoader;
@@ -24,7 +24,7 @@ public class settingsLoader {
{
currentStage = primaryStage;
settingsUpdater = updater;
- fxmlLoader = new FXMLLoader(getClass().getResource(POLLING_STATION_DASHBOARD_FXML_PATH));
+ fxmlLoader = new FXMLLoader(getClass().getResource(SETTINGS_FXML_PATH));
}
public GridPane GetSettingsInstance() throws IOException {
diff --git a/voting-station-gui/src/polling_station_dashboard/settings/settings.fxml b/voting-station-gui/src/polling_station_dashboard/settings/settings.fxml
new file mode 100644
index 0000000..aa6b371
--- /dev/null
+++ b/voting-station-gui/src/polling_station_dashboard/settings/settings.fxml
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+