Changed encoding to utf-8
This commit is contained in:
parent
4e07b01b6a
commit
780ecbee0f
@ -5,13 +5,17 @@ plugins {
|
||||
}
|
||||
|
||||
javafx {
|
||||
version = "11"
|
||||
version = "11.0.2"
|
||||
modules(
|
||||
"javafx.controls",
|
||||
"javafx.fxml"
|
||||
)
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
application {
|
||||
mainClassName = "main.MainApplication"
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
package customUI;
|
||||
|
||||
public class Button extends javafx.scene.control.Button {
|
||||
|
||||
public void setTextValue(String text){
|
||||
super.setText(Converter.convertString(text));
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package customUI;
|
||||
|
||||
public class Converter {
|
||||
/*
|
||||
Ä, ä \u00c4, \u00e4
|
||||
Ö, ö \u00d6, \u00f6
|
||||
Ü, ü \u00dc, \u00fc
|
||||
ß \u00df
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public static String convertString(String str){
|
||||
return str
|
||||
.replace("ä", "\u00e4")
|
||||
.replace("Ä", "\u00c4")
|
||||
.replace("ö", "\u00f6")
|
||||
.replace("Ö", "\u00d6")
|
||||
.replace("ü", "\u00fc")
|
||||
.replace("Ü", "\u00dc")
|
||||
.replace("ß", "\u00df");
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package customUI;
|
||||
|
||||
public class Label extends javafx.scene.control.Label {
|
||||
public Label(String content){
|
||||
super(Converter.convertString(content));
|
||||
}
|
||||
|
||||
public Label(){
|
||||
super();
|
||||
}
|
||||
|
||||
public void setTextValue(String text){
|
||||
super.setText(Converter.convertString(text));
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package customUI;
|
||||
|
||||
public class Tooltip extends javafx.scene.control.Tooltip {
|
||||
|
||||
public Tooltip(String tollTipText){
|
||||
super(Converter.convertString(tollTipText));
|
||||
}
|
||||
|
||||
}
|
@ -2,9 +2,7 @@ package helper;
|
||||
|
||||
import javafx.geometry.Bounds;
|
||||
import javafx.scene.Group;
|
||||
import customUI.Button;
|
||||
import javafx.scene.control.ContentDisplay;
|
||||
import customUI.Tooltip;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.shape.SVGPath;
|
||||
|
||||
public class SvgBtnCreator {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package main;
|
||||
|
||||
import customUI.Converter;
|
||||
import helper.HttpRequestException;
|
||||
import res.DataController;
|
||||
import res.Event;
|
||||
@ -16,7 +15,7 @@ public class EditEventController extends CreateEventController{
|
||||
public void setCurrentEvent(Event currentEvent) {
|
||||
this.currentEvent = currentEvent;
|
||||
|
||||
textName.setText(Converter.convertString(currentEvent.getName()));
|
||||
textName.setText(currentEvent.getName());
|
||||
datePickerDate.setValue(currentEvent.getDate().toLocalDate());
|
||||
ComboBoxPriotity.getSelectionModel().select(currentEvent.getPriority());
|
||||
|
||||
|
@ -2,8 +2,6 @@ package main;
|
||||
|
||||
import config.Config;
|
||||
import config.ConfigLoader;
|
||||
import customUI.Button;
|
||||
import customUI.Label;
|
||||
import helper.SvgBtnCreator;
|
||||
import helper.HttpRequestException;
|
||||
import javafx.fxml.FXML;
|
||||
@ -12,7 +10,7 @@ import javafx.geometry.Pos;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
@ -154,7 +152,7 @@ public class MainController {
|
||||
private void createWeek() {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
Label label = new Label();
|
||||
label.setTextValue(dayNames[i]);
|
||||
label.setText(dayNames[i]);
|
||||
label.setMaxHeight(Double.MAX_VALUE);
|
||||
label.setMaxWidth(Double.MAX_VALUE);
|
||||
label.getStyleClass().add("labelDays");
|
||||
@ -248,7 +246,7 @@ public class MainController {
|
||||
Label typeLabel = new Label("Wer: " + event.getOwnerName());
|
||||
vBox.getChildren().add(typeLabel);
|
||||
|
||||
Label prioLabel = new Label("Priorit\u00e4t: " + event.getPriority());
|
||||
Label prioLabel = new Label("Priorität: " + event.getPriority());
|
||||
vBox.getChildren().add(prioLabel);
|
||||
|
||||
if (event.isFullDay()) {
|
||||
@ -286,7 +284,7 @@ public class MainController {
|
||||
weekStartDateTime = now.plusDays(weekOffset * 7L - dayOfWeek + 1);
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
dayLabel[i].setTextValue(dayFormatter.format(weekStartDateTime.plusDays(i)));
|
||||
dayLabel[i].setText(dayFormatter.format(weekStartDateTime.plusDays(i)));
|
||||
}
|
||||
|
||||
LabelMonth.setText(dateFormatter.format(weekStartDateTime));
|
||||
|
@ -9,6 +9,8 @@ import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.stage.Modality;
|
||||
@ -20,6 +22,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public class OptionController {
|
||||
|
||||
@ -36,10 +39,13 @@ public class OptionController {
|
||||
@FXML
|
||||
public GridPane mainGrid;
|
||||
|
||||
private JFXComboBox<String> comboBox;
|
||||
private DataController dataController;
|
||||
private List<User> users;
|
||||
|
||||
@FXML
|
||||
public void initialize(){
|
||||
DataController dataController = new DataController();
|
||||
List<User> users;
|
||||
dataController = new DataController();
|
||||
try{
|
||||
users = dataController.getAllUser();
|
||||
} catch (HttpRequestException e){
|
||||
@ -50,7 +56,7 @@ public class OptionController {
|
||||
for (User user: users) {
|
||||
observableUserList.add(user.getLogin());
|
||||
}
|
||||
JFXComboBox<String> comboBox = new JFXComboBox<>(observableUserList);
|
||||
comboBox = new JFXComboBox<>(observableUserList);
|
||||
comboBox.getStyleClass().add("comboBox");
|
||||
mainGrid.add(comboBox, 2,2);
|
||||
|
||||
@ -62,14 +68,36 @@ public class OptionController {
|
||||
}
|
||||
|
||||
public void onCreateBtnClick(ActionEvent actionEvent) {
|
||||
try{
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||
MainApplication.class.getResource("../users/create-user.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 800, 650);
|
||||
loadUserScene(actionEvent, "User erstellen", "../users/create-user.fxml");
|
||||
}
|
||||
|
||||
public void onUpdateBtnClick(ActionEvent actionEvent) {
|
||||
loadUserScene(actionEvent, "User bearbeiten", "../users/edit-user.fxml");
|
||||
}
|
||||
|
||||
public void onDeleteBtnClick(ActionEvent actionEvent) {
|
||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Wirklich löschen?");
|
||||
Optional<ButtonType> result = alert.showAndWait();
|
||||
if(result.isPresent() && result.get() == ButtonType.OK){
|
||||
try {
|
||||
dataController.deleteUser(users.get(comboBox.getSelectionModel().getSelectedIndex()));
|
||||
} catch (HttpRequestException e) {
|
||||
Alert alert1 = new Alert(Alert.AlertType.ERROR, e.getMessage());
|
||||
alert1.showAndWait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Scene loadUserScene(ActionEvent actionEvent, String title, String fxml) {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||
MainApplication.class.getResource(fxml));
|
||||
Scene scene = null;
|
||||
try {
|
||||
scene = new Scene(fxmlLoader.load(), 800, 650);
|
||||
scene.getStylesheets().add(Objects.requireNonNull(
|
||||
MainApplication.class.getResource("../users/create-user.css")).toExternalForm());
|
||||
Stage stage = new Stage();
|
||||
stage.setTitle("User erstellen");
|
||||
stage.setTitle(title);
|
||||
stage.setScene(scene);
|
||||
stage.initModality(Modality.APPLICATION_MODAL);
|
||||
stage.setResizable(false);
|
||||
@ -79,11 +107,6 @@ public class OptionController {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void onUpdateBtnClick(ActionEvent actionEvent) {
|
||||
}
|
||||
|
||||
public void onDeleteBtnClick(ActionEvent actionEvent) {
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
|
19
client/app/src/main/java/users/EditUserController.java
Normal file
19
client/app/src/main/java/users/EditUserController.java
Normal file
@ -0,0 +1,19 @@
|
||||
package users;
|
||||
|
||||
import res.User;
|
||||
|
||||
public class EditUserController extends CreateUserController{
|
||||
private User currentUser;
|
||||
|
||||
public User getCurrentUser() {
|
||||
return currentUser;
|
||||
}
|
||||
|
||||
public void setCurrentUser(User currentUser) {
|
||||
this.currentUser = currentUser;
|
||||
|
||||
textForename.setText(currentUser.getForename());
|
||||
textName.setText(currentUser.getName());
|
||||
textLogin.setText(currentUser.getLogin());
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||
<GridPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="users.CreateUserController">
|
||||
@ -40,7 +41,7 @@
|
||||
<PasswordField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||
<PasswordField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
||||
|
||||
<ToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||
<JFXToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||
|
||||
<Label fx:id="labelError" styleClass="errorMessage" GridPane.columnIndex="2" GridPane.rowIndex="7"/>
|
||||
|
||||
@ -49,7 +50,7 @@
|
||||
<Insets right="100" left="100"/>
|
||||
</HBox.margin>
|
||||
<Button onAction="#abortBtnClick">Abbrechen</Button>
|
||||
<Button onAction="#createUser" styleClass="btnLogin" >Anmelden</Button>
|
||||
<Button onAction="#createUser" styleClass="btnLogin" >Anlegen</Button>
|
||||
|
||||
</HBox>
|
||||
</GridPane>
|
||||
|
57
client/app/src/main/resources/users/edit-user.fxml
Normal file
57
client/app/src/main/resources/users/edit-user.fxml
Normal file
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||
<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" />
|
||||
<PasswordField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||
<PasswordField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
||||
|
||||
<JFXToggleButton 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" >Bearbeiten</Button>
|
||||
|
||||
</HBox>
|
||||
</GridPane>
|
||||
|
@ -2,6 +2,10 @@ plugins {
|
||||
java
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val jacksonVersion = "2.13.0"
|
||||
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
|
||||
|
@ -1,19 +1,11 @@
|
||||
package res;
|
||||
|
||||
import com.sun.jdi.event.StepEvent;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.SQLOutput;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
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 {
|
||||
|
||||
@ -44,15 +36,15 @@ public class Event {
|
||||
|
||||
System.out.println("Create Event");
|
||||
if (name.length() < 3) {
|
||||
throw new IllegalArgumentException("Der Name muss eine L\u00e4nge von 3 haben.");
|
||||
throw new IllegalArgumentException("Der Name muss eine Länge von 3 haben.");
|
||||
}
|
||||
Pattern pattern = Pattern.compile("[A-Za-z\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df0-9 =!?+*/$.:,;_<>()-]*");
|
||||
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: \u00e4\u00f6\u00fc \u00c4\u00d6\u00dc \u00df =!?+*/$.:,;_ <>()-");
|
||||
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.");
|
||||
throw new IllegalArgumentException("Bitte eine Priorität wählen.");
|
||||
}
|
||||
LocalDateTime today = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||
if (Duration.between(today, date).isNegative()) {
|
||||
@ -82,9 +74,7 @@ public class Event {
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
System.out.println(name);
|
||||
this.name = name;
|
||||
System.out.println(this.name);
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
|
Loading…
Reference in New Issue
Block a user