Running Vaadin 24 with Gradle on Java 21

Gradle has not been officially released for Java 21, but it works sufficiently well with Gradle 8.4 or later for compilation and execution. Essentially, this means that Gradle cannot run on Java 21 LTS just yet. I will briefly demonstrate how I managed to upgrade to Java 21 LTS in my environment using IntelliJ. Install Java 21 (I’m using Adoptium Temurin) via sdkman. Pre-requisites: Install Java 21 only on your production system. Use somewhere in your code a command which is unique to the latest Java 21 (in this case.getLast() on a List. ...

October 12, 2023 · 2 min

Translating a Vaadin DatePicker

Translating (internationalization of) the default English DatePicker in Vaadin (Flow) is quite straightforward. I created a compact subroutine for effortless reuse in all of my date pickers. // Declaration private final DatePicker birthday = new DatePicker("Geburtstag"); // Set German DatePicker birthday.setI18n(Parsers.setGermanDatePicker()); The code above calls the “setGermanDatePicker” method, which is located in the “Parsers” class in my specific case. /** * Set German DatePicker * Fill the DatePickerI18n with German values (First day Monday, etc.) * * @return */ public static DatePickerI18n setGermanDatePicker() { DatePickerI18n dpI18n = new DatePicker.DatePickerI18n(); dpI18n.setDateFormat("dd.MM.yyyy"); dpI18n.setFirstDayOfWeek(1); dpI18n.setToday("Heute"); dpI18n.setCancel("Abbrechen"); dpI18n.setMonthNames(List.of("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember")); dpI18n.setWeekdays(List.of("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag")); dpI18n.setWeekdaysShort(List.of("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa")); return dpI18n; } It should be simple to adapt the above code for other languages or more complex situations, such as translating based on the locale passed to the function. However, I only require German for this Vaadin app. ...

September 8, 2023 · 1 min