JPA Bindings for Vaadin
Version 1.8 provides bindings for Vaadin Forms and Vaadin Grid.
The bindings can be customized for any datatype whether it is a custom model class or a java basic type.
favoriteProductName = addColumn(entity -> Optional.ofNullable(entity.getFavoriteProduct()).map(p -> p. getName()) .orElse(null)); favoriteProductName.setKey(COLUMN_FAVORITE_PRODUCT_NAME); favoriteProductName.setId("favoriteProductName"); premium = addComponentColumn(entity -> { Checkbox cb = new Checkbox(entity.isPremium()); cb.setEnabled(false); return cb; }); premium.setKey(COLUMN_PREMIUM); premium.setId("premium");
The custom code for the checkbox adds a component column in the grid initialization per default whenever a boolean field is displayed.
Binding to fields in an input form will also create a unique non-changing id that can be used for integration testing.
See also: Documentation