diff --git a/client/app/src/main/java/customUI/Button.java b/client/app/src/main/java/customUI/Button.java new file mode 100644 index 0000000..3d4d4bf --- /dev/null +++ b/client/app/src/main/java/customUI/Button.java @@ -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)); + } +} diff --git a/client/app/src/main/java/customUI/Converter.java b/client/app/src/main/java/customUI/Converter.java new file mode 100644 index 0000000..3e0493f --- /dev/null +++ b/client/app/src/main/java/customUI/Converter.java @@ -0,0 +1,20 @@ +package customUI; + +public class Converter { + /* + Ä, ä \u00c4, \u00e4 + Ö, ö \u00d6, \u00f6 + Ü, ü \u00dc, \u00fc + ß \u00df + */ + public static String CONVERT_STR(String str){ + return str + .replace("ä", "\u00e4") + .replace("Ä", "\u00c4") + .replace("ö", "\u00f6") + .replace("Ö", "\u00d6") + .replace("ü", "\u00fc") + .replace("Ü", "\u00dc") + .replace("ß", "\u00df"); + } +} diff --git a/client/app/src/main/java/customUI/Label.java b/client/app/src/main/java/customUI/Label.java new file mode 100644 index 0000000..8ba0ce2 --- /dev/null +++ b/client/app/src/main/java/customUI/Label.java @@ -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)); + } +} diff --git a/client/app/src/main/java/main/MainController.java b/client/app/src/main/java/main/MainController.java index 728c051..f9b9a51 100644 --- a/client/app/src/main/java/main/MainController.java +++ b/client/app/src/main/java/main/MainController.java @@ -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,14 @@ 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"); btnHBox.getChildren().add(editBtn); btnHBox.getChildren().add(deleteBtn); vBox.getChildren().add(btnHBox); @@ -164,15 +162,9 @@ public class MainController { vBox.getChildren().add(timeLabel); } - Label typeLabel = new Label("Wer: " + event.getOwnerName().replace("ü", "\u00fc")); + 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 +203,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)); diff --git a/client/data/src/main/java/res/Event.java b/client/data/src/main/java/res/Event.java index a730659..90e9d41 100644 --- a/client/data/src/main/java/res/Event.java +++ b/client/data/src/main/java/res/Event.java @@ -71,7 +71,7 @@ public class Event { if(name.length() < 3){ throw new IllegalArgumentException("Der Name muss eine L\u00e4nge 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\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df0-9 =!?+*/$.:,;_<>()-]*"); Matcher matcher = pattern.matcher(name); if(!matcher.matches()){ System.out.println(name); @@ -94,7 +94,7 @@ public class Event { } System.out.println(); - 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: \u00e4\u00f6\u00fc \u00c4\u00d6\u00dc \u00df =!?+*/$.:,;_ <>()-"); } if(priority < 0){ throw new IllegalArgumentException("Bitte eine Priorit\u00e4t w\u00e4hlen.");