Ended the settings panel
for now we have all the main flow vor the voter voting process (without all the logic for example the logic of fetching from server who else is voting right now is not existing, etc'...)voting-station-gui
parent
725589ddfc
commit
b7d8c887ec
|
@ -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 {
|
||||
|
|
|
@ -72,9 +72,9 @@
|
|||
<Button fx:id="StatusLogButton" layoutX="-251.0" layoutY="250.0" mnemonicParsing="false" onMousePressed="#OnStatusLogPressed" prefHeight="43.0" prefWidth="545.0" rotate="-90.0" text="Status Log" />
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane layoutY="557.0" prefHeight="34.0" prefWidth="830.0">
|
||||
<Pane fx:id="Settings" layoutX="20" layoutY="557.0" prefHeight="34.0" prefWidth="830.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" prefHeight="34.0" prefWidth="790.0" text="Settings" />
|
||||
<Button fx:id="SettingsButton" onMousePressed="#OnSettingsPressed" mnemonicParsing="false" prefHeight="34.0" prefWidth="790.0" text="Settings" />
|
||||
</children>
|
||||
</Pane>
|
||||
</children>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<GridPane fx:id="SettingsGridPane" prefHeight="70.0" prefWidth="850.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="polling_station_dashboard.StatusLog.java.StatusLogController">
|
||||
<GridPane fx:id="SettingsGridPane" prefHeight="70.0" prefWidth="850.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="polling_station_dashboard.settings.java.settingsController">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="177.0" minWidth="10.0" prefWidth="177.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="172.0" minWidth="10.0" prefWidth="144.0" />
|
||||
|
@ -19,7 +19,7 @@
|
|||
<RowConstraints maxHeight="561.0" minHeight="10.0" prefHeight="561.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<GridPane GridPane.rowIndex="1">
|
||||
<GridPane onMousePressed="#CloseSettings" GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="10.0" prefWidth="53.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="125.0" minWidth="10.0" prefWidth="117.0" />
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- Created By Vladimir Eliezer Tokarev !-->
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<GridPane fx:id="StatusLogGridPane" prefHeight="70.0" prefWidth="850.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="polling_station_dashboard.StatusLog.java.StatusLogController">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="177.0" minWidth="10.0" prefWidth="177.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="172.0" minWidth="10.0" prefWidth="144.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="216.0" minWidth="10.0" prefWidth="200.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="165.0" minWidth="10.0" prefWidth="136.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="202.0" minHeight="0.0" prefHeight="54.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="561.0" minHeight="10.0" prefHeight="561.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<GridPane GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="10.0" prefWidth="53.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="125.0" minWidth="10.0" prefWidth="117.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||
<right>
|
||||
<ImageView BorderPane.alignment="CENTER">
|
||||
<image>
|
||||
<Image url="@../../pictures/bullets.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</right>
|
||||
</BorderPane>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||
<left>
|
||||
<Label text="Manage voting booths" BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
<GridPane GridPane.columnIndex="1" GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="10.0" prefWidth="57.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="128.0" minWidth="10.0" prefWidth="113.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||
<left>
|
||||
<Label text="Manage Polls workers" BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
</BorderPane>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||
<right>
|
||||
<ImageView BorderPane.alignment="CENTER">
|
||||
<image>
|
||||
<Image url="@../../pictures/women.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</right>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
<GridPane GridPane.columnIndex="2" GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="79.0" minWidth="10.0" prefWidth="60.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="120.0" minWidth="10.0" prefWidth="110.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||
<left>
|
||||
<Label text="Manage provisional votes" BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
</BorderPane>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||
<right>
|
||||
<ImageView BorderPane.alignment="CENTER">
|
||||
<image>
|
||||
<Image url="@../../pictures/settings.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</right>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
<GridPane GridPane.columnIndex="3" GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="76.0" minWidth="10.0" prefWidth="54.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="108.0" minWidth="10.0" prefWidth="108.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||
<left>
|
||||
<Label text="Close polling station" BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
</BorderPane>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||
<right>
|
||||
<ImageView BorderPane.alignment="CENTER">
|
||||
<image>
|
||||
<Image url="@../../pictures/exit.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</right>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</GridPane>
|
Loading…
Reference in New Issue