Search in sources :

Example 16 with Person

use of com.vaadin.demo.domain.Person in project docs by vaadin.

the class CrudToolbar 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)

Aggregations

Person (com.vaadin.demo.domain.Person)16 BinderCrudEditor (com.vaadin.flow.component.crud.BinderCrudEditor)12 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)12 TextField (com.vaadin.flow.component.textfield.TextField)12 Binder (com.vaadin.flow.data.binder.Binder)12 EmailField (com.vaadin.flow.component.textfield.EmailField)9 Button (com.vaadin.flow.component.button.Button)3 ComboBox (com.vaadin.flow.component.combobox.ComboBox)3 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)3 Grid (com.vaadin.flow.component.grid.Grid)2 DemoExporter (com.vaadin.demo.DemoExporter)1 DataService (com.vaadin.demo.domain.DataService)1 Html (com.vaadin.flow.component.Html)1 ButtonVariant (com.vaadin.flow.component.button.ButtonVariant)1 DatePicker (com.vaadin.flow.component.datepicker.DatePicker)1 Div (com.vaadin.flow.component.html.Div)1 Icon (com.vaadin.flow.component.icon.Icon)1 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)1 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)1 LocalDateToDateConverter (com.vaadin.flow.data.converter.LocalDateToDateConverter)1