FieldBinder Addon
FieldBinder Add-on
An advanced FieldGroup implementation with support for automated generation of Master/Detail forms.
The FieldBinder
add-on is an advanced FieldGroup implementation.
Features:
- A
FieldBinder<T>
binds to a Java Bean, like a BeanFieldGroup - Managed Fields (built using
build()
) can be alwaysbind()
'ed andunbind()
'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
: mostContainer
implementations do, since it is required byTable
) - The
DataNavigation
interface provides commands to scan through a dataset and retrieving theItem
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 aDataNavigation
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
andBeanTable
wrappers augment Vaadin's regular Table with default behavior for basic CRUD.
Sample code
public class ShortTutorial extends UI { // CONTAINER // initialize an empty container final FilterableListContainer<Person> container = new FilterableListContainer<Person>(Person.class); // FIELD BINDER // initialize the FieldBinder for the given container final FieldBinder<Person> binder = new FieldBinder<Person>(Person.class, container); // initialize the layout, building the fields at the same time final VerticalLayout mainLayout = new VerticalLayout( // auto-generates a button bar with the appropriate behavior // for the underlying FilterableListContainer new ButtonBar(binder.getNavigation().withDefaultBehavior()), new FormLayout( // automatically generate a Field from the property type binder.build("firstName"), binder.build("lastName"), binder.build("birthDate"), binder.build("age"), // optional: display the index of the currentItem in the container new NavigationLabel(binder.getNavigation()) ), // initialize the addressList field with a built-in button bar binder.buildListOf(Address.class, "addressList").withDefaultEditorBar() ); @Override protected void init(VaadinRequest request) { setContent(mainLayout); } }
class MyController implements ItemEdit.Listener, ItemCreate.Listener, BeforeCommit.Listener { @Override public void itemEdit(ItemEdit.Event event) { age.setReadOnly(true); } @Override public void itemCreate(ItemCreate.Event event) { age.setReadOnly(true); } ... @Override public void beforeCommit(BeforeCommit.Event event) { // e.g., using JodaTime: DateTime birthDateValue = new DateTime(birthDate.getValue()); int ageValue = Years.yearsBetween(birthDateValue, DateTime.now()).getYears(); age.setReadOnly(false); age.setConvertedValue(ageValue); age.setReadOnly(true); } }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Many bug fixes and cleanup in internal interfaces
- Released
- 2015-03-17
- Maturity
- BETA
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 7.3+
- Vaadin 7.0+ in 1.3
- Browser
- N/A
FieldBinder Addon - Vaadin Add-on Directory
FieldBinder Add-onDocumentation
Downloadable Demo
Online Demo
Issue Tracker
Discussion Forum
FieldBinder Addon version 1.0
First release
FieldBinder Addon version 1.1
* Experimental support to JPAContainer
* Ported to org.vaadin.viritin from org.vaadin.maddon (name change)
FieldBinder Addon version 1.2
* Zoom and DrillDown Fields
* Initial work towards Grid Support
* Refactored, simpler Behavior classes
* Many Bug Fixes
FieldBinder Addon version 1.2.2
Fix ListContainer test cases
FieldBinder Addon version 1.2.3
Make all events, listener, notifiers serializable
FieldBinder Addon version 1.3
* Reworked Table support.
FieldBinder is now integrated and manages Fields in Table inline editing
* Initial Grid support
* Lots of bug fixes
FieldBinder Addon version 1.4
Many bug fixes and cleanup in internal interfaces