No more excuses to do data binding manually - build your form layouts as you wish!

This add-on contains a helper class and a custom form implementation to ease using pre created fields pattern. Customizing form layout and setting fields settings has never been easier. Forms can e.g. be designed with Vaadin Visual Editor and they can still take all advantages of the Form component.

As a pair for this add-on you can use ViewGenerator helper (a separate download) to automatically create view stubs for your domain objects. If you have lots of fields in you beans it saves you from coding quite a bit of builder plate code.

WHAT IS "PRE CREATED FIELDS PATTERN"

Normally when using Vaadin forms, fields are created for item's properties on demand. The task of creating fields for properties is delegated to a FormFieldFactory. These fields are then added to the Form's layout and form binds properties automatically to them. This approach is usually fine and thanks to customizable FormFieldFactory and layout, form can be customized quite a lot.

In practice things may get rather messy and complex if the the layout becomes multilevel or it is e.g. designed with Vaadin Visual Editor. Lots of custom logic is needed to overridden attachField/detachField methods etc.

In pre created fields pattern responsibilities of field factory is narrowed. Instead of creating new fields for requested properties, its job is only to connect properties to existing fields (created manually by developer) in the form (or its layout).

With pre created fields pattern the Form also needs some minor changes: it must be modified to avoid attaching and detaching fields automatically as the developer has already attached them to their appropriate location in the layout. Form changes are practically replacing attachField and detachField implementations with empty methods.

WHAT DOES ViewBoundForm/PreCreatedFieldsHelper DO

Pre created fields pattern is rather simple to implement manually. The field factory however normally needs a considerable amount of boilerplate code to work. PreCreatedFieldsHelper can be used to avoid this boilerplate code by using simple naming convention and some java reflect magic.

Practically PreCreatedFieldsHelper is a FormFieldFactory that connects properties to corresponding fields from "target" classes (most often subclasses of form/layouts or composites built with Vaadin Visualdesigner). The connecting is done based on Fields name (java fieldname). The helper class can be used as is or behind the scenes by using ViewBoundForm.

Contributors (in addition to original author): Eduardo Frazão (annotation based field mapping), Sami Ekblad (new name for the add-on)

Install

Link to this version
CertifiedReleased 10 April 2012Apache License 2.0
Framework Support
Vaadin 6.0+
Browser Independent
Install with
Release notes - Version 2.1.2

Packaging method now includes sources jar which makes it automatically available for maven users. No functional changes.