2 Commits

Author SHA1 Message Date
3f7fa449d5 First unstyled draft login ui 2021-12-20 11:56:12 +01:00
da24f73f46 Added files and launching login.css ui 2021-12-13 12:58:38 +01:00
10 changed files with 83 additions and 78 deletions

View File

@@ -3,7 +3,10 @@ package main;
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.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.DatePicker;
import javafx.scene.control.TextField;
import javafx.stage.Stage; import javafx.stage.Stage;
import res.DataController; import res.DataController;
import res.Event; import res.Event;
@@ -26,51 +29,39 @@ public class CreateEventController {
public CheckBox checkBoxIsFullDay; public CheckBox checkBoxIsFullDay;
@FXML @FXML
public CheckBox checkBoxIsPrivate; public CheckBox checkBoxIsPrivate;
public CreateEventController(){}
@FXML @FXML
public Label labelError; public void initialize(){}
@FXML
protected void createBtnClick(ActionEvent actionEvent){
public CreateEventController() { 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();
} }
@FXML @FXML
public void initialize() { protected void abortBtnClick(ActionEvent event){
}
@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 stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
stage.close(); stage.close();
} }

View File

@@ -15,10 +15,18 @@ public class MainApplication extends Application {
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("Hello!"); stage.setTitle("SharePlaner");
stage.setScene(scene); stage.setScene(scene);
stage.show(); stage.show();
FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml"));
Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500);
sceneLogin.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("../users/login.css")).toExternalForm());
Stage stageLogin = new Stage();
stageLogin.setTitle("Anmelden");
stageLogin.setScene(sceneLogin);
stageLogin.show();
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -69,7 +69,7 @@ public class MainController {
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, 500);
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");

View File

@@ -0,0 +1,4 @@
package users;
public class LoginControler {
}

View File

@@ -32,15 +32,4 @@ Label{
.mainButton{ .mainButton{
-fx-font-weight: bold; -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;
} }

View File

@@ -22,7 +22,6 @@
<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>
@@ -52,9 +51,8 @@
</ComboBox> </ComboBox>
<CheckBox fx:id="checkBoxIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="7"/> <CheckBox fx:id="checkBoxIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
<CheckBox fx:id="checkBoxIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="8"/> <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="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> <Button onAction="#abortBtnClick" maxWidth="150" minWidth="150" >Abbrechen</Button>
<Button styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Anlegen</Button> <Button styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Anlegen</Button>
</HBox> </HBox>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="users.LoginControler">
<columnConstraints>
<ColumnConstraints/>
<ColumnConstraints/>
<ColumnConstraints/>
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="ALWAYS" />
<RowConstraints vgrow="ALWAYS" />
<RowConstraints vgrow="ALWAYS" />
<RowConstraints vgrow="ALWAYS" />
</rowConstraints>
<Label GridPane.columnIndex="1">Anmelden</Label>
<Label GridPane.rowIndex="1">Username</Label>
<TextField GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="userField"></TextField>
<Label GridPane.columnIndex="2" GridPane.rowIndex="1" fx:id="userErrLabel">Error</Label>
<Label GridPane.rowIndex="2">Paswort</Label>
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="passField"></PasswordField>
<Label GridPane.columnIndex="2" GridPane.rowIndex="2" fx:id="passErrLabel">Error</Label>
<Button GridPane.columnIndex="1" GridPane.rowIndex="3">Beenden</Button>
<Button GridPane.columnIndex="2" GridPane.rowIndex="3">Anmelden</Button>
</GridPane>

View File

@@ -29,7 +29,7 @@ public class DataController {
try { try {
System.out.println(httpRequest.sendPostRequest(ADD_EVENT_ENDPOINT, event.getAsUrlParam())); System.out.println(httpRequest.sendPostRequest(ADD_EVENT_ENDPOINT, event.getAsUrlParam()));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("Es konnte keine Verbindung mit dem Server hergestellt werden."); e.printStackTrace();
} }
} }

View File

@@ -2,14 +2,9 @@ package res;
import com.sun.jdi.event.StepEvent; import com.sun.jdi.event.StepEvent;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
public class Event { public class Event {
@@ -66,23 +61,7 @@ public class Event {
String end, String end,
LocalDateTime date, LocalDateTime date,
int ownerId 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.name = name;
this.priority = priority; this.priority = priority;
this.isFullDay = isFullDay; this.isFullDay = isFullDay;