Compare commits
2 Commits
7c8b1fefb7
...
1210-UI-Te
| Author | SHA1 | Date | |
|---|---|---|---|
| 12fce27d04 | |||
| d34d09aa2b |
@@ -12,17 +12,13 @@ import java.util.Objects;
|
||||
public class MainApplication extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
//wieder ändern zu main-view.fxml
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("../users/create-user.fxml"));
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
|
||||
|
||||
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
|
||||
scene.getStylesheets().add(Objects.requireNonNull(
|
||||
//wieder ändern zu main-view.css
|
||||
MainApplication.class.getResource("../users/create-user.css")).toExternalForm());
|
||||
MainApplication.class.getResource("main-view.css")).toExternalForm());
|
||||
stage.setTitle("SharePlaner");
|
||||
stage.setScene(scene);
|
||||
//wieder löschen
|
||||
stage.show();
|
||||
|
||||
FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml"));
|
||||
Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500);
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package users;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class CreateUserController {
|
||||
|
||||
public TextField textName;
|
||||
public TextField textPassword;
|
||||
public TextField textPasswordSecond;
|
||||
public CheckBox checkBoxIsAdmin;
|
||||
public Label labelErrorName;
|
||||
public Label labelErrorPw;
|
||||
|
||||
protected void createUser(ActionEvent event) {
|
||||
if (textName.getText().trim().isEmpty()) {
|
||||
labelErrorName.setText("Bitte Usernamen eingeben!");
|
||||
labelErrorPw.setText("");
|
||||
return;
|
||||
}
|
||||
if (textPassword.getText().trim().isEmpty()) {
|
||||
labelErrorName.setText("");
|
||||
labelErrorPw.setText("Bitte Passwort eingeben!");
|
||||
return;
|
||||
}
|
||||
if (Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||
labelErrorName.setText("");
|
||||
labelErrorPw.setText("Passwörter stimmen nicht überein!");
|
||||
return;
|
||||
}
|
||||
|
||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<GridPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="users.CreateUserController">
|
||||
<columnConstraints>
|
||||
<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>
|
||||
|
||||
<Label styleClass="mainLabel" GridPane.columnIndex="2" GridPane.columnSpan="2" >User anlegen</Label>
|
||||
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="1" GridPane.columnIndex="1">Name:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="3" GridPane.columnIndex="1">Passwort:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="4" GridPane.columnIndex="1">Passwort wiederholen:</Label>
|
||||
<Label styleClass="inputLabel" GridPane.rowIndex="6" GridPane.columnIndex="1">Admin:</Label>
|
||||
|
||||
<TextField fx:id="textName" GridPane.columnIndex="2" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
||||
<TextField fx:id="textPassword" GridPane.columnIndex="2" GridPane.rowIndex="3" maxWidth="400" minWidth="400"/>
|
||||
<TextField fx:id="textPasswordSecond" GridPane.columnIndex="2" GridPane.rowIndex="4" maxWidth="400" minWidth="400"/>
|
||||
|
||||
<CheckBox fx:id="checkBoxIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||
|
||||
<Label fx:id="labelErrorName" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
|
||||
<Label fx:id="labelErrorPw" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
|
||||
</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;
|
||||
|
||||
@@ -110,4 +111,4 @@ public class DataController {
|
||||
|
||||
return objectMapper.readValue(jsonString, Event[].class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,21 +66,20 @@ 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 =!?+*/$%€.:,;_<>()-]*");
|
||||
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()){
|
||||
throw new IllegalArgumentException("Der Name darf nur aus Zahlen, Buchstaben und folgenden Sonderzeichen bestehen: =!?+*/$%€.:,;_ <>()-");
|
||||
}
|
||||
if (priority < 0) {
|
||||
if(priority < 0){
|
||||
throw new IllegalArgumentException("Bitte eine Priorit\u00e4t w\u00e4hlen.");
|
||||
}
|
||||
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.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user