Compare commits
37 Commits
0410-Switc
...
4db6bd1c66
Author | SHA1 | Date | |
---|---|---|---|
4db6bd1c66 | |||
22e7d30678 | |||
3c0ebd24d7 | |||
f649b618cf | |||
6e6183bf38 | |||
5dafdf08b4 | |||
cf960ff6d6 | |||
521b1cb2f7 | |||
a24addf6ec | |||
051000169e | |||
0893c4661e | |||
53b631678a | |||
07c27e84d8 | |||
0924625a0e | |||
3fe16186e2 | |||
7c8b1fefb7 | |||
654f34e30e | |||
baeed584ab | |||
ce309581ed | |||
f0405b5d86 | |||
0d105be15c | |||
646da71e8a | |||
46606a5afc | |||
b205c96f85 | |||
0ef383aa7f | |||
ea6420e234 | |||
eb55d5c650 | |||
f933690ba0 | |||
12fce27d04 | |||
d34d09aa2b | |||
226255f75a | |||
d574849407 | |||
c754b77c81 | |||
66edff8ed5 | |||
ded0b9042f | |||
e7b376e722 | |||
cb6c55a639 |
@@ -16,7 +16,12 @@ application {
|
|||||||
mainClassName = "client.MainApplication"
|
mainClassName = "client.MainApplication"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation("com.jfoenix:jfoenix:9.0.10")
|
||||||
implementation(project(":data"))
|
implementation(project(":data"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
client/app/src/main/java/customUI/Button.java
Normal file
8
client/app/src/main/java/customUI/Button.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package customUI;
|
||||||
|
|
||||||
|
public class Button extends javafx.scene.control.Button {
|
||||||
|
|
||||||
|
public void setTextValue(String text){
|
||||||
|
super.setText(Converter.CONVERT_STR(text));
|
||||||
|
}
|
||||||
|
}
|
21
client/app/src/main/java/customUI/Converter.java
Normal file
21
client/app/src/main/java/customUI/Converter.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package customUI;
|
||||||
|
|
||||||
|
public class Converter {
|
||||||
|
/*
|
||||||
|
Ä, ä \u00c4, \u00e4
|
||||||
|
Ö, ö \u00d6, \u00f6
|
||||||
|
Ü, ü \u00dc, \u00fc
|
||||||
|
ß \u00df
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
public static String CONVERT_STR(String str){
|
||||||
|
return str
|
||||||
|
.replace("ä", "\u00e4")
|
||||||
|
.replace("Ä", "\u00c4")
|
||||||
|
.replace("ö", "\u00f6")
|
||||||
|
.replace("Ö", "\u00d6")
|
||||||
|
.replace("ü", "\u00fc")
|
||||||
|
.replace("Ü", "\u00dc")
|
||||||
|
.replace("ß", "\u00df");
|
||||||
|
}
|
||||||
|
}
|
15
client/app/src/main/java/customUI/Label.java
Normal file
15
client/app/src/main/java/customUI/Label.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package customUI;
|
||||||
|
|
||||||
|
public class Label extends javafx.scene.control.Label {
|
||||||
|
public Label(String content){
|
||||||
|
super(Converter.CONVERT_STR(content));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Label(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextValue(String text){
|
||||||
|
super.setText(Converter.CONVERT_STR(text));
|
||||||
|
}
|
||||||
|
}
|
@@ -1,34 +1,41 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.*;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.util.StringConverter;
|
||||||
|
import javafx.util.converter.LocalTimeStringConverter;
|
||||||
import res.DataController;
|
import res.DataController;
|
||||||
import res.Event;
|
import res.Event;
|
||||||
|
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.format.FormatStyle;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class CreateEventController {
|
public class CreateEventController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public DatePicker datePickerDate;
|
public GridPane mainGrid;
|
||||||
@FXML
|
@FXML
|
||||||
public TextField textName;
|
public JFXDatePicker datePickerDate;
|
||||||
@FXML
|
@FXML
|
||||||
public TextField textStart;
|
public JFXTextField textName;
|
||||||
@FXML
|
@FXML
|
||||||
public TextField textEnd;
|
public JFXComboBox<String> ComboBoxPriotity;
|
||||||
@FXML
|
@FXML
|
||||||
public ComboBox<String> ComboBoxTyp;
|
public JFXToggleButton toggleBtnIsFullDay;
|
||||||
@FXML
|
@FXML
|
||||||
public ComboBox<String> ComboBoxPriotity;
|
public JFXToggleButton toggleBtnIsPrivate;
|
||||||
@FXML
|
|
||||||
public CheckBox checkBoxIsFullDay;
|
|
||||||
@FXML
|
|
||||||
public CheckBox checkBoxIsPrivate;
|
|
||||||
@FXML
|
@FXML
|
||||||
public Label labelError;
|
public Label labelError;
|
||||||
|
@FXML
|
||||||
|
public JFXTimePicker timeStart;
|
||||||
|
@FXML
|
||||||
|
public JFXTimePicker timeEnd;
|
||||||
|
|
||||||
|
|
||||||
public CreateEventController() {
|
public CreateEventController() {
|
||||||
@@ -36,25 +43,32 @@ public class CreateEventController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
|
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
|
||||||
|
timeStart.set24HourView(true);
|
||||||
|
timeStart.setConverter(defaultConverter);
|
||||||
|
|
||||||
|
timeEnd.set24HourView(true);
|
||||||
|
timeEnd.setConverter(defaultConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
protected void createBtnClick(ActionEvent actionEvent) {
|
protected void createBtnClick(ActionEvent actionEvent) {
|
||||||
try {
|
try {
|
||||||
if(datePickerDate.getValue() == null){
|
if (datePickerDate.getValue() == null) {
|
||||||
throw new IllegalArgumentException("Bitte w\u00e4hle ein Datum aus");
|
throw new IllegalArgumentException("Bitte w\u00e4hle ein Datum aus");
|
||||||
}
|
}
|
||||||
|
|
||||||
Event event = new Event(
|
Event event = new Event(
|
||||||
textName.getText(),
|
textName.getText(),
|
||||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||||
checkBoxIsFullDay.isSelected(),
|
toggleBtnIsFullDay.isSelected(),
|
||||||
checkBoxIsPrivate.isSelected(),
|
toggleBtnIsPrivate.isSelected(),
|
||||||
textStart.getText(),
|
timeStart.getValue().toString(),
|
||||||
textEnd.getText(),
|
timeEnd.getValue().toString(),
|
||||||
datePickerDate.getValue().atStartOfDay(),
|
datePickerDate.getValue().atStartOfDay(),
|
||||||
1
|
(int) DataController.USER_ID
|
||||||
);
|
);
|
||||||
|
|
||||||
System.out.println(event.getAsUrlParam());
|
System.out.println(event.getAsUrlParam());
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
MainApplication.main(args);
|
MainApplication.main(args);
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import javafx.application.Application;
|
|||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import res.DataController;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -11,22 +12,28 @@ import java.util.Objects;
|
|||||||
public class MainApplication extends Application {
|
public class MainApplication extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) throws IOException {
|
public void start(Stage stage) throws IOException {
|
||||||
|
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
|
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
|
||||||
|
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
|
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
|
||||||
scene.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("main-view.css")).toExternalForm());
|
scene.getStylesheets().add(Objects.requireNonNull(
|
||||||
|
|
||||||
|
MainApplication.class.getResource("main-view.css")).toExternalForm());
|
||||||
stage.setTitle("SharePlaner");
|
stage.setTitle("SharePlaner");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
|
||||||
|
|
||||||
FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml"));
|
FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml"));
|
||||||
Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500);
|
Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500);
|
||||||
sceneLogin.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("../users/login.css")).toExternalForm());
|
sceneLogin.getStylesheets().add(Objects.requireNonNull(
|
||||||
|
MainApplication.class.getResource("../users/login.css")).toExternalForm());
|
||||||
Stage stageLogin = new Stage();
|
Stage stageLogin = new Stage();
|
||||||
stageLogin.setTitle("Anmelden");
|
stageLogin.setTitle("Anmelden");
|
||||||
stageLogin.setScene(sceneLogin);
|
stageLogin.setScene(sceneLogin);
|
||||||
stageLogin.show();
|
stageLogin.showAndWait();
|
||||||
|
|
||||||
|
if (DataController.USER_ID >= 0) {
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Button;
|
import customUI.Button;
|
||||||
import javafx.scene.control.Label;
|
import customUI.Label;
|
||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
@@ -30,7 +28,7 @@ public class MainController {
|
|||||||
private GridPane calendarGrid;
|
private GridPane calendarGrid;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label LabelMonth;
|
private javafx.scene.control.Label LabelMonth;
|
||||||
|
|
||||||
private final String[] dayNames = {"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"};
|
private final String[] dayNames = {"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"};
|
||||||
private final Label[] dayLabel = new Label[7];
|
private final Label[] dayLabel = new Label[7];
|
||||||
@@ -73,7 +71,7 @@ public class MainController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
protected void onTodayClick(){
|
protected void onTodayClick() {
|
||||||
weekOffset = 0;
|
weekOffset = 0;
|
||||||
setDates();
|
setDates();
|
||||||
updateEvents();
|
updateEvents();
|
||||||
@@ -89,9 +87,11 @@ public class MainController {
|
|||||||
@FXML
|
@FXML
|
||||||
protected void onAddBtnClick() {
|
protected void onAddBtnClick() {
|
||||||
try {
|
try {
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("create-event.fxml"));
|
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||||
|
MainApplication.class.getResource("create-event.fxml"));
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 650, 650);
|
Scene scene = new Scene(fxmlLoader.load(), 650, 650);
|
||||||
scene.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("create-event.css")).toExternalForm());
|
scene.getStylesheets().add(Objects.requireNonNull(
|
||||||
|
MainApplication.class.getResource("create-event.css")).toExternalForm());
|
||||||
Stage stage = new Stage();
|
Stage stage = new Stage();
|
||||||
stage.setTitle("Termin erstellen");
|
stage.setTitle("Termin erstellen");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
@@ -108,7 +108,7 @@ 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();
|
Label label = new Label();
|
||||||
label.setText(dayNames[i]);
|
label.setTextValue(dayNames[i]);
|
||||||
label.setMaxHeight(Double.MAX_VALUE);
|
label.setMaxHeight(Double.MAX_VALUE);
|
||||||
label.setMaxWidth(Double.MAX_VALUE);
|
label.setMaxWidth(Double.MAX_VALUE);
|
||||||
label.getStyleClass().add("labelDays");
|
label.getStyleClass().add("labelDays");
|
||||||
@@ -140,14 +140,31 @@ public class MainController {
|
|||||||
HBox btnHBox = new HBox();
|
HBox btnHBox = new HBox();
|
||||||
btnHBox.setAlignment(Pos.BOTTOM_RIGHT);
|
btnHBox.setAlignment(Pos.BOTTOM_RIGHT);
|
||||||
Button deleteBtn = new Button();
|
Button deleteBtn = new Button();
|
||||||
deleteBtn.setText(" X ");
|
deleteBtn.setTextValue(" X ");
|
||||||
deleteBtn.setOnAction(e -> {
|
deleteBtn.setOnAction(e -> {
|
||||||
DataController dataController = new DataController();
|
DataController dataController = new DataController();
|
||||||
dataController.deleteEvent(event.getId());
|
dataController.deleteEvent(event.getId());
|
||||||
updateEvents();
|
updateEvents();
|
||||||
});
|
});
|
||||||
Button editBtn = new Button();
|
Button editBtn = new Button();
|
||||||
editBtn.setText("edit");
|
editBtn.setTextValue("edit");
|
||||||
|
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);
|
||||||
|
stage.showAndWait();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
btnHBox.getChildren().add(editBtn);
|
btnHBox.getChildren().add(editBtn);
|
||||||
btnHBox.getChildren().add(deleteBtn);
|
btnHBox.getChildren().add(deleteBtn);
|
||||||
vBox.getChildren().add(btnHBox);
|
vBox.getChildren().add(btnHBox);
|
||||||
@@ -165,12 +182,6 @@ public class MainController {
|
|||||||
Label typeLabel = new Label("Wer: " + event.getOwnerName());
|
Label typeLabel = new Label("Wer: " + event.getOwnerName());
|
||||||
vBox.getChildren().add(typeLabel);
|
vBox.getChildren().add(typeLabel);
|
||||||
|
|
||||||
/*
|
|
||||||
Ä, ä \u00c4, \u00e4
|
|
||||||
Ö, ö \u00d6, \u00f6
|
|
||||||
Ü, ü \u00dc, \u00fc
|
|
||||||
ß \u00df
|
|
||||||
*/
|
|
||||||
Label prioLabel = new Label("Priorit\u00e4t: " + event.getPriority());
|
Label prioLabel = new Label("Priorit\u00e4t: " + event.getPriority());
|
||||||
vBox.getChildren().add(prioLabel);
|
vBox.getChildren().add(prioLabel);
|
||||||
|
|
||||||
@@ -182,7 +193,8 @@ public class MainController {
|
|||||||
|
|
||||||
LocalDateTime eventDate = event.getDate();
|
LocalDateTime eventDate = event.getDate();
|
||||||
|
|
||||||
int day = (int) Duration.between(weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays();
|
int day = (int) Duration.between(
|
||||||
|
weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays();
|
||||||
|
|
||||||
if (day >= 0 && day < 7) {
|
if (day >= 0 && day < 7) {
|
||||||
dayVBoxes[day].getChildren().add(vBox);
|
dayVBoxes[day].getChildren().add(vBox);
|
||||||
@@ -208,7 +220,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].setText(dayFormatter.format(weekStartDateTime.plusDays(i)));
|
dayLabel[i].setTextValue(dayFormatter.format(weekStartDateTime.plusDays(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelMonth.setText(dateFormatter.format(weekStartDateTime));
|
LabelMonth.setText(dateFormatter.format(weekStartDateTime));
|
||||||
|
55
client/app/src/main/java/users/CreateUserController.java
Normal file
55
client/app/src/main/java/users/CreateUserController.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package users;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.control.ToggleButton;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class CreateUserController {
|
||||||
|
|
||||||
|
public TextField textName;
|
||||||
|
public TextField textPassword;
|
||||||
|
public TextField textPasswordSecond;
|
||||||
|
public ToggleButton checkButtonIsAdmin;
|
||||||
|
public TextField textLogin;
|
||||||
|
public TextField textForename;
|
||||||
|
public Label labelError;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if (textPassword.getText().trim().isEmpty()) {
|
||||||
|
labelError.setText("Bitte Passwort eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||||
|
labelError.setText("Passwörter stimmen nicht überein!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void abortBtnClick(ActionEvent event) {
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
}
|
56
client/app/src/main/java/users/EditUserController.java
Normal file
56
client/app/src/main/java/users/EditUserController.java
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package users;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.control.ToggleButton;
|
||||||
|
import javafx.scene.paint.Paint;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class EditUserController {
|
||||||
|
|
||||||
|
public TextField textName;
|
||||||
|
public TextField textPassword;
|
||||||
|
public TextField textPasswordSecond;
|
||||||
|
public ToggleButton checkButtonIsAdmin;
|
||||||
|
public TextField textLogin;
|
||||||
|
public TextField textForename;
|
||||||
|
public Label labelError;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void saveUser(ActionEvent event) {
|
||||||
|
labelError.setTextFill(Paint.valueOf("Red"));
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if (textPassword.getText().trim().isEmpty()) {
|
||||||
|
labelError.setText("Bitte Passwort eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||||
|
labelError.setText("Passwörter stimmen nicht überein!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void abortBtnClick(ActionEvent event) {
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +0,0 @@
|
|||||||
package users;
|
|
||||||
|
|
||||||
public class LoginControler {
|
|
||||||
}
|
|
50
client/app/src/main/java/users/LoginController.java
Normal file
50
client/app/src/main/java/users/LoginController.java
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package users;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.*;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import res.DataController;
|
||||||
|
|
||||||
|
public class LoginController {
|
||||||
|
@FXML
|
||||||
|
public JFXTextField userField;
|
||||||
|
@FXML
|
||||||
|
public JFXPasswordField passField;
|
||||||
|
@FXML
|
||||||
|
public Label userErrLabel;
|
||||||
|
@FXML
|
||||||
|
public Label passErrLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void login(ActionEvent event) {
|
||||||
|
if (userField.getText().trim().isEmpty()) {
|
||||||
|
userErrLabel.setText("Bitte Usernamen eingeben!");
|
||||||
|
passErrLabel.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (passField.getText().trim().isEmpty()) {
|
||||||
|
userErrLabel.setText("");
|
||||||
|
passErrLabel.setText("Bitte Passwort eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataController dataController = new DataController();
|
||||||
|
if (!dataController.login(userField.getText(), passField.getText())) {
|
||||||
|
userErrLabel.setText("Name und Passwort passen nicht zueinander!");
|
||||||
|
passErrLabel.setText("Name und Passwort passen nicht zueinander!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void abortBtnClick(ActionEvent event) {
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
}
|
@@ -28,10 +28,16 @@ Label{
|
|||||||
|
|
||||||
.inputField{
|
.inputField{
|
||||||
-fx-padding: 10px;
|
-fx-padding: 10px;
|
||||||
|
-fx-background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainButton{
|
.mainButton{
|
||||||
-fx-font-weight: bold;
|
-fx-font-weight: bold;
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
JFXButton{
|
||||||
|
-fx-background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
#labelError{
|
#labelError{
|
||||||
@@ -43,4 +49,16 @@ Label{
|
|||||||
-fx-max-height: 400px;
|
-fx-max-height: 400px;
|
||||||
-fx-wrap-text: true;
|
-fx-wrap-text: true;
|
||||||
-fx-font-size: 16px;
|
-fx-font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputDate{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comboBox{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timePicker{
|
||||||
|
-fx-background-color: white;
|
||||||
}
|
}
|
@@ -5,7 +5,10 @@
|
|||||||
|
|
||||||
<?import javafx.collections.FXCollections?>
|
<?import javafx.collections.FXCollections?>
|
||||||
<?import java.lang.String?>
|
<?import java.lang.String?>
|
||||||
<GridPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.CreateEventController">
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
|
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="main.CreateEventController">
|
||||||
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints/>
|
<ColumnConstraints/>
|
||||||
@@ -13,50 +16,49 @@
|
|||||||
<ColumnConstraints/>
|
<ColumnConstraints/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<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 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>
|
</rowConstraints>
|
||||||
|
|
||||||
<Label styleClass="mainLabel">Termin anlegen</Label>
|
<Label styleClass="mainLabel">Termin anlegen</Label>
|
||||||
|
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="1">Datum:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="1">Titel:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="2">Titel:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="2">Datum:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="3">Von:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="3">Von:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="4">Bis:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="4">Bis:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="5">Typ:</Label>
|
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="6">Priorität:</Label>
|
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="7">Ganztägig:</Label>
|
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="8">Privat:</Label>
|
|
||||||
|
|
||||||
<DatePicker fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
<Label styleClass="inputLabel" GridPane.rowIndex="5">Priorität:</Label>
|
||||||
<TextField fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="400" minWidth="400"/>
|
<Label styleClass="inputLabel" GridPane.rowIndex="6">Ganztägig:</Label>
|
||||||
<TextField fx:id="textStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="400" minWidth="400"/>
|
<Label styleClass="inputLabel" GridPane.rowIndex="7">Privat:</Label>
|
||||||
<TextField fx:id="textEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="400" minWidth="400"/>
|
|
||||||
<ComboBox fx:id="ComboBoxTyp" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="400" minWidth="400"/>
|
<JFXTextField styleClass="inputField" fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
||||||
<ComboBox fx:id="ComboBoxPriotity" GridPane.columnIndex="1" GridPane.rowIndex="6" maxWidth="200" minWidth="200">
|
<JFXDatePicker styleClass="inputDate" fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="200" minWidth="200"/>
|
||||||
|
|
||||||
|
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||||
<items>
|
<items>
|
||||||
<FXCollections fx:factory="observableArrayList">
|
<FXCollections fx:factory="observableArrayList">
|
||||||
<String fx:value="gering" />
|
<String fx:value="gering"/>
|
||||||
<String fx:value="mittel" />
|
<String fx:value="mittel"/>
|
||||||
<String fx:value="hoch" />
|
<String fx:value="hoch"/>
|
||||||
</FXCollections>
|
</FXCollections>
|
||||||
</items>
|
</items>
|
||||||
</ComboBox>
|
</JFXComboBox>
|
||||||
<CheckBox fx:id="checkBoxIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||||
<CheckBox fx:id="checkBoxIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||||
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="9"/>
|
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||||
|
|
||||||
<HBox GridPane.columnIndex="1" GridPane.rowIndex="10" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
||||||
<Button onAction="#abortBtnClick" maxWidth="150" minWidth="150" >Abbrechen</Button>
|
<JFXButton onAction="#abortBtnClick" maxWidth="150" minWidth="150">Abbrechen</JFXButton>
|
||||||
<Button styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Anlegen</Button>
|
<JFXButton styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Anlegen</JFXButton>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
64
client/app/src/main/resources/main/edit-event.fxml
Normal file
64
client/app/src/main/resources/main/edit-event.fxml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<?import javafx.collections.FXCollections?>
|
||||||
|
<?import java.lang.String?>
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
|
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="main.CreateEventController">
|
||||||
|
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints/>
|
||||||
|
<ColumnConstraints/>
|
||||||
|
<ColumnConstraints/>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<Label styleClass="mainLabel">Termin bearbeiten</Label>
|
||||||
|
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="1">Titel:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="2">Datum:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="3">Von:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="4">Bis:</Label>
|
||||||
|
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="5">Priorität:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="6">Ganztägig:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="7">Privat:</Label>
|
||||||
|
|
||||||
|
<JFXTextField styleClass="inputField" fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
||||||
|
<JFXDatePicker styleClass="inputDate" fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="200" minWidth="200"/>
|
||||||
|
|
||||||
|
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||||
|
<items>
|
||||||
|
<FXCollections fx:factory="observableArrayList">
|
||||||
|
<String fx:value="gering"/>
|
||||||
|
<String fx:value="mittel"/>
|
||||||
|
<String fx:value="hoch"/>
|
||||||
|
</FXCollections>
|
||||||
|
</items>
|
||||||
|
</JFXComboBox>
|
||||||
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||||
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||||
|
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||||
|
|
||||||
|
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
||||||
|
<JFXButton onAction="#abortBtnClick" maxWidth="150" minWidth="150">Abbrechen</JFXButton>
|
||||||
|
<JFXButton styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Speichern</JFXButton>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
|
</GridPane>
|
@@ -72,3 +72,7 @@ Label{
|
|||||||
-fx-max-height: 40px;
|
-fx-max-height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navBtn{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -4,64 +4,70 @@
|
|||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.image.*?>
|
<?import javafx.scene.image.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
<GridPane style="-fx-background-color: #424242;" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.MainController">
|
<GridPane style="-fx-background-color: #424242;" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="main.MainController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="NEVER" maxWidth="60.0" minWidth="60.0" />
|
<ColumnConstraints hgrow="NEVER" maxWidth="60.0" minWidth="60.0"/>
|
||||||
<ColumnConstraints hgrow="ALWAYS" />
|
<ColumnConstraints hgrow="ALWAYS"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints vgrow="SOMETIMES" />
|
<RowConstraints vgrow="SOMETIMES"/>
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<VBox alignment="TOP_CENTER" prefHeight="200.0" prefWidth="100.0" spacing="5.0" style="-fx-background-color: #525E74;">
|
<VBox alignment="TOP_CENTER" prefHeight="200.0" prefWidth="100.0" spacing="5.0"
|
||||||
|
style="-fx-background-color: #525E74;">
|
||||||
<ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true">
|
<ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||||
ADD
|
ADD
|
||||||
</Button>
|
</JFXButton>
|
||||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||||
ADD
|
ADD
|
||||||
</Button>
|
</JFXButton>
|
||||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||||
ADD
|
ADD
|
||||||
</Button>
|
</JFXButton>
|
||||||
</VBox>
|
</VBox>
|
||||||
<GridPane prefHeight="200.0" prefWidth="222.0" GridPane.columnIndex="1" GridPane.rowIndex="0">
|
<GridPane prefHeight="200.0" prefWidth="222.0" GridPane.columnIndex="1" GridPane.rowIndex="0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="ALWAYS" />
|
<ColumnConstraints hgrow="ALWAYS"/>
|
||||||
<ColumnConstraints />
|
<ColumnConstraints/>
|
||||||
<ColumnConstraints />
|
<ColumnConstraints/>
|
||||||
<ColumnConstraints />
|
<ColumnConstraints/>
|
||||||
<ColumnConstraints />
|
<ColumnConstraints/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints />
|
<RowConstraints/>
|
||||||
<RowConstraints vgrow="ALWAYS" />
|
<RowConstraints vgrow="ALWAYS"/>
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<Label fx:id="LabelMonth" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" styleClass="labelMonth" textFill="WHITE" GridPane.columnIndex="0" GridPane.rowIndex="0">
|
<Label fx:id="LabelMonth" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
|
||||||
|
styleClass="labelMonth" textFill="WHITE" GridPane.columnIndex="0" GridPane.rowIndex="0">
|
||||||
Monat
|
Monat
|
||||||
<padding>
|
<padding>
|
||||||
<Insets left="5" />
|
<Insets left="5"/>
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<Button onAction="#onBackClick" GridPane.columnIndex="1" maxHeight="1.7976931348623157E308">zurück</Button>
|
<JFXButton styleClass="navBtn" onAction="#onBackClick" GridPane.columnIndex="1" maxHeight="1.7976931348623157E308">zurück</JFXButton>
|
||||||
<Button onAction="#onTodayClick" GridPane.columnIndex="2" maxHeight="1.7976931348623157E308">heute</Button>
|
<JFXButton styleClass="navBtn" onAction="#onTodayClick" GridPane.columnIndex="2" maxHeight="1.7976931348623157E308">heute</JFXButton>
|
||||||
<Button onAction="#onNextClick" GridPane.columnIndex="3" maxHeight="1.7976931348623157E308">weiter</Button>
|
<JFXButton styleClass="navBtn" onAction="#onNextClick" GridPane.columnIndex="3" maxHeight="1.7976931348623157E308">weiter</JFXButton>
|
||||||
|
|
||||||
<GridPane fx:id="calendarGrid" gridLinesVisible="true" styleClass="gridCalendar" GridPane.columnSpan="4" GridPane.columnIndex="0" GridPane.rowIndex="1">
|
<GridPane fx:id="calendarGrid" gridLinesVisible="true" styleClass="gridCalendar" GridPane.columnSpan="4"
|
||||||
|
GridPane.columnIndex="0" GridPane.rowIndex="1">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="14.2857142857" minWidth="14.2857142857" percentWidth="14.2857142857" />
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="14.2857142857" minWidth="14.2857142857"
|
||||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
percentWidth="14.2857142857"/>
|
||||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857"/>
|
||||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857"/>
|
||||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857"/>
|
||||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857"/>
|
||||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857"/>
|
||||||
|
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="55.0" minHeight="25.0" vgrow="NEVER" />
|
<RowConstraints maxHeight="55.0" minHeight="25.0" vgrow="NEVER"/>
|
||||||
<RowConstraints percentHeight="-Infinity" vgrow="ALWAYS" />
|
<RowConstraints percentHeight="-Infinity" vgrow="ALWAYS"/>
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
56
client/app/src/main/resources/users/create-user.css
Normal file
56
client/app/src/main/resources/users/create-user.css
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
* {
|
||||||
|
-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-max-width: 400px;
|
||||||
|
-fx-min-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
Button{
|
||||||
|
-fx-max-width: 150px;
|
||||||
|
-fx-min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnLogin{
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
}
|
||||||
|
|
56
client/app/src/main/resources/users/create-user.fxml
Normal file
56
client/app/src/main/resources/users/create-user.fxml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<GridPane xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
fx:controller="users.CreateUserController">
|
||||||
|
<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 anlegen</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" />
|
||||||
|
<TextField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||||
|
<TextField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
||||||
|
|
||||||
|
<ToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||||
|
|
||||||
|
<Label fx:id="labelError" 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" >Anmelden</Button>
|
||||||
|
|
||||||
|
</HBox>
|
||||||
|
</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;
|
||||||
|
}
|
55
client/app/src/main/resources/users/edit-user.fxml
Normal file
55
client/app/src/main/resources/users/edit-user.fxml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<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" />
|
||||||
|
<TextField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||||
|
<TextField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
||||||
|
|
||||||
|
<ToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||||
|
|
||||||
|
<Label fx:id="labelError" 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="#saveUser" styleClass="btnLogin" >Speichern</Button>
|
||||||
|
|
||||||
|
</HBox>
|
||||||
|
</GridPane>
|
@@ -0,0 +1,53 @@
|
|||||||
|
* {
|
||||||
|
-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);
|
||||||
|
}
|
||||||
|
|
||||||
|
Label{
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-max-width: 150px;
|
||||||
|
-fx-min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorLbl{
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
-fx-max-width: 200px;
|
||||||
|
-fx-text-fill: #ff5555;
|
||||||
|
-fx-padding: 16px;
|
||||||
|
-fx-min-height: 140px;
|
||||||
|
-fx-max-height: 400px;
|
||||||
|
-fx-wrap-text: true;
|
||||||
|
-fx-font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userField{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.passField{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quitBtn{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginBtn{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
@@ -1,12 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import java.lang.*?>
|
|
||||||
<?import java.util.*?>
|
|
||||||
<?import javafx.scene.*?>
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
<GridPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="users.LoginControler">
|
<GridPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="users.LoginController">
|
||||||
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints/>
|
<ColumnConstraints/>
|
||||||
@@ -14,23 +12,23 @@
|
|||||||
<ColumnConstraints/>
|
<ColumnConstraints/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<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>
|
</rowConstraints>
|
||||||
|
|
||||||
<Label GridPane.columnIndex="1">Anmelden</Label>
|
<Label GridPane.columnIndex="1">Anmelden</Label>
|
||||||
|
|
||||||
<Label GridPane.rowIndex="1">Username</Label>
|
<Label GridPane.rowIndex="1">Username</Label>
|
||||||
<TextField GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="userField"></TextField>
|
<JFXTextField styleClass="userField" GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="userField"/>
|
||||||
<Label GridPane.columnIndex="2" GridPane.rowIndex="1" fx:id="userErrLabel">Error</Label>
|
<Label styleClass="errorLbl" GridPane.columnIndex="2" GridPane.rowIndex="1" fx:id="userErrLabel"/>
|
||||||
|
|
||||||
<Label GridPane.rowIndex="2">Paswort</Label>
|
<Label GridPane.rowIndex="2">Paswort</Label>
|
||||||
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="passField"></PasswordField>
|
<JFXPasswordField styleClass="passField" GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="passField"/>
|
||||||
<Label GridPane.columnIndex="2" GridPane.rowIndex="2" fx:id="passErrLabel">Error</Label>
|
<Label styleClass="errorLbl" GridPane.columnIndex="2" GridPane.rowIndex="2" fx:id="passErrLabel"/>
|
||||||
|
|
||||||
<Button GridPane.columnIndex="1" GridPane.rowIndex="3">Beenden</Button>
|
<JFXButton styleClass="quitBtn" onAction="#abortBtnClick" GridPane.columnIndex="1" GridPane.rowIndex="3">Beenden</JFXButton>
|
||||||
<Button GridPane.columnIndex="2" GridPane.rowIndex="3">Anmelden</Button>
|
<JFXButton styleClass="loginBtn" onAction="#login" GridPane.columnIndex="2" GridPane.rowIndex="3">Anmelden</JFXButton>
|
||||||
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
@@ -14,28 +14,47 @@ import java.util.*;
|
|||||||
|
|
||||||
public class DataController {
|
public class DataController {
|
||||||
|
|
||||||
private static final String ALL_EVENTS_ENDPOINT = "http://localhost:8080/vpr/all-events";
|
public static long USER_ID = -1;
|
||||||
private static final String ALL_USERS_ENDPOINT = "http://localhost:8080/vpr/all-users";
|
|
||||||
private static final String ADD_EVENT_ENDPOINT = "http://localhost:8080/vpr/add-event";
|
private static final String ALL_EVENTS_ENDPOINT = "http://localhost:8080/event/all";
|
||||||
private static final String DELETE_EVENT_ENDPOINT = "http://localhost:8080/vpr/del-event";
|
private static final String ADD_EVENT_ENDPOINT = "http://localhost:8080/event/add";
|
||||||
|
private static final String DELETE_EVENT_ENDPOINT = "http://localhost:8080/event/del";
|
||||||
|
|
||||||
|
private static final String LOGIN_ENDPOINT = "http://localhost:8080/user/login";
|
||||||
|
private static final String ALL_USERS_ENDPOINT = "http://localhost:8080/user/all";
|
||||||
|
|
||||||
private final HttpRequest httpRequest;
|
private final HttpRequest httpRequest;
|
||||||
|
|
||||||
public DataController(){
|
public DataController() {
|
||||||
httpRequest = new HttpRequest();
|
httpRequest = new HttpRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createEvent(Event event){
|
public boolean login(String username, String password) {
|
||||||
try {
|
try {
|
||||||
System.out.println(httpRequest.sendPostRequest(ADD_EVENT_ENDPOINT, event.getAsUrlParam()));
|
USER_ID = Long.parseLong(httpRequest.sendPostRequest(
|
||||||
|
LOGIN_ENDPOINT,
|
||||||
|
"login=" + username
|
||||||
|
+ "&password=" + password,
|
||||||
|
false
|
||||||
|
));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return USER_ID >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createEvent(Event event) {
|
||||||
|
try {
|
||||||
|
System.out.println(httpRequest.sendPostRequest(ADD_EVENT_ENDPOINT, event.getAsUrlParam(), true));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Es konnte keine Verbindung mit dem Server hergestellt werden.");
|
throw new RuntimeException("Es konnte keine Verbindung mit dem Server hergestellt werden.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteEvent(int eventId){
|
public void deleteEvent(int eventId) {
|
||||||
try {
|
try {
|
||||||
System.out.println(httpRequest.sendPostRequest(DELETE_EVENT_ENDPOINT, "eventId=" + eventId));
|
System.out.println(httpRequest.sendPostRequest(DELETE_EVENT_ENDPOINT, "eventId=" + eventId, true));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -45,16 +64,16 @@ public class DataController {
|
|||||||
ArrayList<Event> eventList = new ArrayList<>();
|
ArrayList<Event> eventList = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String jsonResponse = httpRequest.sendPostRequest(ALL_EVENTS_ENDPOINT, "userId=1");
|
String jsonResponse = httpRequest.sendPostRequest(ALL_EVENTS_ENDPOINT, "userId=" + USER_ID, true);
|
||||||
System.out.println(jsonResponse);
|
System.out.println(jsonResponse);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
//String json = "{ \"color\" : \"Black\", \"type\" : \"BMW\" }";
|
//String json = "{ \"color\" : \"Black\", \"type\" : \"BMW\" }";
|
||||||
|
|
||||||
for (Object obj : objectMapper.readValue(jsonResponse, Object[].class)){
|
for (Object obj : objectMapper.readValue(jsonResponse, Object[].class)) {
|
||||||
ArrayList<Object> list = new ArrayList<>();
|
ArrayList<Object> list = new ArrayList<>();
|
||||||
if (obj.getClass().isArray()) {
|
if (obj.getClass().isArray()) {
|
||||||
list = (ArrayList<Object>) Arrays.asList((Object[])obj);
|
list = (ArrayList<Object>) Arrays.asList((Object[]) obj);
|
||||||
} else if (obj instanceof Collection) {
|
} else if (obj instanceof Collection) {
|
||||||
list = new ArrayList<>((Collection<?>) obj);
|
list = new ArrayList<>((Collection<?>) obj);
|
||||||
}
|
}
|
||||||
@@ -93,4 +112,4 @@ public class DataController {
|
|||||||
|
|
||||||
return objectMapper.readValue(jsonString, Event[].class);
|
return objectMapper.readValue(jsonString, Event[].class);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,6 +2,7 @@ package res;
|
|||||||
|
|
||||||
import com.sun.jdi.event.StepEvent;
|
import com.sun.jdi.event.StepEvent;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -70,10 +71,30 @@ public class 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\u00e4nge von 3 haben.");
|
||||||
}
|
}
|
||||||
Pattern pattern = Pattern.compile("[A-Za-zÄÖÜäöü0-9 =!?+*/$%€.:,;_<>()-]*");
|
Pattern pattern = Pattern.compile("[A-Za-z\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df0-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: =!?+*/$%€.:,;_ <>()-");
|
System.out.println(name);
|
||||||
|
|
||||||
|
byte[] bytes = name.getBytes(StandardCharsets.UTF_16);
|
||||||
|
|
||||||
|
String utf8EncodedString = new String(bytes, StandardCharsets.UTF_16);
|
||||||
|
System.out.println(utf8EncodedString);
|
||||||
|
|
||||||
|
for (char c : (name).toCharArray()) {
|
||||||
|
System.out.print(c + " " + (int)c + ", ");
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
for (char c : (name).toCharArray()) {
|
||||||
|
System.out.print(c + " " + (int)c + ", ");
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
for (char c : ("TäöüÄÖÜ").toCharArray()) {
|
||||||
|
System.out.print(c + " " + (int)c + ", ");
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
throw new IllegalArgumentException("Der Name darf nur aus Zahlen, Buchstaben und folgenden Sonderzeichen bestehen: \u00e4\u00f6\u00fc \u00c4\u00d6\u00dc \u00df =!?+*/$.:,;_ <>()-");
|
||||||
}
|
}
|
||||||
if(priority < 0){
|
if(priority < 0){
|
||||||
throw new IllegalArgumentException("Bitte eine Priorit\u00e4t w\u00e4hlen.");
|
throw new IllegalArgumentException("Bitte eine Priorit\u00e4t w\u00e4hlen.");
|
||||||
@@ -106,7 +127,7 @@ public class Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = convertToASCII(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPriority() {
|
public int getPriority() {
|
||||||
@@ -192,4 +213,9 @@ public class Event {
|
|||||||
"&isFullDay=" + isFullDay() +
|
"&isFullDay=" + isFullDay() +
|
||||||
"&isPrivate=" + isPrivate();
|
"&isPrivate=" + isPrivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String convertToASCII(String s){
|
||||||
|
byte[] germanBytes = s.getBytes();
|
||||||
|
return new String(germanBytes, StandardCharsets.US_ASCII);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,10 +9,23 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class HttpRequest {
|
public class HttpRequest {
|
||||||
public String sendPostRequest(String urlString, String urlParameters) throws Exception{
|
public String sendPostRequest(String urlString, String urlParameters, boolean sendAuth) throws Exception {
|
||||||
byte[] postData = urlParameters.getBytes(StandardCharsets.UTF_8);
|
byte[] postData = urlParameters.getBytes(StandardCharsets.UTF_8);
|
||||||
int postDataLength = postData.length;
|
int postDataLength = postData.length;
|
||||||
|
|
||||||
|
/*
|
||||||
|
URL url = new URL("http://test.de:8080/event/add");
|
||||||
|
HttpURLConnection http = (HttpURLConnection)url.openConnection();
|
||||||
|
http.setRequestMethod("POST");
|
||||||
|
http.setDoOutput(true);
|
||||||
|
http.setRequestProperty("Accept", "application/json");
|
||||||
|
http.setRequestProperty("Authorization", "Bearer {token}");
|
||||||
|
http.setRequestProperty("Content-Type", "");
|
||||||
|
http.setRequestProperty("Content-Length", "0");
|
||||||
|
|
||||||
|
System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
|
||||||
|
http.disconnect();
|
||||||
|
*/
|
||||||
URL url = new URL(urlString);
|
URL url = new URL(urlString);
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
|
||||||
@@ -23,6 +36,12 @@ public class HttpRequest {
|
|||||||
con.setRequestProperty("charset", "utf-8");
|
con.setRequestProperty("charset", "utf-8");
|
||||||
con.setRequestProperty("Content-Length", Integer.toString(postDataLength));
|
con.setRequestProperty("Content-Length", Integer.toString(postDataLength));
|
||||||
con.setUseCaches(false);
|
con.setUseCaches(false);
|
||||||
|
|
||||||
|
if(sendAuth){
|
||||||
|
con.setRequestProperty("Accept", "application/json");
|
||||||
|
con.setRequestProperty("Authorization", "Bearer {token}");
|
||||||
|
}
|
||||||
|
|
||||||
try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
|
try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
|
||||||
wr.write(postData);
|
wr.write(postData);
|
||||||
}
|
}
|
||||||
@@ -46,7 +65,7 @@ public class HttpRequest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String sendGetRequest(String urlString) throws Exception{
|
public String sendGetRequest(String urlString) throws Exception {
|
||||||
URL url = new URL(urlString);
|
URL url = new URL(urlString);
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
|
Reference in New Issue
Block a user