Package net.sf.jguiraffe.gui.builder.window.ctrl

This package contains classes and interfaces for the implementation of form controllers.

Dealing with a form is typically a tedious task. When the GUI is setup, a lot of tasks have to be performed for correctly handling user input: the input fields of the form have to be filled with their initial values, user input has to be validated, fields containing invalid data have to be marked somehow, committing the form is only allowed if all entered data is valid, and so on.

This package defines a form controller base class that addresses these problems. In collaboration with a bunch of helper classes, a form controller is able to manage the whole life cycle of a form:

  • When the form is opened, its fields are initialized using the values of the associated form bean. The form bean serves as the model of the form. It can be passed to the builder.
  • During editing of the form by the user, a FormValidationTrigger determines when a validation has to be performed. This could for instance be any time the user leaves an input field. Of course, if the user hits the OK button to close the form, a validation will always be initiated.
  • A FieldMarker is responsible for changing the display properties of an input field depending on its current validation status. A concrete implementation could for instance paint the background of input fields containing invalid data in a different color.
  • When the form is finally closed and all entered data is valid, the content of the form has to be written back into its model. Then typically an application-specific action has to be performed, e.g. to persist the changes in a database or something like that.

The main FormController class is the central point for implementing this functionality. In most cases, it should be possible to use this class out of the box. Application-specific logic can be injected by specifying configuration objects when the controller is created. Adaptations to the specific look and feel of a concrete application can be achieved by providing different implementations of the helper objects involved.

$Id: package.html 205 2012-01-29 18:29:57Z oheger $