From 6e6183bf3818225e10ea1077fd625ab31de0110d Mon Sep 17 00:00:00 2001 From: Alex Rechtin Date: Tue, 18 Jan 2022 12:45:18 +0100 Subject: [PATCH] Updated create-user, css and the controller --- .../main/java/users/CreateUserController.java | 36 ++++++++---- .../src/main/resources/users/create-user.css | 55 +++++++++++++++++++ .../src/main/resources/users/create-user.fxml | 46 +++++++++++----- 3 files changed, 111 insertions(+), 26 deletions(-) diff --git a/client/app/src/main/java/users/CreateUserController.java b/client/app/src/main/java/users/CreateUserController.java index e5f2b4a..e40cc43 100644 --- a/client/app/src/main/java/users/CreateUserController.java +++ b/client/app/src/main/java/users/CreateUserController.java @@ -1,10 +1,11 @@ package users; import javafx.event.ActionEvent; +import javafx.fxml.FXML; import javafx.scene.Node; -import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.control.TextField; +import javafx.scene.control.ToggleButton; import javafx.stage.Stage; import java.util.Objects; @@ -14,28 +15,41 @@ public class CreateUserController { public TextField textName; public TextField textPassword; public TextField textPasswordSecond; - public CheckBox checkBoxIsAdmin; - public Label labelErrorName; - public Label labelErrorPw; + public ToggleButton checkButtonIsAdmin; + public TextField textLogin; + public TextField textForename; + public Label labelError; + @FXML protected void createUser(ActionEvent event) { + if (textLogin.getText().trim().isEmpty()){ + labelError.setText("Bitte Login Namen angeben"); + return; + } + if (textForename.getText().trim().isEmpty()) { + labelError.setText("Bitte Vornamen eingeben!"); + return; + } if (textName.getText().trim().isEmpty()) { - labelErrorName.setText("Bitte Usernamen eingeben!"); - labelErrorPw.setText(""); + labelError.setText("Bitte Nachnamen eingeben!"); return; } if (textPassword.getText().trim().isEmpty()) { - labelErrorName.setText(""); - labelErrorPw.setText("Bitte Passwort eingeben!"); + labelError.setText("Bitte Passwort eingeben!"); return; } - if (Objects.equals(textPassword.getText(), textPasswordSecond.getText())){ - labelErrorName.setText(""); - labelErrorPw.setText("Passwörter stimmen nicht überein!"); + if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){ + labelError.setText("Passwörter stimmen nicht überein!"); return; } Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); stage.close(); } + + @FXML + protected void abortBtnClick(ActionEvent event) { + Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); + stage.close(); + } } diff --git a/client/app/src/main/resources/users/create-user.css b/client/app/src/main/resources/users/create-user.css index 8b13789..6d2ca93 100644 --- a/client/app/src/main/resources/users/create-user.css +++ b/client/app/src/main/resources/users/create-user.css @@ -1 +1,56 @@ +* { + -fx-base-background-color: #2B2D42; + -fx-base1-background-color: #525E74; + + -fx-main-border-color: #B0B0B0; + -fx-main-text-color: #ffffff; +} + + +GridPane{ + -fx-background-color: #3E415F; + -fx-padding: 20px; + -fx-font-size: 20px; + -fx-font-family: Segoe UI; + + -fx-border-insets: 1; + -fx-border-color: #B0B0B0; + -fx-border-style: solid; + -fx-border-width: 2; + -fx-effect: dropshadow(three-pass-box, rgba(100, 100, 100, 1), 24, 0.5, 0, 0); +} + +.mainLabel{ + -fx-padding: 10px; + -fx-max-width: 400px; + -fx-min-width: 400px; + -fx-font-weight: bold; + -fx-alignment: top-center; +} + + +Label{ + -fx-text-fill: white; + -fx-max-width: 150px; + -fx-min-width: 150px; +} + +.textField{ + -fx-max-width: 400px; + -fx-min-width: 400px; +} + +.errorMessage{ + -fx-max-width: 400px; + -fx-min-width: 400px; +} + +Button{ + -fx-max-width: 150px; + -fx-min-width: 150px; +} + +.btnLogin{ + -fx-font-weight: bold; +} diff --git a/client/app/src/main/resources/users/create-user.fxml b/client/app/src/main/resources/users/create-user.fxml index 29132d8..3a40ebd 100644 --- a/client/app/src/main/resources/users/create-user.fxml +++ b/client/app/src/main/resources/users/create-user.fxml @@ -2,14 +2,14 @@ + - - - - + + + @@ -19,22 +19,38 @@ + + + - + - - - - + + + + + - - - + - + + + + + -