Search in sources :

Example 26 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project docs by vaadin.

the class CrudColumns method createEditor.

private CrudEditor<Person> createEditor() {
    TextField firstName = new TextField("First name");
    EmailField email = new EmailField("Email");
    TextField profession = new TextField("Profession");
    DatePicker birthday = new DatePicker("Birthday");
    FormLayout form = new FormLayout(firstName, email, profession, birthday);
    Binder<Person> binder = new Binder<>(Person.class);
    binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
    binder.forField(email).asRequired().bind(Person::getEmail, Person::setEmail);
    binder.forField(profession).asRequired().bind(Person::getProfession, Person::setProfession);
    binder.forField(birthday).asRequired().withConverter(new LocalDateToDateConverter()).bind(Person::getBirthday, Person::setBirthday);
    return new BinderCrudEditor<>(binder, form);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) DatePicker(com.vaadin.flow.component.datepicker.DatePicker) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.vaadin.demo.domain.Person) LocalDateToDateConverter(com.vaadin.flow.data.converter.LocalDateToDateConverter)

Example 27 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project docs by vaadin.

the class CrudEditorBottom method createEditor.

private CrudEditor<Person> createEditor() {
    TextField firstName = new TextField("First name");
    TextField lastName = new TextField("Last name");
    EmailField email = new EmailField("Email");
    TextField profession = new TextField("Profession");
    FormLayout form = new FormLayout(firstName, lastName, email, profession);
    Binder<Person> binder = new Binder<>(Person.class);
    binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
    binder.forField(lastName).asRequired().bind(Person::getLastName, Person::setLastName);
    binder.forField(email).asRequired().bind(Person::getEmail, Person::setEmail);
    binder.forField(profession).asRequired().bind(Person::getProfession, Person::setProfession);
    return new BinderCrudEditor<>(binder, form);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.vaadin.demo.domain.Person)

Example 28 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project docs by vaadin.

the class CrudGridReplacement method createEditor.

private CrudEditor<Person> createEditor() {
    TextField firstName = new TextField("First name");
    TextField lastName = new TextField("Last name");
    EmailField email = new EmailField("Email");
    TextField profession = new TextField("Profession");
    FormLayout form = new FormLayout(firstName, lastName, email, profession);
    Binder<Person> binder = new Binder<>(Person.class);
    binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
    binder.forField(lastName).asRequired().bind(Person::getLastName, Person::setLastName);
    binder.forField(email).asRequired().bind(Person::getEmail, Person::setEmail);
    binder.forField(profession).asRequired().bind(Person::getProfession, Person::setProfession);
    return new BinderCrudEditor<>(binder, form);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.vaadin.demo.domain.Person)

Example 29 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project docs by vaadin.

the class CrudHiddenToolbar method createEditor.

private CrudEditor<Person> createEditor() {
    TextField firstName = new TextField("First name");
    TextField lastName = new TextField("Last name");
    FormLayout form = new FormLayout(firstName, lastName);
    Binder<Person> binder = new Binder<>(Person.class);
    binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
    binder.forField(lastName).asRequired().bind(Person::getLastName, Person::setLastName);
    return new BinderCrudEditor<>(binder, form);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) TextField(com.vaadin.flow.component.textfield.TextField) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.vaadin.demo.domain.Person)

Example 30 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project docs by vaadin.

the class CrudItemInitialization method createEditor.

private CrudEditor<Person> createEditor() {
    TextField firstName = new TextField("First name");
    TextField lastName = new TextField("Last name");
    EmailField email = new EmailField("Email");
    TextField profession = new TextField("Profession");
    FormLayout form = new FormLayout(firstName, lastName, email, profession);
    Binder<Person> binder = new Binder<>(Person.class);
    binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
    binder.forField(lastName).asRequired().bind(Person::getLastName, Person::setLastName);
    binder.forField(email).asRequired().bind(Person::getEmail, Person::setEmail);
    binder.forField(profession).asRequired().bind(Person::getProfession, Person::setProfession);
    return new BinderCrudEditor<>(binder, form);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.vaadin.demo.domain.Person)

Aggregations

FormLayout (com.vaadin.flow.component.formlayout.FormLayout)47 TextField (com.vaadin.flow.component.textfield.TextField)28 Binder (com.vaadin.flow.data.binder.Binder)21 BinderCrudEditor (com.vaadin.flow.component.crud.BinderCrudEditor)15 Person (com.vaadin.demo.domain.Person)12 EmailField (com.vaadin.flow.component.textfield.EmailField)10 Div (com.vaadin.flow.component.html.Div)8 ResponsiveStep (com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep)6 FormItem (com.vaadin.flow.component.formlayout.FormLayout.FormItem)4 Label (com.vaadin.flow.component.html.Label)4 NumberField (com.vaadin.flow.component.textfield.NumberField)4 TextArea (com.vaadin.flow.component.textfield.TextArea)4 StringLengthValidator (com.vaadin.flow.data.validator.StringLengthValidator)4 FurmsFormLayout (io.imunity.furms.ui.components.FurmsFormLayout)4 Test (org.junit.Test)4 ValueChangeEvent (com.vaadin.flow.component.HasValue.ValueChangeEvent)3 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)3 ComboBox (com.vaadin.flow.component.combobox.ComboBox)3 RichTextEditor (com.vaadin.flow.component.richtexteditor.RichTextEditor)3 EAGER (com.vaadin.flow.data.value.ValueChangeMode.EAGER)3