Compare commits
	
		
			6 Commits
		
	
	
		
			utf-8_refa
			...
			1800-UI-Us
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 58fc25c27e | |||
| 65d96bbd81 | |||
| 8c3925ea1a | |||
| 3f41005d84 | |||
| 2fbf3895c5 | |||
| 4db6bd1c66 | 
@@ -1,4 +1,4 @@
 | 
			
		||||
package main;
 | 
			
		||||
package events;
 | 
			
		||||
 | 
			
		||||
import com.jfoenix.controls.*;
 | 
			
		||||
import helper.HttpRequestException;
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package main;
 | 
			
		||||
package events;
 | 
			
		||||
 | 
			
		||||
import helper.HttpRequestException;
 | 
			
		||||
import container.DataController;
 | 
			
		||||
@@ -2,15 +2,20 @@ package main;
 | 
			
		||||
 | 
			
		||||
import config.Config;
 | 
			
		||||
import config.ConfigLoader;
 | 
			
		||||
import helper.Tuple;
 | 
			
		||||
import javafx.application.Application;
 | 
			
		||||
import javafx.event.ActionEvent;
 | 
			
		||||
import javafx.fxml.FXMLLoader;
 | 
			
		||||
import javafx.scene.Node;
 | 
			
		||||
import javafx.scene.Scene;
 | 
			
		||||
import javafx.stage.Modality;
 | 
			
		||||
import javafx.stage.Stage;
 | 
			
		||||
import container.DataController;
 | 
			
		||||
import container.HttpRequest;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.function.Consumer;
 | 
			
		||||
 | 
			
		||||
public class MainApplication extends Application {
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -70,4 +75,32 @@ public class MainApplication extends Application {
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
        launch();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void loadScene(
 | 
			
		||||
            String title,
 | 
			
		||||
            String fxml,
 | 
			
		||||
            String css,
 | 
			
		||||
            int width,
 | 
			
		||||
            int height,
 | 
			
		||||
            Consumer<FXMLLoader> method
 | 
			
		||||
    ) {
 | 
			
		||||
        FXMLLoader fxmlLoader = new FXMLLoader(
 | 
			
		||||
                MainApplication.class.getResource(fxml));
 | 
			
		||||
        try {
 | 
			
		||||
            Scene scene = new Scene(fxmlLoader.load(), width, height);
 | 
			
		||||
            scene.getStylesheets().add(Objects.requireNonNull(
 | 
			
		||||
                    MainApplication.class.getResource(css)).toExternalForm());
 | 
			
		||||
            Stage stage = new Stage();
 | 
			
		||||
            stage.setTitle(title);
 | 
			
		||||
            stage.setScene(scene);
 | 
			
		||||
            stage.initModality(Modality.APPLICATION_MODAL);
 | 
			
		||||
            stage.setResizable(false);
 | 
			
		||||
 | 
			
		||||
            if(method != null)method.accept(fxmlLoader);
 | 
			
		||||
 | 
			
		||||
            stage.showAndWait();
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,11 +2,13 @@ package main;
 | 
			
		||||
 | 
			
		||||
import config.Config;
 | 
			
		||||
import config.ConfigLoader;
 | 
			
		||||
import helper.SvgBtnCreator;
 | 
			
		||||
import events.EditEventController;
 | 
			
		||||
import ui.DayPane;
 | 
			
		||||
import ui.EventPane;
 | 
			
		||||
import ui.SvgBtnCreator;
 | 
			
		||||
import helper.HttpRequestException;
 | 
			
		||||
import javafx.fxml.FXML;
 | 
			
		||||
import javafx.fxml.FXMLLoader;
 | 
			
		||||
import javafx.geometry.Pos;
 | 
			
		||||
import javafx.scene.Group;
 | 
			
		||||
import javafx.scene.Node;
 | 
			
		||||
import javafx.scene.Scene;
 | 
			
		||||
@@ -124,21 +126,14 @@ public class MainController {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void onSettingBtnClick(){
 | 
			
		||||
        try{
 | 
			
		||||
            FXMLLoader fxmlLoader = new FXMLLoader(
 | 
			
		||||
                    MainApplication.class.getResource("option-view.fxml"));
 | 
			
		||||
            Scene scene = new Scene(fxmlLoader.load(), 650, 650);
 | 
			
		||||
            scene.getStylesheets().add(Objects.requireNonNull(
 | 
			
		||||
                    MainApplication.class.getResource("option-view.css")).toExternalForm());
 | 
			
		||||
            Stage stage = new Stage();
 | 
			
		||||
            stage.setTitle("Einstellungen");
 | 
			
		||||
            stage.setScene(scene);
 | 
			
		||||
            stage.initModality(Modality.APPLICATION_MODAL);
 | 
			
		||||
            stage.setResizable(false);
 | 
			
		||||
            stage.showAndWait();
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
        MainApplication.loadScene(
 | 
			
		||||
                "Einstellungen",
 | 
			
		||||
                "option-view.fxml",
 | 
			
		||||
                "option-view.css",
 | 
			
		||||
                650,
 | 
			
		||||
                600,
 | 
			
		||||
                null
 | 
			
		||||
                );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void onLogoutBtnClick(ActionEvent event){
 | 
			
		||||
@@ -151,130 +146,47 @@ public class MainController {
 | 
			
		||||
 | 
			
		||||
    private void createWeek() {
 | 
			
		||||
        for (int i = 0; i < 7; i++) {
 | 
			
		||||
            Label label = new Label();
 | 
			
		||||
            label.setText(dayNames[i]);
 | 
			
		||||
            label.setMaxHeight(Double.MAX_VALUE);
 | 
			
		||||
            label.setMaxWidth(Double.MAX_VALUE);
 | 
			
		||||
            label.getStyleClass().add("labelDays");
 | 
			
		||||
            dayLabel[i] = label;
 | 
			
		||||
            calendarGrid.add(label, i, 0);
 | 
			
		||||
 | 
			
		||||
            ScrollPane scrollPane = new ScrollPane();
 | 
			
		||||
 | 
			
		||||
            VBox vBox = new VBox();
 | 
			
		||||
            vBox.getStyleClass().add("vBoxDays");
 | 
			
		||||
            vBox.setSpacing(10);
 | 
			
		||||
            dayVBoxes[i] = vBox;
 | 
			
		||||
            scrollPane.setContent(vBox);
 | 
			
		||||
 | 
			
		||||
            scrollPane.setFitToWidth(true);
 | 
			
		||||
            scrollPane.setFitToHeight(true);
 | 
			
		||||
            scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
 | 
			
		||||
            scrollPane.getStyleClass().add("scrollDays");
 | 
			
		||||
 | 
			
		||||
            calendarGrid.add(scrollPane, i, 1);
 | 
			
		||||
            DayPane dayPane = new DayPane(dayNames[i]);
 | 
			
		||||
            this.dayLabel[i] = dayPane.getDayLabel();
 | 
			
		||||
            calendarGrid.add(dayPane.getDayLabel(), i, 0);
 | 
			
		||||
            dayVBoxes[i] = dayPane.getDayVBox();
 | 
			
		||||
            calendarGrid.add(dayPane.getScrollPane(), i, 1);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void addEvent(Event event) {
 | 
			
		||||
        VBox vBox = new VBox();
 | 
			
		||||
        vBox.getStyleClass().add("event");
 | 
			
		||||
        vBox.setSpacing(5);
 | 
			
		||||
        EventPane eventPane = new EventPane(event);
 | 
			
		||||
        eventPane.getEditBtn().setOnAction(event1 -> MainApplication.loadScene(
 | 
			
		||||
                "edit-event.fxml",
 | 
			
		||||
                "create-event.css",
 | 
			
		||||
                "Termin bearbeiten",
 | 
			
		||||
                600,
 | 
			
		||||
                600,
 | 
			
		||||
                fxmlLoader -> {
 | 
			
		||||
                    EditEventController editEventController = fxmlLoader.getController();
 | 
			
		||||
                    editEventController.setCurrentEvent(event);
 | 
			
		||||
                }
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        HBox btnHBox = new HBox();
 | 
			
		||||
        btnHBox.setAlignment(Pos.BOTTOM_RIGHT);
 | 
			
		||||
 | 
			
		||||
        Group svgDel = new Group(
 | 
			
		||||
                SvgBtnCreator.createPath("M0 0h24v24H0z", "transparent", "transparent"),
 | 
			
		||||
                SvgBtnCreator.createPath("M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",
 | 
			
		||||
                        "white", "gray")
 | 
			
		||||
        );
 | 
			
		||||
        Button deleteBtn = SvgBtnCreator.createBtn(svgDel, 24, "", "Löschen des Termins");
 | 
			
		||||
 | 
			
		||||
        deleteBtn.getStyleClass().add("deleteEventBtn");
 | 
			
		||||
        deleteBtn.setOnAction(e -> {
 | 
			
		||||
        eventPane.getDeleteBtn().setOnAction(e -> {
 | 
			
		||||
            DataController dataController = new DataController();
 | 
			
		||||
            try {
 | 
			
		||||
                dataController.deleteEvent(event.getOwnerId(), event.getId(), event.getDate());
 | 
			
		||||
            } catch (HttpRequestException ex) {
 | 
			
		||||
                ex.printStackTrace();
 | 
			
		||||
                new Alert(Alert.AlertType.ERROR, ex.getMessage()).showAndWait();
 | 
			
		||||
            }
 | 
			
		||||
            updateEvents();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        Group svgEdit = new Group(
 | 
			
		||||
                SvgBtnCreator.createPath("M0 0h24v24H0z", "transparent", "transparent"),
 | 
			
		||||
                SvgBtnCreator.createPath("M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z",
 | 
			
		||||
                        "white", "gray")
 | 
			
		||||
        );
 | 
			
		||||
        Button editBtn = SvgBtnCreator.createBtn(svgEdit, 24, "", "Bearbeiten des Termins");
 | 
			
		||||
        editBtn.getStyleClass().add("editEventBtn");
 | 
			
		||||
        editBtn.setOnAction(event1 -> {
 | 
			
		||||
            try {
 | 
			
		||||
                FXMLLoader fxmlLoader = new FXMLLoader(
 | 
			
		||||
                        MainApplication.class.getResource("edit-event.fxml"));
 | 
			
		||||
                Scene scene = new Scene(fxmlLoader.load(), 650, 650);
 | 
			
		||||
                scene.getStylesheets().add(Objects.requireNonNull(
 | 
			
		||||
                        MainApplication.class.getResource("create-event.css")).toExternalForm());
 | 
			
		||||
                Stage stage = new Stage();
 | 
			
		||||
                stage.setTitle("Termin bearbeiten");
 | 
			
		||||
                stage.setScene(scene);
 | 
			
		||||
                stage.initModality(Modality.APPLICATION_MODAL);
 | 
			
		||||
                stage.setResizable(false);
 | 
			
		||||
                EditEventController editEventController = fxmlLoader.getController();
 | 
			
		||||
                editEventController.setCurrentEvent(event);
 | 
			
		||||
                stage.showAndWait();
 | 
			
		||||
                updateEvents();
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
                e.printStackTrace();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        btnHBox.getChildren().add(editBtn);
 | 
			
		||||
        btnHBox.getChildren().add(deleteBtn);
 | 
			
		||||
        vBox.getChildren().add(btnHBox);
 | 
			
		||||
 | 
			
		||||
        Label nameLabel = new Label(event.getName());
 | 
			
		||||
        nameLabel.setWrapText(true);
 | 
			
		||||
        vBox.getChildren().add(nameLabel);
 | 
			
		||||
 | 
			
		||||
        if (event.getStart() != null || event.getEnd() != null) {
 | 
			
		||||
            String timeStr = (event.getStart() != null ? formatTime(event.getStart()) : "")
 | 
			
		||||
                    + (event.getEnd() != null ? " - " + formatTime(event.getEnd()) : "");
 | 
			
		||||
            Label timeLabel = new Label(timeStr);
 | 
			
		||||
            vBox.getChildren().add(timeLabel);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Label typeLabel = new Label("Wer: " + event.getOwnerName());
 | 
			
		||||
        vBox.getChildren().add(typeLabel);
 | 
			
		||||
 | 
			
		||||
        Label prioLabel = new Label("Priorität: " + event.getPriority());
 | 
			
		||||
        vBox.getChildren().add(prioLabel);
 | 
			
		||||
 | 
			
		||||
        if (event.isFullDay()) {
 | 
			
		||||
            Label fullDayLabel = new Label("Dieser Termin bockiert den ganzen Tag!");
 | 
			
		||||
            fullDayLabel.setWrapText(true);
 | 
			
		||||
            vBox.getChildren().add(fullDayLabel);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        LocalDateTime eventDate = event.getDate();
 | 
			
		||||
 | 
			
		||||
        int day = (int) Duration.between(
 | 
			
		||||
                weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays();
 | 
			
		||||
 | 
			
		||||
        if (day >= 0 && day < 7) {
 | 
			
		||||
            dayVBoxes[day].getChildren().add(vBox);
 | 
			
		||||
            dayVBoxes[day].getChildren().add(eventPane);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String formatTime(String time) {
 | 
			
		||||
        String[] timeArr = time.split(":");
 | 
			
		||||
        if (timeArr.length > 2) {
 | 
			
		||||
            return timeArr[0] + ":" + timeArr[1];
 | 
			
		||||
        }
 | 
			
		||||
        return time;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void setDates() {
 | 
			
		||||
        DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("LLLL yyyy");
 | 
			
		||||
        DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern("E dd.MM");
 | 
			
		||||
 
 | 
			
		||||
@@ -11,24 +11,18 @@ import javafx.event.ActionEvent;
 | 
			
		||||
import javafx.fxml.FXML;
 | 
			
		||||
import javafx.fxml.FXMLLoader;
 | 
			
		||||
import javafx.scene.Node;
 | 
			
		||||
import javafx.scene.Scene;
 | 
			
		||||
import javafx.scene.control.Alert;
 | 
			
		||||
import javafx.scene.control.ButtonType;
 | 
			
		||||
import javafx.scene.control.Label;
 | 
			
		||||
import javafx.scene.layout.GridPane;
 | 
			
		||||
import javafx.stage.Modality;
 | 
			
		||||
import javafx.stage.Stage;
 | 
			
		||||
import container.DataController;
 | 
			
		||||
import container.User;
 | 
			
		||||
import users.EditUserController;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.Optional;
 | 
			
		||||
import java.util.function.Consumer;
 | 
			
		||||
 | 
			
		||||
public class OptionController {
 | 
			
		||||
 | 
			
		||||
@@ -80,7 +74,14 @@ public class OptionController {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void onCreateBtnClick(ActionEvent actionEvent) {
 | 
			
		||||
        loadUserScene(actionEvent, "User erstellen", "../users/create-user.fxml", null);
 | 
			
		||||
        MainApplication.loadScene(
 | 
			
		||||
                "User erstellen",
 | 
			
		||||
                "../users/create-user.fxml",
 | 
			
		||||
                "../users/create-user.css",
 | 
			
		||||
                800,
 | 
			
		||||
                650,
 | 
			
		||||
                null
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void onUpdateBtnClick(ActionEvent actionEvent) {
 | 
			
		||||
@@ -88,11 +89,16 @@ public class OptionController {
 | 
			
		||||
 | 
			
		||||
        if(editIndex < 0 || editIndex >= users.size()) return;
 | 
			
		||||
 | 
			
		||||
        FXMLLoader fxmlLoader = loadUserScene(
 | 
			
		||||
                actionEvent,
 | 
			
		||||
        MainApplication.loadScene(
 | 
			
		||||
                "User bearbeiten",
 | 
			
		||||
                "../users/edit-user.fxml",
 | 
			
		||||
                this::setUserAtController
 | 
			
		||||
                "../users/create-user.css",
 | 
			
		||||
                800,
 | 
			
		||||
                650,
 | 
			
		||||
                fxmlLoader -> {
 | 
			
		||||
                    EditUserController editUserController = fxmlLoader.getController();
 | 
			
		||||
                    editUserController.setCurrentUser(users.get(editIndex));
 | 
			
		||||
                }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -113,31 +119,6 @@ public class OptionController {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private FXMLLoader loadUserScene(ActionEvent actionEvent, String title, String fxml, Consumer<FXMLLoader> method) {
 | 
			
		||||
        FXMLLoader fxmlLoader = new FXMLLoader(
 | 
			
		||||
                MainApplication.class.getResource(fxml));
 | 
			
		||||
        try {
 | 
			
		||||
            Scene scene = new Scene(fxmlLoader.load(), 800, 650);
 | 
			
		||||
            scene.getStylesheets().add(Objects.requireNonNull(
 | 
			
		||||
                    MainApplication.class.getResource("../users/create-user.css")).toExternalForm());
 | 
			
		||||
            Stage stage = new Stage();
 | 
			
		||||
            stage.setTitle(title);
 | 
			
		||||
            stage.setScene(scene);
 | 
			
		||||
            stage.initModality(Modality.APPLICATION_MODAL);
 | 
			
		||||
            stage.setResizable(false);
 | 
			
		||||
 | 
			
		||||
            if(method != null)method.accept(fxmlLoader);
 | 
			
		||||
 | 
			
		||||
            stage.showAndWait();
 | 
			
		||||
            Stage stageOld = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
 | 
			
		||||
            stageOld.close();
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
        return fxmlLoader;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void setUserAtController(FXMLLoader fxmlLoader){
 | 
			
		||||
        int editIndex = comboBox.getSelectionModel().getSelectedIndex();
 | 
			
		||||
        EditUserController editUserController = fxmlLoader.getController();
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										44
									
								
								client/app/src/main/java/ui/DayPane.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								client/app/src/main/java/ui/DayPane.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
package ui;
 | 
			
		||||
 | 
			
		||||
import javafx.scene.control.Label;
 | 
			
		||||
import javafx.scene.control.ScrollPane;
 | 
			
		||||
import javafx.scene.layout.VBox;
 | 
			
		||||
 | 
			
		||||
public class DayPane {
 | 
			
		||||
 | 
			
		||||
    private Label dayLabel;
 | 
			
		||||
    private VBox dayVBox;
 | 
			
		||||
    private ScrollPane scrollPane;
 | 
			
		||||
 | 
			
		||||
    public DayPane(String name) {
 | 
			
		||||
        dayLabel = new Label();
 | 
			
		||||
        dayLabel.setText(name);
 | 
			
		||||
        dayLabel.setMaxHeight(Double.MAX_VALUE);
 | 
			
		||||
        dayLabel.setMaxWidth(Double.MAX_VALUE);
 | 
			
		||||
        dayLabel.getStyleClass().add("labelDays");
 | 
			
		||||
 | 
			
		||||
        scrollPane = new ScrollPane();
 | 
			
		||||
 | 
			
		||||
        dayVBox = new VBox();
 | 
			
		||||
        dayVBox.getStyleClass().add("vBoxDays");
 | 
			
		||||
        dayVBox.setSpacing(10);
 | 
			
		||||
        scrollPane.setContent(dayVBox);
 | 
			
		||||
 | 
			
		||||
        scrollPane.setFitToWidth(true);
 | 
			
		||||
        scrollPane.setFitToHeight(true);
 | 
			
		||||
        scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
 | 
			
		||||
        scrollPane.getStyleClass().add("scrollDays");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Label getDayLabel() {
 | 
			
		||||
        return dayLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public VBox getDayVBox() {
 | 
			
		||||
        return dayVBox;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ScrollPane getScrollPane() {
 | 
			
		||||
        return scrollPane;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										97
									
								
								client/app/src/main/java/ui/EventPane.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								client/app/src/main/java/ui/EventPane.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,97 @@
 | 
			
		||||
package ui;
 | 
			
		||||
 | 
			
		||||
import container.DataController;
 | 
			
		||||
import container.Event;
 | 
			
		||||
import events.EditEventController;
 | 
			
		||||
import helper.HttpRequestException;
 | 
			
		||||
import javafx.fxml.FXMLLoader;
 | 
			
		||||
import javafx.geometry.Pos;
 | 
			
		||||
import javafx.scene.Group;
 | 
			
		||||
import javafx.scene.Scene;
 | 
			
		||||
import javafx.scene.control.Alert;
 | 
			
		||||
import javafx.scene.control.Button;
 | 
			
		||||
import javafx.scene.control.Label;
 | 
			
		||||
import javafx.scene.layout.HBox;
 | 
			
		||||
import javafx.scene.layout.VBox;
 | 
			
		||||
import javafx.stage.Modality;
 | 
			
		||||
import javafx.stage.Stage;
 | 
			
		||||
import main.MainApplication;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
 | 
			
		||||
public class EventPane extends VBox {
 | 
			
		||||
 | 
			
		||||
    private Button deleteBtn;
 | 
			
		||||
    private Button editBtn;
 | 
			
		||||
 | 
			
		||||
    public EventPane(Event event) {
 | 
			
		||||
        this.getStyleClass().add("event");
 | 
			
		||||
        this.setSpacing(5);
 | 
			
		||||
 | 
			
		||||
        HBox btnHBox = new HBox();
 | 
			
		||||
        btnHBox.setAlignment(Pos.BOTTOM_RIGHT);
 | 
			
		||||
 | 
			
		||||
        Group svgDel = new Group(
 | 
			
		||||
                SvgBtnCreator.createPath("M0 0h24v24H0z", "transparent", "transparent"),
 | 
			
		||||
                SvgBtnCreator.createPath("M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z",
 | 
			
		||||
                        "white", "gray")
 | 
			
		||||
        );
 | 
			
		||||
        deleteBtn = SvgBtnCreator.createBtn(svgDel, 24, "", "Löschen des Termins");
 | 
			
		||||
        deleteBtn.getStyleClass().add("deleteEventBtn");
 | 
			
		||||
 | 
			
		||||
        Group svgEdit = new Group(
 | 
			
		||||
                SvgBtnCreator.createPath("M0 0h24v24H0z", "transparent", "transparent"),
 | 
			
		||||
                SvgBtnCreator.createPath("M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z",
 | 
			
		||||
                        "white", "gray")
 | 
			
		||||
        );
 | 
			
		||||
        editBtn = SvgBtnCreator.createBtn(svgEdit, 24, "", "Bearbeiten des Termins");
 | 
			
		||||
        editBtn.getStyleClass().add("editEventBtn");
 | 
			
		||||
 | 
			
		||||
        btnHBox.getChildren().add(editBtn);
 | 
			
		||||
        btnHBox.getChildren().add(deleteBtn);
 | 
			
		||||
        this.getChildren().add(btnHBox);
 | 
			
		||||
 | 
			
		||||
        Label nameLabel = new Label(event.getName());
 | 
			
		||||
        nameLabel.setWrapText(true);
 | 
			
		||||
        this.getChildren().add(nameLabel);
 | 
			
		||||
 | 
			
		||||
        if (event.getStart() != null || event.getEnd() != null) {
 | 
			
		||||
            String timeStr = (event.getStart() != null ? formatTime(event.getStart()) : "")
 | 
			
		||||
                    + (event.getEnd() != null ? " - " + formatTime(event.getEnd()) : "");
 | 
			
		||||
            Label timeLabel = new Label(timeStr);
 | 
			
		||||
            this.getChildren().add(timeLabel);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Label typeLabel = new Label("Wer: " + event.getOwnerName());
 | 
			
		||||
        this.getChildren().add(typeLabel);
 | 
			
		||||
 | 
			
		||||
        Label prioLabel = new Label("Priorität: " + event.getPriority());
 | 
			
		||||
        this.getChildren().add(prioLabel);
 | 
			
		||||
 | 
			
		||||
        if (event.isFullDay()) {
 | 
			
		||||
            Label fullDayLabel = new Label("Dieser Termin bockiert den ganzen Tag!");
 | 
			
		||||
            fullDayLabel.setWrapText(true);
 | 
			
		||||
            this.getChildren().add(fullDayLabel);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Button getDeleteBtn() {
 | 
			
		||||
        return deleteBtn;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Button getEditBtn() {
 | 
			
		||||
        return editBtn;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private String formatTime(String time) {
 | 
			
		||||
        String[] timeArr = time.split(":");
 | 
			
		||||
        if (timeArr.length > 2) {
 | 
			
		||||
            return timeArr[0] + ":" + timeArr[1];
 | 
			
		||||
        }
 | 
			
		||||
        return time;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package helper;
 | 
			
		||||
package ui;
 | 
			
		||||
 | 
			
		||||
import javafx.geometry.Bounds;
 | 
			
		||||
import javafx.scene.Group;
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
<?import com.jfoenix.controls.*?>
 | 
			
		||||
 | 
			
		||||
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
 | 
			
		||||
          fx:controller="main.CreateEventController">
 | 
			
		||||
          fx:controller="events.CreateEventController">
 | 
			
		||||
 | 
			
		||||
    <columnConstraints>
 | 
			
		||||
        <ColumnConstraints/>
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
<?import com.jfoenix.controls.*?>
 | 
			
		||||
 | 
			
		||||
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
 | 
			
		||||
          fx:controller="main.EditEventController">
 | 
			
		||||
          fx:controller="events.EditEventController">
 | 
			
		||||
 | 
			
		||||
    <columnConstraints>
 | 
			
		||||
        <ColumnConstraints/>
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,7 @@ Label{
 | 
			
		||||
.errorMessage{
 | 
			
		||||
    -fx-max-width: 400px;
 | 
			
		||||
    -fx-min-width: 400px;
 | 
			
		||||
    -fx-text-fill: red;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Button{
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
          xmlns:fx="http://javafx.com/fxml"
 | 
			
		||||
          fx:controller="users.CreateUserController">
 | 
			
		||||
    <columnConstraints>
 | 
			
		||||
        <ColumnConstraints minWidth="100"/>
 | 
			
		||||
        <ColumnConstraints minWidth="50"/>
 | 
			
		||||
        <ColumnConstraints minWidth="100"/>
 | 
			
		||||
        <ColumnConstraints minWidth="100"/>
 | 
			
		||||
    </columnConstraints>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										59
									
								
								client/app/src/main/resources/users/edit-user.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								client/app/src/main/resources/users/edit-user.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
* {
 | 
			
		||||
   -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-font-weight: bold;
 | 
			
		||||
    -fx-max-width: 200px;
 | 
			
		||||
    -fx-text-fill: #ff5555;
 | 
			
		||||
    -fx-font-size: 16px;
 | 
			
		||||
    -fx-max-width: 400px;
 | 
			
		||||
    -fx-min-width: 400px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Button{
 | 
			
		||||
    -fx-max-width: 150px;
 | 
			
		||||
    -fx-min-width: 150px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.btnLogin{
 | 
			
		||||
    -fx-font-weight: bold;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user