Formatted code

This commit is contained in:
2021-12-22 15:04:15 +01:00
parent 66edff8ed5
commit c754b77c81
11 changed files with 87 additions and 76 deletions

View File

@@ -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());

View File

@@ -1,7 +1,7 @@
package main;
public class Launcher {
public static void main(String[] args) {
MainApplication.main(args);
}

View File

@@ -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();
}
}

View File

@@ -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);

View File

@@ -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;