Compare commits
21 Commits
2410-devel
...
1800-UI-Us
Author | SHA1 | Date | |
---|---|---|---|
58fc25c27e | |||
65d96bbd81 | |||
8c3925ea1a | |||
3f41005d84 | |||
2fbf3895c5 | |||
d41abdbad9 | |||
db339eeada | |||
245314a887 | |||
72fdce471b | |||
780ecbee0f | |||
4e07b01b6a | |||
2f70515407 | |||
a4ce8940ab | |||
91daf95990 | |||
596343fe47 | |||
f133257194 | |||
4aafae9896 | |||
cb5982ef2d | |||
3848baddb6 | |||
057c4504d4 | |||
4db6bd1c66 |
@@ -5,13 +5,17 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
javafx {
|
javafx {
|
||||||
version = "11"
|
version = "11.0.2"
|
||||||
modules(
|
modules(
|
||||||
"javafx.controls",
|
"javafx.controls",
|
||||||
"javafx.fxml"
|
"javafx.fxml"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClassName = "main.MainApplication"
|
mainClassName = "main.MainApplication"
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
package customUI;
|
|
||||||
|
|
||||||
public class Button extends javafx.scene.control.Button {
|
|
||||||
|
|
||||||
public void setTextValue(String text){
|
|
||||||
super.setText(Converter.convertString(text));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,21 +0,0 @@
|
|||||||
package customUI;
|
|
||||||
|
|
||||||
public class Converter {
|
|
||||||
/*
|
|
||||||
Ä, ä \u00c4, \u00e4
|
|
||||||
Ö, ö \u00d6, \u00f6
|
|
||||||
Ü, ü \u00dc, \u00fc
|
|
||||||
ß \u00df
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
public static String convertString(String str){
|
|
||||||
return str
|
|
||||||
.replace("ä", "\u00e4")
|
|
||||||
.replace("Ä", "\u00c4")
|
|
||||||
.replace("ö", "\u00f6")
|
|
||||||
.replace("Ö", "\u00d6")
|
|
||||||
.replace("ü", "\u00fc")
|
|
||||||
.replace("Ü", "\u00dc")
|
|
||||||
.replace("ß", "\u00df");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,15 +0,0 @@
|
|||||||
package customUI;
|
|
||||||
|
|
||||||
public class Label extends javafx.scene.control.Label {
|
|
||||||
public Label(String content){
|
|
||||||
super(Converter.convertString(content));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Label(){
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTextValue(String text){
|
|
||||||
super.setText(Converter.convertString(text));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +0,0 @@
|
|||||||
package customUI;
|
|
||||||
|
|
||||||
public class Tooltip extends javafx.scene.control.Tooltip {
|
|
||||||
|
|
||||||
public Tooltip(String tollTipText){
|
|
||||||
super(Converter.convertString(tollTipText));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,4 +1,4 @@
|
|||||||
package main;
|
package events;
|
||||||
|
|
||||||
import com.jfoenix.controls.*;
|
import com.jfoenix.controls.*;
|
||||||
import helper.HttpRequestException;
|
import helper.HttpRequestException;
|
||||||
@@ -10,8 +10,8 @@ import javafx.scene.layout.GridPane;
|
|||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
import javafx.util.converter.LocalTimeStringConverter;
|
import javafx.util.converter.LocalTimeStringConverter;
|
||||||
import res.DataController;
|
import container.DataController;
|
||||||
import res.Event;
|
import container.Event;
|
||||||
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.format.FormatStyle;
|
import java.time.format.FormatStyle;
|
||||||
@@ -44,7 +44,6 @@ public class CreateEventController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
|
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
|
||||||
timeStart.set24HourView(true);
|
timeStart.set24HourView(true);
|
||||||
timeStart.setConverter(defaultConverter);
|
timeStart.setConverter(defaultConverter);
|
@@ -1,16 +1,8 @@
|
|||||||
package main;
|
package events;
|
||||||
|
|
||||||
import customUI.Converter;
|
|
||||||
import helper.HttpRequestException;
|
import helper.HttpRequestException;
|
||||||
import javafx.fxml.FXML;
|
import container.DataController;
|
||||||
import javafx.util.StringConverter;
|
import container.Event;
|
||||||
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 EditEventController extends CreateEventController{
|
public class EditEventController extends CreateEventController{
|
||||||
|
|
||||||
@@ -23,7 +15,7 @@ public class EditEventController extends CreateEventController{
|
|||||||
public void setCurrentEvent(Event currentEvent) {
|
public void setCurrentEvent(Event currentEvent) {
|
||||||
this.currentEvent = currentEvent;
|
this.currentEvent = currentEvent;
|
||||||
|
|
||||||
textName.setText(Converter.convertString(currentEvent.getName()));
|
textName.setText(currentEvent.getName());
|
||||||
datePickerDate.setValue(currentEvent.getDate().toLocalDate());
|
datePickerDate.setValue(currentEvent.getDate().toLocalDate());
|
||||||
ComboBoxPriotity.getSelectionModel().select(currentEvent.getPriority());
|
ComboBoxPriotity.getSelectionModel().select(currentEvent.getPriority());
|
||||||
|
|
@@ -2,15 +2,20 @@ package main;
|
|||||||
|
|
||||||
import config.Config;
|
import config.Config;
|
||||||
import config.ConfigLoader;
|
import config.ConfigLoader;
|
||||||
|
import helper.Tuple;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import res.DataController;
|
import container.DataController;
|
||||||
import res.HttpRequest;
|
import container.HttpRequest;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class MainApplication extends Application {
|
public class MainApplication extends Application {
|
||||||
@Override
|
@Override
|
||||||
@@ -70,4 +75,32 @@ public class MainApplication extends Application {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
launch();
|
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,27 +2,27 @@ package main;
|
|||||||
|
|
||||||
import config.Config;
|
import config.Config;
|
||||||
import config.ConfigLoader;
|
import config.ConfigLoader;
|
||||||
import customUI.Button;
|
import events.EditEventController;
|
||||||
import customUI.Label;
|
import ui.DayPane;
|
||||||
import helper.SvgBtnCreator;
|
import ui.EventPane;
|
||||||
|
import ui.SvgBtnCreator;
|
||||||
import helper.HttpRequestException;
|
import helper.HttpRequestException;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.scene.Group;
|
import javafx.scene.Group;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import res.DataController;
|
import container.DataController;
|
||||||
import res.Event;
|
import container.Event;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import res.HttpRequest;
|
import container.HttpRequest;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
@@ -126,7 +126,14 @@ public class MainController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onSettingBtnClick(){
|
protected void onSettingBtnClick(){
|
||||||
|
MainApplication.loadScene(
|
||||||
|
"Einstellungen",
|
||||||
|
"option-view.fxml",
|
||||||
|
"option-view.css",
|
||||||
|
650,
|
||||||
|
600,
|
||||||
|
null
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onLogoutBtnClick(ActionEvent event){
|
protected void onLogoutBtnClick(ActionEvent event){
|
||||||
@@ -139,128 +146,47 @@ public class MainController {
|
|||||||
|
|
||||||
private void createWeek() {
|
private void createWeek() {
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
Label label = new Label();
|
DayPane dayPane = new DayPane(dayNames[i]);
|
||||||
label.setTextValue(dayNames[i]);
|
this.dayLabel[i] = dayPane.getDayLabel();
|
||||||
label.setMaxHeight(Double.MAX_VALUE);
|
calendarGrid.add(dayPane.getDayLabel(), i, 0);
|
||||||
label.setMaxWidth(Double.MAX_VALUE);
|
dayVBoxes[i] = dayPane.getDayVBox();
|
||||||
label.getStyleClass().add("labelDays");
|
calendarGrid.add(dayPane.getScrollPane(), i, 1);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addEvent(Event event) {
|
private void addEvent(Event event) {
|
||||||
VBox vBox = new VBox();
|
EventPane eventPane = new EventPane(event);
|
||||||
vBox.getStyleClass().add("event");
|
eventPane.getEditBtn().setOnAction(event1 -> MainApplication.loadScene(
|
||||||
vBox.setSpacing(5);
|
"edit-event.fxml",
|
||||||
|
"create-event.css",
|
||||||
|
"Termin bearbeiten",
|
||||||
|
600,
|
||||||
|
600,
|
||||||
|
fxmlLoader -> {
|
||||||
|
EditEventController editEventController = fxmlLoader.getController();
|
||||||
|
editEventController.setCurrentEvent(event);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
HBox btnHBox = new HBox();
|
eventPane.getDeleteBtn().setOnAction(e -> {
|
||||||
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 -> {
|
|
||||||
DataController dataController = new DataController();
|
DataController dataController = new DataController();
|
||||||
try {
|
try {
|
||||||
dataController.deleteEvent(event.getOwnerId(), event.getId(), event.getDate());
|
dataController.deleteEvent(event.getOwnerId(), event.getId(), event.getDate());
|
||||||
} catch (HttpRequestException ex) {
|
} catch (HttpRequestException ex) {
|
||||||
ex.printStackTrace();
|
new Alert(Alert.AlertType.ERROR, ex.getMessage()).showAndWait();
|
||||||
}
|
}
|
||||||
updateEvents();
|
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());
|
|
||||||
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\u00e4t: " + event.getPriority());
|
|
||||||
vBox.getChildren().add(prioLabel);
|
|
||||||
|
|
||||||
if (event.isFullDay()) {
|
|
||||||
Label fullDayLabel = new Label("Dieser Termin bockiert den ganzen Tag!");
|
|
||||||
vBox.getChildren().add(fullDayLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LocalDateTime eventDate = event.getDate();
|
LocalDateTime eventDate = event.getDate();
|
||||||
|
|
||||||
int day = (int) Duration.between(
|
int day = (int) Duration.between(
|
||||||
weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays();
|
weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays();
|
||||||
|
|
||||||
if (day >= 0 && day < 7) {
|
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() {
|
private void setDates() {
|
||||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("LLLL yyyy");
|
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("LLLL yyyy");
|
||||||
DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern("E dd.MM");
|
DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern("E dd.MM");
|
||||||
@@ -272,7 +198,7 @@ public class MainController {
|
|||||||
weekStartDateTime = now.plusDays(weekOffset * 7L - dayOfWeek + 1);
|
weekStartDateTime = now.plusDays(weekOffset * 7L - dayOfWeek + 1);
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
dayLabel[i].setTextValue(dayFormatter.format(weekStartDateTime.plusDays(i)));
|
dayLabel[i].setText(dayFormatter.format(weekStartDateTime.plusDays(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelMonth.setText(dateFormatter.format(weekStartDateTime));
|
LabelMonth.setText(dateFormatter.format(weekStartDateTime));
|
||||||
|
139
client/app/src/main/java/main/OptionController.java
Normal file
139
client/app/src/main/java/main/OptionController.java
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
package main;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.*;
|
||||||
|
import config.Config;
|
||||||
|
import config.ConfigLoader;
|
||||||
|
import container.HttpRequest;
|
||||||
|
import helper.HttpRequestException;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
|
import javafx.scene.control.ButtonType;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import container.DataController;
|
||||||
|
import container.User;
|
||||||
|
import users.EditUserController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class OptionController {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public JFXButton updateUserBtn;
|
||||||
|
@FXML
|
||||||
|
public JFXButton deleteUserBtn;
|
||||||
|
@FXML
|
||||||
|
public JFXButton createUserBtn;
|
||||||
|
@FXML
|
||||||
|
public JFXToggleButton saveLoginTBtn;
|
||||||
|
@FXML
|
||||||
|
public Label labelError;
|
||||||
|
@FXML
|
||||||
|
public GridPane mainGrid;
|
||||||
|
|
||||||
|
private JFXComboBox<String> comboBox;
|
||||||
|
private DataController dataController;
|
||||||
|
private List<User> users;
|
||||||
|
private Config config;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void initialize(){
|
||||||
|
dataController = new DataController();
|
||||||
|
try{
|
||||||
|
users = dataController.getAllUser();
|
||||||
|
} catch (HttpRequestException e){
|
||||||
|
users = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
ObservableList<String> observableUserList = FXCollections.observableArrayList();
|
||||||
|
for (User user: users) {
|
||||||
|
observableUserList.add(user.getLogin());
|
||||||
|
}
|
||||||
|
comboBox = new JFXComboBox<>(observableUserList);
|
||||||
|
comboBox.getStyleClass().add("comboBox");
|
||||||
|
mainGrid.add(comboBox, 2,2);
|
||||||
|
|
||||||
|
config = ConfigLoader.load();
|
||||||
|
if(config == null){
|
||||||
|
config = new Config(false, -1, "");
|
||||||
|
}
|
||||||
|
saveLoginTBtn.setSelected(config.isSaveLogin());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBackBtnClick(ActionEvent actionEvent) {
|
||||||
|
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCreateBtnClick(ActionEvent actionEvent) {
|
||||||
|
MainApplication.loadScene(
|
||||||
|
"User erstellen",
|
||||||
|
"../users/create-user.fxml",
|
||||||
|
"../users/create-user.css",
|
||||||
|
800,
|
||||||
|
650,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onUpdateBtnClick(ActionEvent actionEvent) {
|
||||||
|
int editIndex = comboBox.getSelectionModel().getSelectedIndex();
|
||||||
|
|
||||||
|
if(editIndex < 0 || editIndex >= users.size()) return;
|
||||||
|
|
||||||
|
MainApplication.loadScene(
|
||||||
|
"User bearbeiten",
|
||||||
|
"../users/edit-user.fxml",
|
||||||
|
"../users/create-user.css",
|
||||||
|
800,
|
||||||
|
650,
|
||||||
|
fxmlLoader -> {
|
||||||
|
EditUserController editUserController = fxmlLoader.getController();
|
||||||
|
editUserController.setCurrentUser(users.get(editIndex));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDeleteBtnClick(ActionEvent actionEvent) {
|
||||||
|
Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Wirklich löschen?");
|
||||||
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
|
if(result.isPresent() && result.get() == ButtonType.OK){
|
||||||
|
int removeIndex = comboBox.getSelectionModel().getSelectedIndex();
|
||||||
|
try {
|
||||||
|
dataController.deleteUser(users.get(removeIndex));
|
||||||
|
} catch (HttpRequestException e) {
|
||||||
|
Alert alert1 = new Alert(Alert.AlertType.ERROR, e.getMessage());
|
||||||
|
alert1.showAndWait();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
comboBox.getItems().remove(removeIndex);
|
||||||
|
users.remove(removeIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUserAtController(FXMLLoader fxmlLoader){
|
||||||
|
int editIndex = comboBox.getSelectionModel().getSelectedIndex();
|
||||||
|
EditUserController editUserController = fxmlLoader.getController();
|
||||||
|
editUserController.setCurrentUser(users.get(editIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggledBtn(ActionEvent actionEvent) {
|
||||||
|
config.setSaveLogin(saveLoginTBtn.isSelected());
|
||||||
|
if(config.isSaveLogin()){
|
||||||
|
config.setId(DataController.USER_ID);
|
||||||
|
config.setToken(HttpRequest.TOKEN);
|
||||||
|
} else {
|
||||||
|
config.setId(-1);
|
||||||
|
config.setToken("");
|
||||||
|
}
|
||||||
|
ConfigLoader.save(config);
|
||||||
|
}
|
||||||
|
}
|
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,10 +1,8 @@
|
|||||||
package helper;
|
package ui;
|
||||||
|
|
||||||
import javafx.geometry.Bounds;
|
import javafx.geometry.Bounds;
|
||||||
import javafx.scene.Group;
|
import javafx.scene.Group;
|
||||||
import customUI.Button;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.ContentDisplay;
|
|
||||||
import customUI.Tooltip;
|
|
||||||
import javafx.scene.shape.SVGPath;
|
import javafx.scene.shape.SVGPath;
|
||||||
|
|
||||||
public class SvgBtnCreator {
|
public class SvgBtnCreator {
|
@@ -1,5 +1,6 @@
|
|||||||
package users;
|
package users;
|
||||||
|
|
||||||
|
import helper.HttpRequestException;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
@@ -8,6 +9,8 @@ import javafx.scene.control.PasswordField;
|
|||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.ToggleButton;
|
import javafx.scene.control.ToggleButton;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import container.DataController;
|
||||||
|
import container.User;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -39,15 +42,38 @@ public class CreateUserController {
|
|||||||
labelError.setText("Bitte Passwort eingeben!");
|
labelError.setText("Bitte Passwort eingeben!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (textPassword.getText().trim().length() < 8) {
|
||||||
|
labelError.setText("Das Passwort muss mindestens 8 Zeichen lang sein!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||||
labelError.setText("Passwörter stimmen nicht überein!");
|
labelError.setText("Passwörter stimmen nicht überein!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
User user = new User();
|
||||||
|
user.setLogin(textLogin.getText().trim());
|
||||||
|
user.setForename(textForename.getText().trim());
|
||||||
|
user.setName(textName.getText().trim());
|
||||||
|
user.setPassword(textPassword.getText().trim());
|
||||||
|
user.setAdmin(checkButtonIsAdmin.isSelected());
|
||||||
|
|
||||||
|
try {
|
||||||
|
sendHttpRequest(user);
|
||||||
|
} catch (HttpRequestException e) {
|
||||||
|
labelError.setText(e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
stage.close();
|
stage.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void sendHttpRequest(User user) throws HttpRequestException {
|
||||||
|
DataController dataController = new DataController();
|
||||||
|
dataController.createUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
protected void abortBtnClick(ActionEvent event) {
|
protected void abortBtnClick(ActionEvent event) {
|
||||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
92
client/app/src/main/java/users/EditUserController.java
Normal file
92
client/app/src/main/java/users/EditUserController.java
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
package users;
|
||||||
|
|
||||||
|
import container.DataController;
|
||||||
|
import container.User;
|
||||||
|
import helper.HttpRequestException;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class EditUserController extends CreateUserController{
|
||||||
|
private User currentUser;
|
||||||
|
|
||||||
|
public User getCurrentUser() {
|
||||||
|
return currentUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentUser(User currentUser) {
|
||||||
|
this.currentUser = currentUser;
|
||||||
|
|
||||||
|
textForename.setText(currentUser.getForename());
|
||||||
|
textName.setText(currentUser.getName());
|
||||||
|
textLogin.setText(currentUser.getLogin());
|
||||||
|
checkButtonIsAdmin.setSelected(currentUser.isAdmin());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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()) {
|
||||||
|
labelError.setText("Bitte Nachnamen eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
User user = new User();
|
||||||
|
|
||||||
|
if(!textPassword.getText().trim().isEmpty() || !textPasswordSecond.getText().trim().isEmpty()){
|
||||||
|
if (textPassword.getText().trim().isEmpty()) {
|
||||||
|
labelError.setText("Bitte Passwort eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (textPassword.getText().trim().length() < 8) {
|
||||||
|
labelError.setText("Das Passwort muss mindestens 8 Zeichen lang sein!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||||
|
labelError.setText("Passwörter stimmen nicht überein!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
user.setPassword(textPassword.getText().trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
user.setUserId(currentUser.getUserId());
|
||||||
|
user.setLogin(textLogin.getText().trim());
|
||||||
|
user.setForename(textForename.getText().trim());
|
||||||
|
user.setName(textName.getText().trim());
|
||||||
|
user.setAdmin(checkButtonIsAdmin.isSelected());
|
||||||
|
|
||||||
|
try {
|
||||||
|
sendHttpRequest(user);
|
||||||
|
} catch (HttpRequestException e) {
|
||||||
|
labelError.setText(e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(currentUser.getUserId() == DataController.USER_ID){
|
||||||
|
Alert alert = new Alert(
|
||||||
|
Alert.AlertType.WARNING,
|
||||||
|
"Bitte starte das Programm neu um die Änderungen anzuwenden."
|
||||||
|
);
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
|
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void sendHttpRequest(User user) throws HttpRequestException {
|
||||||
|
DataController dataController = new DataController();
|
||||||
|
dataController.editUser(user);
|
||||||
|
}
|
||||||
|
}
|
@@ -6,7 +6,7 @@ import javafx.fxml.FXML;
|
|||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import res.DataController;
|
import container.DataController;
|
||||||
|
|
||||||
public class LoginController {
|
public class LoginController {
|
||||||
@FXML
|
@FXML
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<?import com.jfoenix.controls.*?>
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
<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>
|
||||||
<ColumnConstraints/>
|
<ColumnConstraints/>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<?import com.jfoenix.controls.*?>
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
<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>
|
||||||
<ColumnConstraints/>
|
<ColumnConstraints/>
|
||||||
|
58
client/app/src/main/resources/main/option-view.css
Normal file
58
client/app/src/main/resources/main/option-view.css
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
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: 200px;
|
||||||
|
-fx-min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainLabel{
|
||||||
|
-fx-background-color: #8D99AE;
|
||||||
|
-fx-padding: 10px;
|
||||||
|
-fx-max-width: 200px;
|
||||||
|
-fx-min-width: 200px;
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
-fx-alignment: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainButton{
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
JFXButton{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comboBox{
|
||||||
|
-fx-background-color: white;
|
||||||
|
-fx-max-width: 200px;
|
||||||
|
-fx-min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userBtn{
|
||||||
|
-fx-max-width: 200px;
|
||||||
|
-fx-min-width: 200px;
|
||||||
|
}
|
51
client/app/src/main/resources/main/option-view.fxml
Normal file
51
client/app/src/main/resources/main/option-view.fxml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
|
<GridPane xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
fx:controller="main.OptionController"
|
||||||
|
prefHeight="400.0" prefWidth="600.0"
|
||||||
|
fx:id="mainGrid">
|
||||||
|
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
<ColumnConstraints minWidth="200"/>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
</rowConstraints>
|
||||||
|
|
||||||
|
<Label styleClass="mainLabel" GridPane.columnIndex="2" GridPane.halignment="CENTER" >Einstellungen</Label>
|
||||||
|
|
||||||
|
<Label GridPane.columnIndex="1" GridPane.rowIndex="2" GridPane.halignment="CENTER">User:</Label>
|
||||||
|
|
||||||
|
<JFXButton styleClass="userBtn" fx:id="updateUserBtn" GridPane.columnIndex="1" GridPane.columnSpan="3"
|
||||||
|
GridPane.rowIndex="4" GridPane.halignment="CENTER" onAction="#onUpdateBtnClick">User bearbeiten</JFXButton>
|
||||||
|
<JFXButton styleClass="userBtn" fx:id="deleteUserBtn" GridPane.columnIndex="1" GridPane.columnSpan="3"
|
||||||
|
GridPane.rowIndex="5" GridPane.halignment="CENTER" onAction="#onDeleteBtnClick">User löschen</JFXButton>
|
||||||
|
<JFXButton styleClass="userBtn" fx:id="createUserBtn" GridPane.columnIndex="1" GridPane.columnSpan="3"
|
||||||
|
GridPane.rowIndex="7" GridPane.halignment="CENTER" onAction="#onCreateBtnClick">User anlegen</JFXButton>
|
||||||
|
|
||||||
|
<Label styleClass="loginLbl" GridPane.columnIndex="1" GridPane.rowIndex="8"
|
||||||
|
GridPane.halignment="CENTER">Angemeldet bleiben:</Label>
|
||||||
|
<JFXToggleButton fx:id="saveLoginTBtn" GridPane.columnIndex="3" GridPane.rowIndex="8" onAction="#toggledBtn"/>
|
||||||
|
|
||||||
|
<Label fx:id="labelError" styleClass="errorMessage" GridPane.columnIndex="1" GridPane.rowIndex="9"/>
|
||||||
|
<JFXButton GridPane.columnIndex="4" GridPane.rowIndex="9" onAction="#onBackBtnClick">Zurück</JFXButton>
|
||||||
|
|
||||||
|
</GridPane>
|
@@ -43,6 +43,7 @@ Label{
|
|||||||
.errorMessage{
|
.errorMessage{
|
||||||
-fx-max-width: 400px;
|
-fx-max-width: 400px;
|
||||||
-fx-min-width: 400px;
|
-fx-min-width: 400px;
|
||||||
|
-fx-text-fill: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
Button{
|
Button{
|
||||||
|
@@ -3,11 +3,12 @@
|
|||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||||
<GridPane xmlns="http://javafx.com/javafx"
|
<GridPane xmlns="http://javafx.com/javafx"
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
fx:controller="users.CreateUserController">
|
fx:controller="users.CreateUserController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints minWidth="100"/>
|
<ColumnConstraints minWidth="50"/>
|
||||||
<ColumnConstraints minWidth="100"/>
|
<ColumnConstraints minWidth="100"/>
|
||||||
<ColumnConstraints minWidth="100"/>
|
<ColumnConstraints minWidth="100"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
@@ -40,16 +41,16 @@
|
|||||||
<PasswordField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
<PasswordField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||||
<PasswordField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
<PasswordField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
||||||
|
|
||||||
<ToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
<JFXToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||||
|
|
||||||
<Label fx:id="labelError" styleClass="errorMessage" GridPane.columnIndex="2" GridPane.rowIndex="7"/>
|
<Label fx:id="labelError" wrapText="true" styleClass="errorMessage" GridPane.columnIndex="2" GridPane.rowIndex="7"/>
|
||||||
|
|
||||||
<HBox GridPane.columnIndex="2" GridPane.rowIndex="8" alignment="CENTER_RIGHT">
|
<HBox GridPane.columnIndex="2" GridPane.rowIndex="8" alignment="CENTER_RIGHT">
|
||||||
<HBox.margin>
|
<HBox.margin>
|
||||||
<Insets right="100" left="100"/>
|
<Insets right="100" left="100"/>
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
<Button onAction="#abortBtnClick">Abbrechen</Button>
|
<Button onAction="#abortBtnClick">Abbrechen</Button>
|
||||||
<Button onAction="#createUser" styleClass="btnLogin" >Anmelden</Button>
|
<Button onAction="#createUser" styleClass="btnLogin" >Anlegen</Button>
|
||||||
|
|
||||||
</HBox>
|
</HBox>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
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;
|
||||||
|
}
|
57
client/app/src/main/resources/users/edit-user.fxml
Normal file
57
client/app/src/main/resources/users/edit-user.fxml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||||
|
<GridPane xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
fx:controller="users.EditUserController">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
</rowConstraints>
|
||||||
|
|
||||||
|
<Label styleClass="mainLabel" GridPane.columnIndex="2" >User bearbeiten</Label>
|
||||||
|
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="1" GridPane.columnIndex="1">Login:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="2" GridPane.columnIndex="1">Vorname:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="3" GridPane.columnIndex="1">Nachname:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="4" GridPane.columnIndex="1">Passwort:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="5" GridPane.columnIndex="1">Passwort wiederholen:</Label>
|
||||||
|
|
||||||
|
<Label styleClass="inputLabelAdmin" GridPane.rowIndex="6" GridPane.columnIndex="1">Admin:</Label>
|
||||||
|
|
||||||
|
<TextField fx:id="textLogin" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
||||||
|
<TextField fx:id="textForename" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
||||||
|
<TextField fx:id="textName" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="3" />
|
||||||
|
<PasswordField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||||
|
<PasswordField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
||||||
|
|
||||||
|
<JFXToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||||
|
|
||||||
|
<Label fx:id="labelError" wrapText="true" styleClass="errorMessage" GridPane.columnIndex="2" GridPane.rowIndex="7"/>
|
||||||
|
|
||||||
|
<HBox GridPane.columnIndex="2" GridPane.rowIndex="8" alignment="CENTER_RIGHT">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets right="100" left="100"/>
|
||||||
|
</HBox.margin>
|
||||||
|
<Button onAction="#abortBtnClick">Abbrechen</Button>
|
||||||
|
<Button onAction="#createUser" styleClass="btnLogin" >Bearbeiten</Button>
|
||||||
|
|
||||||
|
</HBox>
|
||||||
|
</GridPane>
|
||||||
|
|
@@ -2,6 +2,10 @@ plugins {
|
|||||||
java
|
java
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
val jacksonVersion = "2.13.0"
|
val jacksonVersion = "2.13.0"
|
||||||
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
|
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package config;
|
package config;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import res.DataController;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -18,8 +17,10 @@ public class ConfigLoader {
|
|||||||
return objectMapper.readValue(jsonString, Config.class);
|
return objectMapper.readValue(jsonString, Config.class);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("config.json missing");
|
System.out.println("config.json missing");
|
||||||
|
Config config = new Config(false, -1, "");
|
||||||
|
save(config);
|
||||||
|
return config;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void save(Config config){
|
public static void save(Config config){
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
package res;
|
package container;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
@@ -6,13 +6,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import helper.HttpRequestException;
|
import helper.HttpRequestException;
|
||||||
import helper.Tuple;
|
import helper.Tuple;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -118,7 +111,6 @@ public class DataController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Event> getAllVisibleEvents(LocalDateTime startDate, LocalDateTime endDate) throws HttpRequestException {
|
public ArrayList<Event> getAllVisibleEvents(LocalDateTime startDate, LocalDateTime endDate) throws HttpRequestException {
|
||||||
ArrayList<Event> eventList = new ArrayList<>();
|
|
||||||
try {
|
try {
|
||||||
Tuple<Integer, String> response = httpRequest.sendPostRequest(
|
Tuple<Integer, String> response = httpRequest.sendPostRequest(
|
||||||
ALL_EVENTS_ENDPOINT,
|
ALL_EVENTS_ENDPOINT,
|
||||||
@@ -133,28 +125,51 @@ public class DataController {
|
|||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
objectMapper.findAndRegisterModules();
|
objectMapper.findAndRegisterModules();
|
||||||
eventList = (ArrayList<Event>) objectMapper.readValue(jsonResponse, new TypeReference<List<Event>>() {
|
return (ArrayList<Event>) objectMapper.readValue(jsonResponse, new TypeReference<List<Event>>() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
} catch (HttpRequestException e) {
|
} catch (HttpRequestException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new HttpRequestException("Es konnte keine Verbindung mit dem Server hergestellt werden.", 600);
|
throw new HttpRequestException("Es konnte keine Verbindung mit dem Server hergestellt werden.", 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
return eventList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* User *
|
* User *
|
||||||
********/
|
********/
|
||||||
|
|
||||||
/*
|
public List<User> getAllUser() throws HttpRequestException {
|
||||||
|
String userJSON = sendBasicHttpRequest(
|
||||||
|
ALL_USER_ENDPOINT,
|
||||||
|
"",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
objectMapper.findAndRegisterModules();
|
||||||
|
try {
|
||||||
|
List<User> list = objectMapper.readValue(userJSON, new TypeReference<>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
for(User u : list){
|
||||||
|
System.out.println(u);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
public void createUser(User user) throws HttpRequestException {
|
public void createUser(User user) throws HttpRequestException {
|
||||||
sendBasicHttpRequest(
|
sendBasicHttpRequest(
|
||||||
ADD_USER_ENDPOINT,
|
ADD_USER_ENDPOINT,
|
||||||
user.getAsUrlParam(),
|
"name=" + user.getName() +
|
||||||
|
"&forename=" + user.getForename() +
|
||||||
|
"&login=" + user.getLogin() +
|
||||||
|
"&password=" + user.getPassword() +
|
||||||
|
"&isAdmin=" + user.isAdmin(),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -162,21 +177,28 @@ public class DataController {
|
|||||||
public void deleteUser(User user) throws HttpRequestException {
|
public void deleteUser(User user) throws HttpRequestException {
|
||||||
sendBasicHttpRequest(
|
sendBasicHttpRequest(
|
||||||
DELETE_USER_ENDPOINT,
|
DELETE_USER_ENDPOINT,
|
||||||
user.getAsUrlParam(),
|
"userId=" + user.getUserId(),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editUser(User oldUser, User user) throws HttpRequestException {
|
public void editUser(User user) throws HttpRequestException {
|
||||||
|
String urlParam = "userId=" + user.getUserId() +
|
||||||
|
"&name=" + user.getName() +
|
||||||
|
"&forename=" + user.getForename() +
|
||||||
|
"&login=" + user.getLogin() +
|
||||||
|
"&isAdmin=" + user.isAdmin() +
|
||||||
|
(user.getPassword() == null ? "" : "&password=" + user.getPassword());
|
||||||
|
|
||||||
|
System.out.println(urlParam);
|
||||||
sendBasicHttpRequest(
|
sendBasicHttpRequest(
|
||||||
EDIT_USER_ENDPOINT,
|
EDIT_USER_ENDPOINT,
|
||||||
user.getAsUrlParam(),
|
urlParam,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
private void sendBasicHttpRequest(String urlString, String urlParameters, boolean sendAuth) throws HttpRequestException {
|
private String sendBasicHttpRequest(String urlString, String urlParameters, boolean sendAuth) throws HttpRequestException {
|
||||||
try {
|
try {
|
||||||
Tuple<Integer, String> response = httpRequest.sendPostRequest(
|
Tuple<Integer, String> response = httpRequest.sendPostRequest(
|
||||||
urlString,
|
urlString,
|
||||||
@@ -186,6 +208,8 @@ public class DataController {
|
|||||||
if (response.getKey() != 200) {
|
if (response.getKey() != 200) {
|
||||||
throw new HttpRequestException(response);
|
throw new HttpRequestException(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return response.getValue();
|
||||||
} catch (HttpRequestException e) {
|
} catch (HttpRequestException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
@@ -1,19 +1,11 @@
|
|||||||
package res;
|
package container;
|
||||||
|
|
||||||
import com.sun.jdi.event.StepEvent;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.sql.SQLOutput;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.regex.PatternSyntaxException;
|
|
||||||
|
|
||||||
public class Event {
|
public class Event {
|
||||||
|
|
||||||
@@ -44,15 +36,15 @@ public class Event {
|
|||||||
|
|
||||||
System.out.println("Create Event");
|
System.out.println("Create Event");
|
||||||
if (name.length() < 3) {
|
if (name.length() < 3) {
|
||||||
throw new IllegalArgumentException("Der Name muss eine L\u00e4nge von 3 haben.");
|
throw new IllegalArgumentException("Der Name muss eine Länge von 3 haben.");
|
||||||
}
|
}
|
||||||
Pattern pattern = Pattern.compile("[A-Za-z\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df0-9 =!?+*/$.:,;_<>()-]*");
|
Pattern pattern = Pattern.compile("[A-Za-zäöüÄÖÜß0-9 =!?+*/$.:,;_<>()-]*");
|
||||||
Matcher matcher = pattern.matcher(name);
|
Matcher matcher = pattern.matcher(name);
|
||||||
if (!matcher.matches()) {
|
if (!matcher.matches()) {
|
||||||
throw new IllegalArgumentException("Der Name darf nur aus Zahlen, Buchstaben und folgenden Sonderzeichen bestehen: \u00e4\u00f6\u00fc \u00c4\u00d6\u00dc \u00df =!?+*/$.:,;_ <>()-");
|
throw new IllegalArgumentException("Der Name darf nur aus Zahlen, Buchstaben und folgenden Sonderzeichen bestehen: äöü ÄÖÜ ß =!?+*/$.:,;_ <>()-");
|
||||||
}
|
}
|
||||||
if (priority < 0) {
|
if (priority < 0) {
|
||||||
throw new IllegalArgumentException("Bitte eine Priorit\u00e4t w\u00e4hlen.");
|
throw new IllegalArgumentException("Bitte eine Priorität wählen.");
|
||||||
}
|
}
|
||||||
LocalDateTime today = LocalDateTime.now().toLocalDate().atStartOfDay();
|
LocalDateTime today = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||||
if (Duration.between(today, date).isNegative()) {
|
if (Duration.between(today, date).isNegative()) {
|
||||||
@@ -82,9 +74,7 @@ public class Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
System.out.println(name);
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
System.out.println(this.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPriority() {
|
public int getPriority() {
|
@@ -1,4 +1,4 @@
|
|||||||
package res;
|
package container;
|
||||||
|
|
||||||
import helper.Tuple;
|
import helper.Tuple;
|
||||||
|
|
||||||
@@ -9,7 +9,6 @@ import java.io.InputStreamReader;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class HttpRequest {
|
public class HttpRequest {
|
||||||
public static String TOKEN = "";
|
public static String TOKEN = "";
|
||||||
@@ -61,9 +60,9 @@ public class HttpRequest {
|
|||||||
BufferedReader in;
|
BufferedReader in;
|
||||||
|
|
||||||
if (status == 200) {
|
if (status == 200) {
|
||||||
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
||||||
} else {
|
} else {
|
||||||
in = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
|
in = new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((inputLine = in.readLine()) != null) {
|
while ((inputLine = in.readLine()) != null) {
|
75
client/data/src/main/java/container/User.java
Normal file
75
client/data/src/main/java/container/User.java
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package container;
|
||||||
|
|
||||||
|
public class User {
|
||||||
|
|
||||||
|
private int userId;
|
||||||
|
private String login;
|
||||||
|
private String forename;
|
||||||
|
private String name;
|
||||||
|
private String password;
|
||||||
|
private boolean isAdmin;
|
||||||
|
|
||||||
|
public User(){}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(int userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogin() {
|
||||||
|
return login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogin(String login) {
|
||||||
|
this.login = login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getForename() {
|
||||||
|
return forename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForename(String forename) {
|
||||||
|
this.forename = forename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdmin() {
|
||||||
|
return isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdmin(boolean admin) {
|
||||||
|
isAdmin = admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "User{" +
|
||||||
|
"userId=" + userId +
|
||||||
|
", login='" + login + '\'' +
|
||||||
|
", forename='" + forename + '\'' +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", password='" + password + '\'' +
|
||||||
|
", isAdmin=" + isAdmin +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user