From c754b77c81349779965d835a2be176f81bfd48ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Wed, 22 Dec 2021 15:04:15 +0100 Subject: [PATCH] Formatted code --- .../main/java/main/CreateEventController.java | 5 +- client/app/src/main/java/main/Launcher.java | 2 +- .../src/main/java/main/MainApplication.java | 8 +-- .../src/main/java/main/MainController.java | 11 ++-- .../src/main/java/users/LoginController.java | 8 +-- .../src/main/resources/main/create-event.fxml | 33 ++++++------ .../src/main/resources/main/main-view.fxml | 53 ++++++++++--------- .../app/src/main/resources/users/login.fxml | 12 ++--- .../src/main/java/res/DataController.java | 14 ++--- client/data/src/main/java/res/Event.java | 13 ++--- .../data/src/main/java/res/HttpRequest.java | 4 +- 11 files changed, 87 insertions(+), 76 deletions(-) diff --git a/client/app/src/main/java/main/CreateEventController.java b/client/app/src/main/java/main/CreateEventController.java index f3923e8..d77c407 100644 --- a/client/app/src/main/java/main/CreateEventController.java +++ b/client/app/src/main/java/main/CreateEventController.java @@ -30,7 +30,6 @@ public class CreateEventController { public Label labelError; - public CreateEventController() { } @@ -42,7 +41,7 @@ public class CreateEventController { @FXML protected void createBtnClick(ActionEvent actionEvent) { try { - if(datePickerDate.getValue() == null){ + if (datePickerDate.getValue() == null) { throw new IllegalArgumentException("Bitte w\u00e4hle ein Datum aus"); } @@ -54,7 +53,7 @@ public class CreateEventController { textStart.getText(), textEnd.getText(), datePickerDate.getValue().atStartOfDay(), - (int)DataController.USER_ID + (int) DataController.USER_ID ); System.out.println(event.getAsUrlParam()); diff --git a/client/app/src/main/java/main/Launcher.java b/client/app/src/main/java/main/Launcher.java index fd5d4c8..38c385d 100644 --- a/client/app/src/main/java/main/Launcher.java +++ b/client/app/src/main/java/main/Launcher.java @@ -1,7 +1,7 @@ package main; public class Launcher { - + public static void main(String[] args) { MainApplication.main(args); } diff --git a/client/app/src/main/java/main/MainApplication.java b/client/app/src/main/java/main/MainApplication.java index 2522e16..6efcaa1 100644 --- a/client/app/src/main/java/main/MainApplication.java +++ b/client/app/src/main/java/main/MainApplication.java @@ -15,19 +15,21 @@ public class MainApplication extends Application { FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml")); Scene scene = new Scene(fxmlLoader.load(), 1200, 700); - scene.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("main-view.css")).toExternalForm()); + scene.getStylesheets().add(Objects.requireNonNull( + MainApplication.class.getResource("main-view.css")).toExternalForm()); stage.setTitle("SharePlaner"); stage.setScene(scene); FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml")); Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500); - sceneLogin.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("../users/login.css")).toExternalForm()); + sceneLogin.getStylesheets().add(Objects.requireNonNull( + MainApplication.class.getResource("../users/login.css")).toExternalForm()); Stage stageLogin = new Stage(); stageLogin.setTitle("Anmelden"); stageLogin.setScene(sceneLogin); stageLogin.showAndWait(); - if(DataController.USER_ID >= 0){ + if (DataController.USER_ID >= 0) { stage.show(); } } diff --git a/client/app/src/main/java/main/MainController.java b/client/app/src/main/java/main/MainController.java index cda918d..c7092a7 100644 --- a/client/app/src/main/java/main/MainController.java +++ b/client/app/src/main/java/main/MainController.java @@ -73,7 +73,7 @@ public class MainController { } @FXML - protected void onTodayClick(){ + protected void onTodayClick() { weekOffset = 0; setDates(); updateEvents(); @@ -89,9 +89,11 @@ public class MainController { @FXML protected void onAddBtnClick() { try { - FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("create-event.fxml")); + FXMLLoader fxmlLoader = new FXMLLoader( + MainApplication.class.getResource("create-event.fxml")); Scene scene = new Scene(fxmlLoader.load(), 650, 650); - scene.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("create-event.css")).toExternalForm()); + scene.getStylesheets().add(Objects.requireNonNull( + MainApplication.class.getResource("create-event.css")).toExternalForm()); Stage stage = new Stage(); stage.setTitle("Termin erstellen"); stage.setScene(scene); @@ -182,7 +184,8 @@ public class MainController { LocalDateTime eventDate = event.getDate(); - int day = (int) Duration.between(weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays(); + int day = (int) Duration.between( + weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays(); if (day >= 0 && day < 7) { dayVBoxes[day].getChildren().add(vBox); diff --git a/client/app/src/main/java/users/LoginController.java b/client/app/src/main/java/users/LoginController.java index a8da804..0350460 100644 --- a/client/app/src/main/java/users/LoginController.java +++ b/client/app/src/main/java/users/LoginController.java @@ -19,20 +19,20 @@ public class LoginController { public Label passErrLabel; @FXML - protected void login(ActionEvent event){ - if(userField.getText().trim().isEmpty()){ + protected void login(ActionEvent event) { + if (userField.getText().trim().isEmpty()) { userErrLabel.setText("Bitte Usernamen eingeben!"); passErrLabel.setText(""); return; } - if(passField.getText().trim().isEmpty()){ + if (passField.getText().trim().isEmpty()) { userErrLabel.setText(""); passErrLabel.setText("Bitte Passwort eingeben!"); return; } DataController dataController = new DataController(); - if(!dataController.login(userField.getText(), passField.getText())){ + if (!dataController.login(userField.getText(), passField.getText())) { userErrLabel.setText("Name und Passwort passen nicht zueinander!"); passErrLabel.setText("Name und Passwort passen nicht zueinander!"); return; diff --git a/client/app/src/main/resources/main/create-event.fxml b/client/app/src/main/resources/main/create-event.fxml index b3600c8..c56066c 100644 --- a/client/app/src/main/resources/main/create-event.fxml +++ b/client/app/src/main/resources/main/create-event.fxml @@ -5,7 +5,8 @@ - + @@ -13,16 +14,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -44,9 +45,9 @@ - - - + + + @@ -54,8 +55,8 @@