Merge remote-tracking branch 'origin/merge' into merge
This commit is contained in:
commit
f649b618cf
@ -16,7 +16,12 @@ application {
|
||||
mainClassName = "client.MainApplication"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.jfoenix:jfoenix:9.0.10")
|
||||
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,33 +1,41 @@
|
||||
package main;
|
||||
|
||||
import com.jfoenix.controls.*;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.StringConverter;
|
||||
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 CreateEventController {
|
||||
|
||||
@FXML
|
||||
public DatePicker datePickerDate;
|
||||
public GridPane mainGrid;
|
||||
@FXML
|
||||
public TextField textName;
|
||||
public JFXDatePicker datePickerDate;
|
||||
@FXML
|
||||
public TextField textStart;
|
||||
public JFXTextField textName;
|
||||
@FXML
|
||||
public TextField textEnd;
|
||||
public JFXComboBox<String> ComboBoxPriotity;
|
||||
@FXML
|
||||
public ComboBox<String> ComboBoxTyp;
|
||||
public JFXToggleButton toggleBtnIsFullDay;
|
||||
@FXML
|
||||
public ComboBox<String> ComboBoxPriotity;
|
||||
@FXML
|
||||
public CheckBox checkBoxIsFullDay;
|
||||
@FXML
|
||||
public CheckBox checkBoxIsPrivate;
|
||||
public JFXToggleButton toggleBtnIsPrivate;
|
||||
@FXML
|
||||
public Label labelError;
|
||||
@FXML
|
||||
public JFXTimePicker timeStart;
|
||||
@FXML
|
||||
public JFXTimePicker timeEnd;
|
||||
|
||||
|
||||
public CreateEventController() {
|
||||
@ -35,6 +43,13 @@ public class CreateEventController {
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
|
||||
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
|
||||
timeStart.set24HourView(true);
|
||||
timeStart.setConverter(defaultConverter);
|
||||
|
||||
timeEnd.set24HourView(true);
|
||||
timeEnd.setConverter(defaultConverter);
|
||||
}
|
||||
|
||||
|
||||
@ -48,10 +63,10 @@ public class CreateEventController {
|
||||
Event event = new Event(
|
||||
textName.getText(),
|
||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||
checkBoxIsFullDay.isSelected(),
|
||||
checkBoxIsPrivate.isSelected(),
|
||||
textStart.getText(),
|
||||
textEnd.getText(),
|
||||
toggleBtnIsFullDay.isSelected(),
|
||||
toggleBtnIsPrivate.isSelected(),
|
||||
timeStart.getValue().toString(),
|
||||
timeEnd.getValue().toString(),
|
||||
datePickerDate.getValue().atStartOfDay(),
|
||||
(int) DataController.USER_ID
|
||||
);
|
||||
|
@ -1,13 +1,11 @@
|
||||
package main;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import customUI.Button;
|
||||
import customUI.Label;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
@ -30,7 +28,7 @@ public class MainController {
|
||||
private GridPane calendarGrid;
|
||||
|
||||
@FXML
|
||||
private Label LabelMonth;
|
||||
private javafx.scene.control.Label LabelMonth;
|
||||
|
||||
private final String[] dayNames = {"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"};
|
||||
private final Label[] dayLabel = new Label[7];
|
||||
@ -110,7 +108,7 @@ public class MainController {
|
||||
private void createWeek() {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
Label label = new Label();
|
||||
label.setText(dayNames[i]);
|
||||
label.setTextValue(dayNames[i]);
|
||||
label.setMaxHeight(Double.MAX_VALUE);
|
||||
label.setMaxWidth(Double.MAX_VALUE);
|
||||
label.getStyleClass().add("labelDays");
|
||||
@ -142,14 +140,31 @@ public class MainController {
|
||||
HBox btnHBox = new HBox();
|
||||
btnHBox.setAlignment(Pos.BOTTOM_RIGHT);
|
||||
Button deleteBtn = new Button();
|
||||
deleteBtn.setText(" X ");
|
||||
deleteBtn.setTextValue(" X ");
|
||||
deleteBtn.setOnAction(e -> {
|
||||
DataController dataController = new DataController();
|
||||
dataController.deleteEvent(event.getId());
|
||||
updateEvents();
|
||||
});
|
||||
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(deleteBtn);
|
||||
vBox.getChildren().add(btnHBox);
|
||||
@ -167,12 +182,6 @@ public class MainController {
|
||||
Label typeLabel = new Label("Wer: " + event.getOwnerName());
|
||||
vBox.getChildren().add(typeLabel);
|
||||
|
||||
/*
|
||||
Ä, ä \u00c4, \u00e4
|
||||
Ö, ö \u00d6, \u00f6
|
||||
Ü, ü \u00dc, \u00fc
|
||||
ß \u00df
|
||||
*/
|
||||
Label prioLabel = new Label("Priorit\u00e4t: " + event.getPriority());
|
||||
vBox.getChildren().add(prioLabel);
|
||||
|
||||
@ -211,7 +220,7 @@ public class MainController {
|
||||
weekStartDateTime = now.plusDays(weekOffset * 7L - dayOfWeek + 1);
|
||||
|
||||
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));
|
||||
|
@ -1,18 +1,18 @@
|
||||
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.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
import res.DataController;
|
||||
|
||||
public class LoginController {
|
||||
@FXML
|
||||
public TextField userField;
|
||||
public JFXTextField userField;
|
||||
@FXML
|
||||
public TextField passField;
|
||||
public JFXPasswordField passField;
|
||||
@FXML
|
||||
public Label userErrLabel;
|
||||
@FXML
|
||||
|
@ -28,10 +28,16 @@ Label{
|
||||
|
||||
.inputField{
|
||||
-fx-padding: 10px;
|
||||
-fx-background-color: white;
|
||||
}
|
||||
|
||||
.mainButton{
|
||||
-fx-font-weight: bold;
|
||||
-fx-background-color: white;
|
||||
}
|
||||
|
||||
JFXButton{
|
||||
-fx-background-color: white;
|
||||
}
|
||||
|
||||
#labelError{
|
||||
@ -43,4 +49,16 @@ Label{
|
||||
-fx-max-height: 400px;
|
||||
-fx-wrap-text: true;
|
||||
-fx-font-size: 16px;
|
||||
}
|
||||
|
||||
.inputDate{
|
||||
-fx-background-color: white;
|
||||
}
|
||||
|
||||
.comboBox{
|
||||
-fx-background-color: white;
|
||||
}
|
||||
|
||||
.timePicker{
|
||||
-fx-background-color: white;
|
||||
}
|
@ -5,7 +5,9 @@
|
||||
|
||||
<?import javafx.collections.FXCollections?>
|
||||
<?import java.lang.String?>
|
||||
<GridPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
||||
<?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>
|
||||
@ -23,26 +25,25 @@
|
||||
<RowConstraints vgrow="ALWAYS"/>
|
||||
<RowConstraints vgrow="ALWAYS"/>
|
||||
<RowConstraints vgrow="ALWAYS"/>
|
||||
<RowConstraints vgrow="ALWAYS"/>
|
||||
</rowConstraints>
|
||||
|
||||
<Label styleClass="mainLabel">Termin anlegen</Label>
|
||||
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="1">Datum:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="2">Titel:</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">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"/>
|
||||
<TextField fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="400" minWidth="400"/>
|
||||
<TextField fx:id="textStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="400" minWidth="400"/>
|
||||
<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"/>
|
||||
<ComboBox fx:id="ComboBoxPriotity" GridPane.columnIndex="1" GridPane.rowIndex="6" maxWidth="200" minWidth="200">
|
||||
<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"/>
|
||||
@ -50,14 +51,14 @@
|
||||
<String fx:value="hoch"/>
|
||||
</FXCollections>
|
||||
</items>
|
||||
</ComboBox>
|
||||
<CheckBox fx:id="checkBoxIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||
<CheckBox fx:id="checkBoxIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="9"/>
|
||||
</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="10" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
||||
<Button onAction="#abortBtnClick" maxWidth="150" minWidth="150">Abbrechen</Button>
|
||||
<Button styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Anlegen</Button>
|
||||
<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">Anlegen</JFXButton>
|
||||
</HBox>
|
||||
|
||||
</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;
|
||||
}
|
||||
|
||||
.navBtn{
|
||||
-fx-background-color: white;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?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">
|
||||
@ -19,15 +20,15 @@
|
||||
<ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true">
|
||||
|
||||
</ImageView>
|
||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
ADD
|
||||
</Button>
|
||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
</JFXButton>
|
||||
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
ADD
|
||||
</Button>
|
||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
</JFXButton>
|
||||
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
ADD
|
||||
</Button>
|
||||
</JFXButton>
|
||||
</VBox>
|
||||
<GridPane prefHeight="200.0" prefWidth="222.0" GridPane.columnIndex="1" GridPane.rowIndex="0">
|
||||
<columnConstraints>
|
||||
@ -48,9 +49,9 @@
|
||||
<Insets left="5"/>
|
||||
</padding>
|
||||
</Label>
|
||||
<Button onAction="#onBackClick" GridPane.columnIndex="1" maxHeight="1.7976931348623157E308">zurück</Button>
|
||||
<Button onAction="#onTodayClick" GridPane.columnIndex="2" maxHeight="1.7976931348623157E308">heute</Button>
|
||||
<Button onAction="#onNextClick" GridPane.columnIndex="3" maxHeight="1.7976931348623157E308">weiter</Button>
|
||||
<JFXButton styleClass="navBtn" onAction="#onBackClick" GridPane.columnIndex="1" maxHeight="1.7976931348623157E308">zurück</JFXButton>
|
||||
<JFXButton styleClass="navBtn" onAction="#onTodayClick" GridPane.columnIndex="2" maxHeight="1.7976931348623157E308">heute</JFXButton>
|
||||
<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">
|
||||
|
@ -34,4 +34,20 @@ Label{
|
||||
-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;
|
||||
}
|
@ -2,6 +2,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="users.LoginController">
|
||||
|
||||
<columnConstraints>
|
||||
@ -19,14 +21,14 @@
|
||||
<Label GridPane.columnIndex="1">Anmelden</Label>
|
||||
|
||||
<Label GridPane.rowIndex="1">Username</Label>
|
||||
<TextField GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="userField"/>
|
||||
<JFXTextField styleClass="userField" GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="userField"/>
|
||||
<Label styleClass="errorLbl" GridPane.columnIndex="2" GridPane.rowIndex="1" fx:id="userErrLabel"/>
|
||||
|
||||
<Label GridPane.rowIndex="2">Paswort</Label>
|
||||
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="passField"/>
|
||||
<JFXPasswordField styleClass="passField" GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="passField"/>
|
||||
<Label styleClass="errorLbl" GridPane.columnIndex="2" GridPane.rowIndex="2" fx:id="passErrLabel"/>
|
||||
|
||||
<Button onAction="#abortBtnClick" GridPane.columnIndex="1" GridPane.rowIndex="3">Beenden</Button>
|
||||
<Button onAction="#login" GridPane.columnIndex="2" GridPane.rowIndex="3">Anmelden</Button>
|
||||
<JFXButton styleClass="quitBtn" onAction="#abortBtnClick" GridPane.columnIndex="1" GridPane.rowIndex="3">Beenden</JFXButton>
|
||||
<JFXButton styleClass="loginBtn" onAction="#login" GridPane.columnIndex="2" GridPane.rowIndex="3">Anmelden</JFXButton>
|
||||
|
||||
</GridPane>
|
||||
|
@ -16,11 +16,12 @@ public class DataController {
|
||||
|
||||
public static long USER_ID = -1;
|
||||
|
||||
private static final String ALL_EVENTS_ENDPOINT = "http://localhost:8080/vpr/all-events";
|
||||
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 DELETE_EVENT_ENDPOINT = "http://localhost:8080/vpr/del-event";
|
||||
private static final String LOGIN_ENDPOINT = "http://localhost:8080/vpr/login";
|
||||
private static final String ALL_EVENTS_ENDPOINT = "http://localhost:8080/event/all";
|
||||
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;
|
||||
|
||||
@ -33,7 +34,8 @@ public class DataController {
|
||||
USER_ID = Long.parseLong(httpRequest.sendPostRequest(
|
||||
LOGIN_ENDPOINT,
|
||||
"login=" + username
|
||||
+ "&password=" + password
|
||||
+ "&password=" + password,
|
||||
false
|
||||
));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -44,7 +46,7 @@ public class DataController {
|
||||
|
||||
public void createEvent(Event event) {
|
||||
try {
|
||||
System.out.println(httpRequest.sendPostRequest(ADD_EVENT_ENDPOINT, event.getAsUrlParam()));
|
||||
System.out.println(httpRequest.sendPostRequest(ADD_EVENT_ENDPOINT, event.getAsUrlParam(), true));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Es konnte keine Verbindung mit dem Server hergestellt werden.");
|
||||
}
|
||||
@ -52,7 +54,7 @@ public class DataController {
|
||||
|
||||
public void deleteEvent(int eventId) {
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -62,7 +64,7 @@ public class DataController {
|
||||
ArrayList<Event> eventList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
String jsonResponse = httpRequest.sendPostRequest(ALL_EVENTS_ENDPOINT, "userId=" + USER_ID);
|
||||
String jsonResponse = httpRequest.sendPostRequest(ALL_EVENTS_ENDPOINT, "userId=" + USER_ID, true);
|
||||
System.out.println(jsonResponse);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
@ -110,4 +112,4 @@ public class DataController {
|
||||
|
||||
return objectMapper.readValue(jsonString, Event[].class);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package res;
|
||||
|
||||
import com.sun.jdi.event.StepEvent;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@ -66,21 +67,40 @@ public class Event {
|
||||
String end,
|
||||
LocalDateTime date,
|
||||
int ownerId
|
||||
) throws IllegalArgumentException {
|
||||
if (name.length() < 3) {
|
||||
) throws IllegalArgumentException{
|
||||
if(name.length() < 3){
|
||||
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);
|
||||
if (!matcher.matches()) {
|
||||
throw new IllegalArgumentException("Der Name Darf nur aus Zahlen, Buchstaben und " +
|
||||
"folgenden Sonderzeichen bestehen: =!?+*/$%€.:,;_ <>()-");
|
||||
if(!matcher.matches()){
|
||||
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.");
|
||||
}
|
||||
LocalDateTime today = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||
if (Duration.between(today, date).isNegative()) {
|
||||
if(Duration.between(today, date).isNegative()){
|
||||
throw new IllegalArgumentException("Das Datum muss in der Zukunft liegen.");
|
||||
}
|
||||
|
||||
@ -107,7 +127,7 @@ public class Event {
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
this.name = convertToASCII(name);
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
@ -193,4 +213,9 @@ public class Event {
|
||||
"&isFullDay=" + isFullDay() +
|
||||
"&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;
|
||||
|
||||
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);
|
||||
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);
|
||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||
|
||||
@ -23,6 +36,12 @@ public class HttpRequest {
|
||||
con.setRequestProperty("charset", "utf-8");
|
||||
con.setRequestProperty("Content-Length", Integer.toString(postDataLength));
|
||||
con.setUseCaches(false);
|
||||
|
||||
if(sendAuth){
|
||||
con.setRequestProperty("Accept", "application/json");
|
||||
con.setRequestProperty("Authorization", "Bearer {token}");
|
||||
}
|
||||
|
||||
try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
|
||||
wr.write(postData);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user