Our Special Xmas Gift to the Vaadin Community: the
FieldBinder Add-on
!
An advanced FieldGroup implementation with support for automated generation of Master/Detail forms in a very few lines of code, easily extensible through Vaadin’s Event Listener mechanism.
What is wrong with Good Ol’ FieldGroup?
Vaadin’s FieldGroup and BeanFieldGroup are non-visual components that build and automatically bind Fields to a data source. The data source may be an Item or a Java Bean. However, FieldGroups have quite a few limitations:
- A FieldGroup only contains bound fields
- If a field is not bound to a datasource (using unbind()), then it is automatically removed from the FieldGroup. The FieldGroup is then unaware that the field exists. Trying togetField() returns null.
- A FieldGroup cannot buildAndBind() fields with unrecognized values, but it is extensible through a Factory; however, unrecognized values include Collection types, such as Lists, which are typical of forms of the Master/Detail-type
- There is no generic implementation of a standard Master/Detail editor (the JPAContainer MasterDetailEditorimplementation is ad-hoc)
- There is no way to bind a FieldGroup to a Container: a FieldGroup is bound to an Item. Thus, there is no simple way to scan through a collection of records and display their contents in a form
Meet the FieldBinder
The FieldBinder add-on is an advanced FieldGroup implementation.
Features:
- A FieldBinder binds to a Java Bean, like a BeanFieldGroup
- Managed Fields (built using build()) can be always bind()‘ed and unbind()'ed; the FieldBinder will always keep track of them
- A FieldBinder can build() and bind() a component that displays a bean property even when it is a List
- A FieldBinder can be bound to a Container. The DataNavigation interface provides commands to move an internal pointer to the next, previous, first and last Item in the Container (the Container must implementContainer.Ordered: most Container implementations do, since it is required by Table)
- The DataNavigation interface provides commands to scan through a dataset and retrieving the Item that it points to.
- The DataNavigation interface provides standard behavior for performing CRUD operations (and, experimentally, lookup operations), which can be extended through a regular, Vaadin-style listener mechanism
- FieldBinder comes with standard built-in CRUD for the ListContainer and the Lazy Mongo Container. The ListContainer should already cover most Java Bean use-cases, including JPA. Support for the Vaadin’s official JPAContainer is under development.
- The ButtonBar component (and its relatives, NavButtonBar, CrudButtonBar, FindButtonBar) may be bound to a DataNavigation and automatically generate buttons for user interactions (automatic shortcut key bindings will come soon!)
- ButtonBars are i18n compliant through the standard Java ResourceBundle mechanism
- The ListTable and BeanTable wrappers augment Vaadin’s regular Table with default behavior for basic CRUD.
You can find it on the
Vaadin Addon Directory
, please play with it and let us know what you think!
Feature and Pull Requests are welcome on our
GitHub
repositories: