Compare commits
1 Commits
7e3bd66571
...
0510-Valid
| Author | SHA1 | Date | |
|---|---|---|---|
| d081a88dcd |
@@ -3,10 +3,7 @@ package main;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.stage.Stage;
|
||||
import res.DataController;
|
||||
import res.Event;
|
||||
@@ -29,39 +26,51 @@ public class CreateEventController {
|
||||
public CheckBox checkBoxIsFullDay;
|
||||
@FXML
|
||||
public CheckBox checkBoxIsPrivate;
|
||||
|
||||
|
||||
public CreateEventController(){}
|
||||
|
||||
@FXML
|
||||
public void initialize(){}
|
||||
public Label labelError;
|
||||
|
||||
|
||||
@FXML
|
||||
protected void createBtnClick(ActionEvent actionEvent){
|
||||
|
||||
Event event = new Event(
|
||||
textName.getText(),
|
||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||
checkBoxIsFullDay.isSelected(),
|
||||
checkBoxIsPrivate.isSelected(),
|
||||
textStart.getText(),
|
||||
textEnd.getText(),
|
||||
datePickerDate.getValue().atStartOfDay(),
|
||||
1
|
||||
);
|
||||
|
||||
System.out.println(event.getAsUrlParam());
|
||||
|
||||
DataController dataController = new DataController();
|
||||
dataController.createEvent(event);
|
||||
|
||||
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
public CreateEventController() {
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void abortBtnClick(ActionEvent event){
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
protected void createBtnClick(ActionEvent actionEvent) {
|
||||
try {
|
||||
if(datePickerDate.getValue() == null){
|
||||
throw new IllegalArgumentException("Bitte w\u00e4hle ein Datum aus");
|
||||
}
|
||||
|
||||
Event event = new Event(
|
||||
textName.getText(),
|
||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||
checkBoxIsFullDay.isSelected(),
|
||||
checkBoxIsPrivate.isSelected(),
|
||||
textStart.getText(),
|
||||
textEnd.getText(),
|
||||
datePickerDate.getValue().atStartOfDay(),
|
||||
1
|
||||
);
|
||||
|
||||
System.out.println(event.getAsUrlParam());
|
||||
|
||||
DataController dataController = new DataController();
|
||||
dataController.createEvent(event);
|
||||
|
||||
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
} catch (RuntimeException e) {
|
||||
labelError.setText(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void abortBtnClick(ActionEvent event) {
|
||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class MainController {
|
||||
protected void onAddBtnClick() {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("create-event.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 650, 500);
|
||||
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 erstellen");
|
||||
|
||||
@@ -32,4 +32,15 @@ Label{
|
||||
|
||||
.mainButton{
|
||||
-fx-font-weight: bold;
|
||||
}
|
||||
|
||||
#labelError{
|
||||
-fx-font-weight: bold;
|
||||
-fx-max-width: 1000px;
|
||||
-fx-text-fill: #ff5555;
|
||||
-fx-padding: 16px;
|
||||
-fx-min-height: 140px;
|
||||
-fx-max-height: 400px;
|
||||
-fx-wrap-text: true;
|
||||
-fx-font-size: 16px;
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
|
||||
<Label styleClass="mainLabel">Termin anlegen</Label>
|
||||
@@ -51,8 +52,9 @@
|
||||
</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"/>
|
||||
|
||||
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
||||
<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>
|
||||
|
||||
@@ -1,68 +1,70 @@
|
||||
* {
|
||||
-fx-dark-background-color: #525E74;
|
||||
-fx-darkest-background-color: #2B2D42;
|
||||
|
||||
-fx-bright-background-color: #77859E;
|
||||
-fx-brighter-background-color: #52567E;
|
||||
-fx-brightest-background-color: #ffffff;
|
||||
|
||||
-fx-bright-border-color: #B0B0B0;
|
||||
-fx-brighter-text-color: #ffffff;
|
||||
-fx-base-background-color: #2B2D42;
|
||||
-fx-base1-background-color: #525E74;
|
||||
|
||||
-fx-main-border-color: #B0B0B0;
|
||||
-fx-main-text-color: #ffffff;
|
||||
}
|
||||
|
||||
.mainGrid{
|
||||
-fx-background-color: -fx-darkest-background-color;
|
||||
|
||||
GridPane{
|
||||
-fx-background-color: -fx-base-background-color;
|
||||
}
|
||||
|
||||
.mainVbox{
|
||||
-fx-background-color: -fx-dark-background-color;
|
||||
.main-panel{
|
||||
-fx-background-color: #282C34;
|
||||
}
|
||||
|
||||
.vbox-main{
|
||||
-fx-background-color: #333333;
|
||||
-fx-alignment: top-center;
|
||||
|
||||
}
|
||||
|
||||
.gridCalendar Line{
|
||||
-fx-stroke: -fx-bright-border-color;
|
||||
-fx-stroke: -fx-main-border-color;
|
||||
}
|
||||
|
||||
.gridCalender{
|
||||
-fx-background-color: -fx-darkest-background-color;
|
||||
-fx-background-color: -fx-base-background-color;
|
||||
-fx-min-height: 80px;
|
||||
-fx-max-height: 80px;
|
||||
}
|
||||
|
||||
.labelMonth{
|
||||
-fx-padding: 0 0 0 20;
|
||||
-fx-background-color: -fx-bright-background-color;
|
||||
-fx-background-color: #77859E;
|
||||
-fx-font-size: 35px;
|
||||
-fx-font-weight: bold;
|
||||
}
|
||||
|
||||
.scrollDays{
|
||||
-fx-background-color: -fx-darkest-background-color;
|
||||
-fx-border-color: -fx-bright-border-color;
|
||||
-fx-background-color: -fx-base-background-color;
|
||||
-fx-border-color: -fx-main-border-color;
|
||||
}
|
||||
|
||||
.vBoxDays{
|
||||
-fx-background-color: -fx-darkest-background-color;
|
||||
-fx-background-color: -fx-base-background-color;
|
||||
}
|
||||
|
||||
.labelDays{
|
||||
-fx-alignment: center;
|
||||
-fx-background-color: -fx-dark-background-color;
|
||||
-fx-background-color: -fx-base1-background-color;
|
||||
-fx-font-size: 25px;
|
||||
-fx-border-color: -fx-bright-border-color;
|
||||
-fx-border-color: -fx-main-border-color;
|
||||
}
|
||||
|
||||
Label{
|
||||
-fx-text-fill: -fx-brighter-text-color;
|
||||
-fx-text-fill: -fx-main-text-color;
|
||||
}
|
||||
|
||||
.event{
|
||||
-fx-background-color: -fx-dark-background-color;
|
||||
-fx-background-color: -fx-base1-background-color;
|
||||
}
|
||||
|
||||
.mainBtn{
|
||||
-fx-background-color: -fx-brightest-background-color;
|
||||
-fx-text-fill: -fx-brighter-text-color;
|
||||
.main-btn{
|
||||
-fx-background-color: #ffffff;
|
||||
-fx-text-fill: -fx-main-text-color;
|
||||
-fx-background-radius: 5em;
|
||||
-fx-min-width: 40px;
|
||||
-fx-min-height: 40px;
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<GridPane styleClass="mainGrid" 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 hgrow="NEVER" maxWidth="60.0" minWidth="60.0" />
|
||||
<ColumnConstraints hgrow="ALWAYS" />
|
||||
@@ -14,17 +13,17 @@
|
||||
<rowConstraints>
|
||||
<RowConstraints vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<VBox styleClass="mainVbox" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
||||
<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>
|
||||
<Button onAction="#onAddBtnClick" styleClass="mainBtn">
|
||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
ADD
|
||||
</Button>
|
||||
<Button onAction="#onAddBtnClick" styleClass="mainBtn">
|
||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
ADD
|
||||
</Button>
|
||||
<Button onAction="#onAddBtnClick" styleClass="mainBtn">
|
||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
||||
ADD
|
||||
</Button>
|
||||
</VBox>
|
||||
@@ -37,19 +36,16 @@
|
||||
<RowConstraints />
|
||||
<RowConstraints vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
<Label fx:id="LabelMonth" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
|
||||
styleClass="labelMonth" 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
|
||||
<padding>
|
||||
<Insets left="5" />
|
||||
</padding>
|
||||
</Label>
|
||||
|
||||
<GridPane fx:id="calendarGrid" gridLinesVisible="true" styleClass="gridCalendar"
|
||||
GridPane.columnIndex="0" GridPane.rowIndex="1">
|
||||
<GridPane fx:id="calendarGrid" gridLinesVisible="true" styleClass="gridCalendar" GridPane.columnIndex="0" GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="14.2857142857" minWidth="14.2857142857"
|
||||
percentWidth="14.2857142857" />
|
||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="14.2857142857" minWidth="14.2857142857" percentWidth="14.2857142857" />
|
||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
||||
<ColumnConstraints hgrow="ALWAYS" percentWidth="14.2857142857" />
|
||||
@@ -61,6 +57,7 @@
|
||||
<RowConstraints maxHeight="55.0" minHeight="25.0" vgrow="NEVER" />
|
||||
<RowConstraints percentHeight="-Infinity" vgrow="ALWAYS" />
|
||||
</rowConstraints>
|
||||
|
||||
</GridPane>
|
||||
</GridPane>
|
||||
</GridPane>
|
||||
|
||||
@@ -29,7 +29,7 @@ public class DataController {
|
||||
try {
|
||||
System.out.println(httpRequest.sendPostRequest(ADD_EVENT_ENDPOINT, event.getAsUrlParam()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Es konnte keine Verbindung mit dem Server hergestellt werden.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,14 @@ package res;
|
||||
|
||||
import com.sun.jdi.event.StepEvent;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
public class Event {
|
||||
|
||||
@@ -61,7 +66,23 @@ public class Event {
|
||||
String end,
|
||||
LocalDateTime date,
|
||||
int ownerId
|
||||
) {
|
||||
) 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 =!?+*/$%€.:,;_<>()-]*");
|
||||
Matcher matcher = pattern.matcher(name);
|
||||
if(!matcher.matches()){
|
||||
throw new IllegalArgumentException("Der Name Darf nur aus Zahlen, Buchstaben und folgenden Sonderzeichen bestehen: =!?+*/$%€.:,;_ <>()-");
|
||||
}
|
||||
if(priority < 0){
|
||||
throw new IllegalArgumentException("Bitte eine Priorit\u00e4t w\u00e4hlen.");
|
||||
}
|
||||
LocalDateTime today = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||
if(Duration.between(today, date).isNegative()){
|
||||
throw new IllegalArgumentException("Das Datum muss in der Zukunft liegen.");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.priority = priority;
|
||||
this.isFullDay = isFullDay;
|
||||
|
||||
Reference in New Issue
Block a user