TimPicker now uses 24h time format

This commit is contained in:
2022-01-14 10:44:37 +01:00
7 changed files with 105 additions and 21 deletions

View File

@@ -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));
}
}

View File

@@ -0,0 +1,21 @@
package customUI;
public class Converter {
/*
Ä, ä \u00c4, \u00e4
Ö, ö \u00d6, \u00f6
Ü, ü \u00dc, \u00fc
ß \u00df
*/
@SuppressWarnings("all")
public static String CONVERT_STR(String str){
return str
.replace("ä", "\u00e4")
.replace("Ä", "\u00c4")
.replace("ö", "\u00f6")
.replace("Ö", "\u00d6")
.replace("ü", "\u00fc")
.replace("Ü", "\u00dc")
.replace("ß", "\u00df");
}
}

View File

@@ -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));
}
}

View File

@@ -4,8 +4,8 @@ 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;
@@ -28,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];
@@ -108,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");
@@ -140,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");
editBtn.setOnAction(event1 -> {
try {
FXMLLoader fxmlLoader = new FXMLLoader(
@@ -182,12 +182,6 @@ public class MainController {
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);
@@ -226,7 +220,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));