|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FormModel
A formModel groups valueModels and actions that are related to the same backing object. It will manage the creation/handling of the valueModels, their associated metadata and an overal state.
The formModel can be in one of three 'user' states:
The formModel also tracks its inner states:
ConfigurableFormModel
Field Summary | |
---|---|
static String |
COMMITTABLE_PROPERTY
The name of the bound property committable. |
static String |
DIRTY_PROPERTY
The name of the bound property dirty. |
static String |
ENABLED_PROPERTY
The name of the bound property enabled. |
static String |
READONLY_PROPERTY
The name of the bound property readonly. |
Method Summary | |
---|---|
void |
addCommitListener(CommitListener listener)
Adds the specified listener to the list if listeners notified when a commit happens. |
void |
commit()
Commits any changes buffered by the form property value models into the current form backing object. |
FieldFace |
getFieldFace(String field)
FIXME: this should be on the FieldMetadata class |
FieldMetadata |
getFieldMetadata(String field)
Returns the metadata for the given form field. |
Set |
getFieldNames()
Returns the fields that are used by this formModel. |
Object |
getFormObject()
Returns the object currently backing this form. |
ValueModel |
getFormObjectHolder()
Returns the value model which holds the object currently backing this form. |
String |
getId()
Returns the id that is used to identify this form model. |
ValueModel |
getValueModel(String formProperty)
Returns a value model that holds the value of the specified form property. |
ValueModel |
getValueModel(String formProperty,
Class targetClass)
Returns a type converting value model for the given form property. |
boolean |
hasValueModel(String formProperty)
Returns true if the form has a value model for the provided property name. |
boolean |
isBuffered()
Does this form model buffer changes? |
boolean |
isCommittable()
Returns true if the changes held by this form are able to be committed. |
boolean |
isDirty()
Returns true if any of the value models holding properties of this form have been modified since the last call to either commit or revert or since the last change of the form backing object. |
boolean |
isEnabled()
A form can be enabled/disabled which reflects a global state on the associated valueModels and their metaData. |
boolean |
isReadOnly()
A form can be set as readOnly which reflects a global state on the valueModels and their metaData. |
void |
registerPropertyConverter(String propertyName,
org.springframework.binding.convert.Converter toConverter,
org.springframework.binding.convert.Converter fromConverter)
Register converters for a given property name. |
void |
removeCommitListener(CommitListener listener)
Removes the specified listener to the list if listeners notified when a commit happens. |
void |
reset()
Reset the form by replacing the form object with a newly instantiated object of the type of the current form object. |
void |
revert()
Reverts any dirty value models back to the original values that were loaded from the current form backing object since last call to either commit or revert or since the last change of the form backing object. |
void |
setFormObject(Object formObject)
Sets the object currently backing this form. |
Methods inherited from interface org.springframework.binding.value.PropertyChangePublisher |
---|
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
static final String DIRTY_PROPERTY
static final String ENABLED_PROPERTY
static final String READONLY_PROPERTY
static final String COMMITTABLE_PROPERTY
Method Detail |
---|
String getId()
Object getFormObject()
void setFormObject(Object formObject)
ValueModel getFormObjectHolder()
ValueModel getValueModel(String formProperty)
InvalidPropertyException
- if the form has no such propertyValueModel getValueModel(String formProperty, Class targetClass)
InvalidPropertyException
- if the form has no such property
IllegalArgumentException
- if no suitable converter from the
original property class to the targetClass can be foundFieldMetadata getFieldMetadata(String field)
Set getFieldNames()
void registerPropertyConverter(String propertyName, org.springframework.binding.convert.Converter toConverter, org.springframework.binding.convert.Converter fromConverter)
propertyName
- name of property on which to register converterstoConverter
- Convert from source to target typefromConverter
- Convert from target to source typeboolean hasValueModel(String formProperty)
void commit()
IllegalStateException
- if the form model is not committableisCommittable()
void revert()
void reset()
boolean isBuffered()
boolean isDirty()
boolean isEnabled()
true
if this form is enabled.
boolean isReadOnly()
true
if this form is readOnly.boolean isCommittable()
void addCommitListener(CommitListener listener)
void removeCommitListener(CommitListener listener)
FieldFace getFieldFace(String field)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |