Vaadin 7 ->8


Can you please show me how to change this Vaadin7 to 8:

BeanItem item = new BeanItem(new Store());
FieldGroup fieldGroup = new FieldGroup(item);
Field<?> storeId = fieldGroup.buildAndBind("ID", "idVs"); Field<?> name = fieldGroup.buildAndBind(“Namn”, “name”);


Vaadin 8 doesn’t have a direct replacement for FieldGroupFactory so the method buildAndBind can’t be written as such.
This is pretty close if you want oneliners for binding and building.

        Binder<Store> binder = new Binder<>(Store.class);
        HasValue<?> storeId = binder.forField(new TextField("ID")).bind("idVs").getField();
        HasValue<?> name = binder.forField(new TextField("Name")).bind("name").getField();
        binder.setBean(new Store());