org.springframework.binding.form
Interface ConfigurableFormModel

All Superinterfaces:
FormModel, PropertyChangePublisher
All Known Subinterfaces:
ValidatingFormModel
All Known Implementing Classes:
AbstractFormModel, DefaultFormModel

public interface ConfigurableFormModel
extends FormModel

Sub-interface implemented by form models that allow for configuration of the form's value models, id etc..

Author:
Keith Donald, Oliver Hutchison, Jan Hoskens

Field Summary
 
Fields inherited from interface org.springframework.binding.form.FormModel
COMMITTABLE_PROPERTY, DIRTY_PROPERTY, ENABLED_PROPERTY, READONLY_PROPERTY
 
Method Summary
 ValueModel add(String propertyName)
          Add a valueModel for the given property.
 ValueModel add(String propertyName, ValueModel valueModel)
          Add the given valueModel as wrapper for the given property.
 ValueModel add(String propertyName, ValueModel valueModel, FieldMetadata fieldMetadata)
          Add the given valueModel as wrapper for the given property.
 ValueModel addMethod(String propertyMethodName, String derivedFromProperty)
          Add a valueModel that holds a derived value computed by invoking the given method with the given property as argument on the formModel.
 ValueModel addMethod(String propertyMethodName, String[] derivedFromProperties)
          Add a valueModel that holds a derived value computed by invoking the given method with a number of other properties as arguments on the formModel.
 void setEnabled(boolean enabled)
           Set the enabled state of this formModel.
 void setId(String id)
          An id to identify this formModel.
 void setReadOnly(boolean readOnly)
           Set the readOnly state of this formModel.
 
Methods inherited from interface org.springframework.binding.form.FormModel
addCommitListener, commit, getFieldFace, getFieldMetadata, getFieldNames, getFormObject, getFormObjectHolder, getId, getValueModel, getValueModel, hasValueModel, isBuffered, isCommittable, isDirty, isEnabled, isReadOnly, registerPropertyConverter, removeCommitListener, reset, revert, setFormObject
 
Methods inherited from interface org.springframework.binding.value.PropertyChangePublisher
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Method Detail

setId

void setId(String id)
An id to identify this formModel.

Parameters:
id -

setEnabled

void setEnabled(boolean enabled)

Set the enabled state of this formModel. All fieldMetaData should take the enabled state of the formModel into account but should not alter their own enclosed enabled state.

A disabled formModel can be compared to a visual component which doesn't respond to any user interaction (grey-out).

Parameters:
enabled - set to true if the formModel should be enabled. Set to false if all fields should be disabled.

setReadOnly

void setReadOnly(boolean readOnly)

Set the readOnly state of this formModel. All fieldMetaData should take the readOnly state of the formModel into account but should not alter their own enclosed readOnly state.

A formModel in readOnly state can be seen as visual component in which the user can navigate but not alter any values. (Eg editable TextFields)

Parameters:
readOnly - set to true if all fields should be set readOnly.

add

ValueModel add(String propertyName)
Add a valueModel for the given property. Property should be accessible on the formObject.

Parameters:
propertyName - the property to create a valueModel for.
Returns:
a ValueModel that wraps the property.

add

ValueModel add(String propertyName,
               ValueModel valueModel)
Add the given valueModel as wrapper for the given property. Property should be accessible on the formObject. Note that the given valueModel should be used to access the property, but may be wrapped(chained) a number of times in other valueModels.

Parameters:
propertyName - the property.
valueModel - the valueModel to access the property.
Returns:
a valueModel that wraps the given valueModel.

add

ValueModel add(String propertyName,
               ValueModel valueModel,
               FieldMetadata fieldMetadata)
Add the given valueModel as wrapper for the given property. Note that the given valueModel should be used to access the property, but may be wrapped(chained) a number of times in other valueModels.

This adds another dimension to the formModel as this makes it possible to provide your own property that is not present on the formObject but does have a valueModel and metadata to bind fields and listen to.

Parameters:
propertyName - the property, possibly not bound to the formObject.
valueModel - the valueModel to access the property.
fieldMetadata - the metadata for this valueModel.
Returns:
a valueModel that is or wraps the given valueModel.
See Also:
DerivedValueModel, AbstractDerivedValueModel, MessageFormatValueModel

addMethod

ValueModel addMethod(String propertyMethodName,
                     String derivedFromProperty)
Add a valueModel that holds a derived value computed by invoking the given method with the given property as argument on the formModel.

Parameters:
propertyMethodName - method to invoke.
derivedFromProperty - property to use as argument.
Returns:
a valueModel holding the derived value.

addMethod

ValueModel addMethod(String propertyMethodName,
                     String[] derivedFromProperties)
Add a valueModel that holds a derived value computed by invoking the given method with a number of other properties as arguments on the formModel.

Parameters:
propertyMethodName - method to invoke.
derivedFromProperties - a number of properties to use as arguments on the method.
Returns:
a valueModel holding the derived value.


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.