[FEATURE] Custom Theme (Part II)
This commit is contained in:
@@ -28,6 +28,10 @@ import com.vaadin.flow.data.validator.IntegerRangeValidator;
|
||||
import com.vaadin.flow.router.PageTitle;
|
||||
import com.vaadin.flow.router.Route;
|
||||
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* Example view demonstrating a broad set of Vaadin form controls bound
|
||||
@@ -42,16 +46,36 @@ public class FormView extends VerticalLayout {
|
||||
public FormView() {
|
||||
addClassName("dialect-content");
|
||||
add(card("Registrierung", buildForm()));
|
||||
//<theme-editor-local-classname>
|
||||
addClassName("form-view-vertical-layout-1");
|
||||
}
|
||||
|
||||
private Component buildForm() {
|
||||
TextField vorname = new TextField("Vorname");
|
||||
vorname.setAutofocus(true);
|
||||
TextField nachname = new TextField("Nachname");
|
||||
EmailField email = new EmailField("E-Mail");
|
||||
PasswordField passwort = new PasswordField("Passwort");
|
||||
//<theme-editor-local-classname>
|
||||
passwort.addClassName("form-view-password-field-1");
|
||||
IntegerField alter = new IntegerField("Alter");
|
||||
alter.setReadOnly(true);
|
||||
BigDecimalField gehalt = new BigDecimalField("Gehalt (€)");
|
||||
DatePicker geburtsdatum = new DatePicker("Geburtsdatum");
|
||||
geburtsdatum.setLocale(Locale.GERMANY);
|
||||
|
||||
DateFormatSymbols symbols = new DateFormatSymbols(Locale.GERMANY);
|
||||
List<String> monate = List.of(symbols.getMonths()).subList(0, 12);
|
||||
List<String> wochentage = List.of(symbols.getWeekdays()).subList(1, 8);
|
||||
List<String> wochentageKurz = List.of(symbols.getShortWeekdays()).subList(1, 8);
|
||||
|
||||
geburtsdatum.setI18n(new DatePicker.DatePickerI18n()
|
||||
.setMonthNames(monate)
|
||||
.setWeekdays(wochentage)
|
||||
.setWeekdaysShort(wochentageKurz)
|
||||
.setFirstDayOfWeek(1)
|
||||
.setToday("Heute")
|
||||
.setCancel("Abbrechen"));
|
||||
TimePicker uhrzeit = new TimePicker("Bevorzugte Uhrzeit");
|
||||
|
||||
ComboBox<String> land = new ComboBox<>("Land");
|
||||
@@ -109,6 +133,7 @@ public class FormView extends VerticalLayout {
|
||||
.bind(Registration::getBemerkung, Registration::setBemerkung);
|
||||
|
||||
Registration registration = new Registration();
|
||||
registration.setAlter(37);
|
||||
binder.readBean(registration);
|
||||
|
||||
FormLayout formLayout = new FormLayout();
|
||||
|
||||
Reference in New Issue
Block a user