From d574849407127e3a7aab1875712370a5731e4049 Mon Sep 17 00:00:00 2001 From: Alex Rechtin Date: Mon, 10 Jan 2022 12:44:27 +0100 Subject: [PATCH 01/19] Created create-user.fxml,create-user.css,CreateUserController.java --- .../main/java/users/CreateUserController.java | 12 +++++++ .../src/main/resources/users/create-user.css | 1 + .../src/main/resources/users/create-user.fxml | 35 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 client/app/src/main/java/users/CreateUserController.java create mode 100644 client/app/src/main/resources/users/create-user.css create mode 100644 client/app/src/main/resources/users/create-user.fxml diff --git a/client/app/src/main/java/users/CreateUserController.java b/client/app/src/main/java/users/CreateUserController.java new file mode 100644 index 0000000..231bd99 --- /dev/null +++ b/client/app/src/main/java/users/CreateUserController.java @@ -0,0 +1,12 @@ +package users; + +import javafx.scene.control.CheckBox; +import javafx.scene.control.TextField; + +public class CreateUserController { + + public TextField textName; + public TextField textPassword; + public TextField textPasswordSecond; + public CheckBox checkBoxIsAdmin; +} diff --git a/client/app/src/main/resources/users/create-user.css b/client/app/src/main/resources/users/create-user.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/client/app/src/main/resources/users/create-user.css @@ -0,0 +1 @@ + diff --git a/client/app/src/main/resources/users/create-user.fxml b/client/app/src/main/resources/users/create-user.fxml new file mode 100644 index 0000000..837a733 --- /dev/null +++ b/client/app/src/main/resources/users/create-user.fxml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From eb55d5c6509edea368dc5db493e04fab721ac9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Tue, 11 Jan 2022 12:13:24 +0100 Subject: [PATCH 02/19] Implementet JFoenix --- client/app/build.gradle.kts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/app/build.gradle.kts b/client/app/build.gradle.kts index 6a5a8cf..9661289 100644 --- a/client/app/build.gradle.kts +++ b/client/app/build.gradle.kts @@ -16,7 +16,12 @@ application { mainClassName = "client.MainApplication" } +repositories { + mavenCentral() +} + dependencies { + implementation("com.jfoenix:jfoenix:9.0.10") implementation(project(":data")) } From 0d105be15c91111e3d1f89e4f32417505e231d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Thu, 13 Jan 2022 08:30:56 +0100 Subject: [PATCH 03/19] Created TimePicker and tried to add to grid --- .../main/java/main/CreateEventController.java | 25 ++++++++++++++----- .../src/main/java/main/MainController.java | 2 -- .../src/main/resources/main/edit-event.fxml | 6 ++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/client/app/src/main/java/main/CreateEventController.java b/client/app/src/main/java/main/CreateEventController.java index d77c407..64c6e2b 100644 --- a/client/app/src/main/java/main/CreateEventController.java +++ b/client/app/src/main/java/main/CreateEventController.java @@ -1,24 +1,24 @@ package main; +import com.jfoenix.controls.JFXTimePicker; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.control.*; +import javafx.scene.layout.GridPane; import javafx.stage.Stage; import res.DataController; import res.Event; public class CreateEventController { + @FXML + public GridPane grid; @FXML public DatePicker datePickerDate; @FXML public TextField textName; @FXML - public TextField textStart; - @FXML - public TextField textEnd; - @FXML public ComboBox ComboBoxTyp; @FXML public ComboBox ComboBoxPriotity; @@ -28,6 +28,10 @@ public class CreateEventController { public CheckBox checkBoxIsPrivate; @FXML public Label labelError; + @FXML + public JFXTimePicker timeStart; + @FXML + public JFXTimePicker timeEnd; public CreateEventController() { @@ -35,6 +39,15 @@ public class CreateEventController { @FXML public void initialize() { + JFXTimePicker timePickerStart = new JFXTimePicker(); + timeStart = timePickerStart; + timePickerStart.set24HourView(true); + grid.add(timePickerStart, 1 , 3); + + JFXTimePicker timePickerEnd = new JFXTimePicker(); + timeEnd = timePickerEnd; + timePickerEnd.set24HourView(true); + grid.add(timePickerEnd, 1 , 4); } @@ -50,8 +63,8 @@ public class CreateEventController { ComboBoxPriotity.getSelectionModel().getSelectedIndex(), checkBoxIsFullDay.isSelected(), checkBoxIsPrivate.isSelected(), - textStart.getText(), - textEnd.getText(), + timeStart.toString(), + timeEnd.toString(), datePickerDate.getValue().atStartOfDay(), (int) DataController.USER_ID ); diff --git a/client/app/src/main/java/main/MainController.java b/client/app/src/main/java/main/MainController.java index b2d8d80..5354d3a 100644 --- a/client/app/src/main/java/main/MainController.java +++ b/client/app/src/main/java/main/MainController.java @@ -1,7 +1,5 @@ package main; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.geometry.Pos; diff --git a/client/app/src/main/resources/main/edit-event.fxml b/client/app/src/main/resources/main/edit-event.fxml index 029d566..b3e3021 100644 --- a/client/app/src/main/resources/main/edit-event.fxml +++ b/client/app/src/main/resources/main/edit-event.fxml @@ -2,10 +2,10 @@ - - @@ -39,8 +39,6 @@ - - From f0405b5d8601071ea75f50dae4e246a95da8cfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Thu, 13 Jan 2022 10:11:09 +0100 Subject: [PATCH 04/19] Added timePicker to mainGrid --- client/app/src/main/java/main/CreateEventController.java | 8 +++++--- client/app/src/main/resources/main/create-event.fxml | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/app/src/main/java/main/CreateEventController.java b/client/app/src/main/java/main/CreateEventController.java index 64c6e2b..f98ffd7 100644 --- a/client/app/src/main/java/main/CreateEventController.java +++ b/client/app/src/main/java/main/CreateEventController.java @@ -13,7 +13,7 @@ import res.Event; public class CreateEventController { @FXML - public GridPane grid; + public GridPane mainGrid; @FXML public DatePicker datePickerDate; @FXML @@ -42,12 +42,14 @@ public class CreateEventController { JFXTimePicker timePickerStart = new JFXTimePicker(); timeStart = timePickerStart; timePickerStart.set24HourView(true); - grid.add(timePickerStart, 1 , 3); + timePickerStart.getStyleClass().add("timePicker"); + mainGrid.add(timePickerStart, 1 , 3); JFXTimePicker timePickerEnd = new JFXTimePicker(); timeEnd = timePickerEnd; timePickerEnd.set24HourView(true); - grid.add(timePickerEnd, 1 , 4); + timePickerEnd.getStyleClass().add("timePicker"); + mainGrid.add(timePickerEnd, 1 , 4); } diff --git a/client/app/src/main/resources/main/create-event.fxml b/client/app/src/main/resources/main/create-event.fxml index c56066c..e25fcdd 100644 --- a/client/app/src/main/resources/main/create-event.fxml +++ b/client/app/src/main/resources/main/create-event.fxml @@ -5,7 +5,7 @@ - @@ -39,8 +39,6 @@ - - From ce309581edac8817aab957b6bc8db3e101a869d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Thu, 13 Jan 2022 11:02:49 +0100 Subject: [PATCH 05/19] Added TimePicker to edit event, time is used --- .../main/java/main/CreateEventController.java | 10 +++- .../src/main/java/main/MainController.java | 2 +- .../src/main/resources/main/create-event.css | 5 ++ .../src/main/resources/main/edit-event.css | 46 ------------------- .../src/main/resources/main/edit-event.fxml | 2 +- 5 files changed, 15 insertions(+), 50 deletions(-) delete mode 100644 client/app/src/main/resources/main/edit-event.css diff --git a/client/app/src/main/java/main/CreateEventController.java b/client/app/src/main/java/main/CreateEventController.java index f98ffd7..132d8af 100644 --- a/client/app/src/main/java/main/CreateEventController.java +++ b/client/app/src/main/java/main/CreateEventController.java @@ -7,9 +7,15 @@ import javafx.scene.Node; import javafx.scene.control.*; import javafx.scene.layout.GridPane; import javafx.stage.Stage; +import javafx.util.StringConverter; +import javafx.util.converter.LocalTimeStringConverter; import res.DataController; import res.Event; +import java.time.LocalTime; +import java.time.format.FormatStyle; +import java.util.Locale; + public class CreateEventController { @FXML @@ -65,8 +71,8 @@ public class CreateEventController { ComboBoxPriotity.getSelectionModel().getSelectedIndex(), checkBoxIsFullDay.isSelected(), checkBoxIsPrivate.isSelected(), - timeStart.toString(), - timeEnd.toString(), + timeStart.getValue().toString(), + timeEnd.getValue().toString(), datePickerDate.getValue().atStartOfDay(), (int) DataController.USER_ID ); diff --git a/client/app/src/main/java/main/MainController.java b/client/app/src/main/java/main/MainController.java index 5354d3a..0b2649d 100644 --- a/client/app/src/main/java/main/MainController.java +++ b/client/app/src/main/java/main/MainController.java @@ -154,7 +154,7 @@ public class MainController { MainApplication.class.getResource("edit-event.fxml")); Scene scene = new Scene(fxmlLoader.load(), 650, 650); scene.getStylesheets().add(Objects.requireNonNull( - MainApplication.class.getResource("edit-event.css")).toExternalForm()); + MainApplication.class.getResource("create-event.css")).toExternalForm()); Stage stage = new Stage(); stage.setTitle("Termin bearbeiten"); stage.setScene(scene); diff --git a/client/app/src/main/resources/main/create-event.css b/client/app/src/main/resources/main/create-event.css index 442c669..0b7b085 100644 --- a/client/app/src/main/resources/main/create-event.css +++ b/client/app/src/main/resources/main/create-event.css @@ -43,4 +43,9 @@ Label{ -fx-max-height: 400px; -fx-wrap-text: true; -fx-font-size: 16px; +} + +.timePicker{ + -fx-background-color: white; + -fx-max-width: 150px; } \ No newline at end of file diff --git a/client/app/src/main/resources/main/edit-event.css b/client/app/src/main/resources/main/edit-event.css deleted file mode 100644 index 442c669..0000000 --- a/client/app/src/main/resources/main/edit-event.css +++ /dev/null @@ -1,46 +0,0 @@ -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); -} - -Label{ - -fx-text-fill: white; - -fx-max-width: 150px; - -fx-min-width: 150px; -} - -.mainLabel{ - -fx-background-color: #8D99AE; - -fx-padding: 10px; - -fx-max-width: 200px; - -fx-min-width: 200px; - -fx-font-weight: bold; - -fx-alignment: center; -} - -.inputField{ - -fx-padding: 10px; -} - -.mainButton{ - -fx-font-weight: bold; -} - -#labelError{ - -fx-font-weight: bold; - -fx-max-width: 1000px; - -fx-text-fill: #ff5555; - -fx-padding: 16px; - -fx-min-height: 140px; - -fx-max-height: 400px; - -fx-wrap-text: true; - -fx-font-size: 16px; -} \ No newline at end of file diff --git a/client/app/src/main/resources/main/edit-event.fxml b/client/app/src/main/resources/main/edit-event.fxml index b3e3021..1d56f3d 100644 --- a/client/app/src/main/resources/main/edit-event.fxml +++ b/client/app/src/main/resources/main/edit-event.fxml @@ -5,7 +5,7 @@ - From baeed584ab9795c9f7f5d8ec2608e97ff0210921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Fri, 14 Jan 2022 10:14:17 +0100 Subject: [PATCH 06/19] TimPicker now uses 24h time format --- client/app/src/main/java/main/CreateEventController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/app/src/main/java/main/CreateEventController.java b/client/app/src/main/java/main/CreateEventController.java index 132d8af..f3359c8 100644 --- a/client/app/src/main/java/main/CreateEventController.java +++ b/client/app/src/main/java/main/CreateEventController.java @@ -45,15 +45,20 @@ public class CreateEventController { @FXML public void initialize() { + + StringConverter defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY); + JFXTimePicker timePickerStart = new JFXTimePicker(); timeStart = timePickerStart; timePickerStart.set24HourView(true); + timePickerStart.setConverter(defaultConverter); timePickerStart.getStyleClass().add("timePicker"); mainGrid.add(timePickerStart, 1 , 3); JFXTimePicker timePickerEnd = new JFXTimePicker(); timeEnd = timePickerEnd; timePickerEnd.set24HourView(true); + timePickerEnd.setConverter(defaultConverter); timePickerEnd.getStyleClass().add("timePicker"); mainGrid.add(timePickerEnd, 1 , 4); } From 7c8b1fefb7aa61dd4b4efdfa238f8f6a14fc4546 Mon Sep 17 00:00:00 2001 From: Alex Rechtin Date: Fri, 14 Jan 2022 10:52:20 +0100 Subject: [PATCH 07/19] improved the createUserController.java and the create-user.fxml --- .../src/main/java/main/MainApplication.java | 8 +++-- .../main/java/users/CreateUserController.java | 29 +++++++++++++++++++ .../src/main/resources/users/create-user.fxml | 15 ++++++---- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/client/app/src/main/java/main/MainApplication.java b/client/app/src/main/java/main/MainApplication.java index 6efcaa1..84388ab 100644 --- a/client/app/src/main/java/main/MainApplication.java +++ b/client/app/src/main/java/main/MainApplication.java @@ -12,13 +12,17 @@ import java.util.Objects; public class MainApplication extends Application { @Override public void start(Stage stage) throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml")); + //wieder ändern zu main-view.fxml + FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("../users/create-user.fxml")); Scene scene = new Scene(fxmlLoader.load(), 1200, 700); scene.getStylesheets().add(Objects.requireNonNull( - MainApplication.class.getResource("main-view.css")).toExternalForm()); + //wieder ändern zu main-view.css + MainApplication.class.getResource("../users/create-user.css")).toExternalForm()); stage.setTitle("SharePlaner"); stage.setScene(scene); + //wieder löschen + stage.show(); FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml")); Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500); diff --git a/client/app/src/main/java/users/CreateUserController.java b/client/app/src/main/java/users/CreateUserController.java index 231bd99..e5f2b4a 100644 --- a/client/app/src/main/java/users/CreateUserController.java +++ b/client/app/src/main/java/users/CreateUserController.java @@ -1,7 +1,13 @@ package users; +import javafx.event.ActionEvent; +import javafx.scene.Node; import javafx.scene.control.CheckBox; +import javafx.scene.control.Label; import javafx.scene.control.TextField; +import javafx.stage.Stage; + +import java.util.Objects; public class CreateUserController { @@ -9,4 +15,27 @@ public class CreateUserController { public TextField textPassword; public TextField textPasswordSecond; public CheckBox checkBoxIsAdmin; + public Label labelErrorName; + public Label labelErrorPw; + + protected void createUser(ActionEvent event) { + if (textName.getText().trim().isEmpty()) { + labelErrorName.setText("Bitte Usernamen eingeben!"); + labelErrorPw.setText(""); + return; + } + if (textPassword.getText().trim().isEmpty()) { + labelErrorName.setText(""); + labelErrorPw.setText("Bitte Passwort eingeben!"); + return; + } + if (Objects.equals(textPassword.getText(), textPasswordSecond.getText())){ + labelErrorName.setText(""); + labelErrorPw.setText("Passwörter stimmen nicht überein!"); + return; + } + + Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); + stage.close(); + } } diff --git a/client/app/src/main/resources/users/create-user.fxml b/client/app/src/main/resources/users/create-user.fxml index 837a733..29132d8 100644 --- a/client/app/src/main/resources/users/create-user.fxml +++ b/client/app/src/main/resources/users/create-user.fxml @@ -9,6 +9,7 @@ + @@ -17,19 +18,23 @@ + - + - - - - + + + + + + From 3fe16186e29dab34a9bece5fac0ac72afd99b084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Fri, 14 Jan 2022 11:11:05 +0100 Subject: [PATCH 08/19] Improved layout, removed typ --- .../main/java/main/CreateEventController.java | 2 -- .../src/main/resources/main/create-event.css | 2 +- .../src/main/resources/main/create-event.fxml | 29 +++++++++---------- .../src/main/resources/main/edit-event.fxml | 29 +++++++++---------- 4 files changed, 29 insertions(+), 33 deletions(-) diff --git a/client/app/src/main/java/main/CreateEventController.java b/client/app/src/main/java/main/CreateEventController.java index f3359c8..645c4e9 100644 --- a/client/app/src/main/java/main/CreateEventController.java +++ b/client/app/src/main/java/main/CreateEventController.java @@ -25,8 +25,6 @@ public class CreateEventController { @FXML public TextField textName; @FXML - public ComboBox ComboBoxTyp; - @FXML public ComboBox ComboBoxPriotity; @FXML public CheckBox checkBoxIsFullDay; diff --git a/client/app/src/main/resources/main/create-event.css b/client/app/src/main/resources/main/create-event.css index 0b7b085..323051a 100644 --- a/client/app/src/main/resources/main/create-event.css +++ b/client/app/src/main/resources/main/create-event.css @@ -47,5 +47,5 @@ Label{ .timePicker{ -fx-background-color: white; - -fx-max-width: 150px; + -fx-max-width: 200px; } \ No newline at end of file diff --git a/client/app/src/main/resources/main/create-event.fxml b/client/app/src/main/resources/main/create-event.fxml index e25fcdd..d60b89c 100644 --- a/client/app/src/main/resources/main/create-event.fxml +++ b/client/app/src/main/resources/main/create-event.fxml @@ -23,24 +23,23 @@ - - - + + - - - - - - - - + + + + + + + + @@ -49,11 +48,11 @@ - - -