|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.binding.value.support.AbstractPropertyChangePublisher
org.springframework.binding.form.support.AbstractFormModel
org.springframework.binding.form.support.DefaultFormModel
public class DefaultFormModel
Default form model implementation. Is configurable, hierarchical and validating.
If you need this form model to use validation rules that are specific to a
given context (such as a specific form), then you will need to call
setValidator(Validator)
with a validator configured with the
required context id. Like this:
RulesValidator validator = myValidatingFormModel.getValidator();
validator.setRulesContextId( "mySpecialFormId" );
Along with this you will need to register your rules using the context id.
See DefaultRulesSource.addRules(String, org.springframework.rules.Rules)
.
Nested Class Summary | |
---|---|
protected class |
DefaultFormModel.ValidatingFormValueModel
|
Nested classes/interfaces inherited from class org.springframework.binding.form.support.AbstractFormModel |
---|
AbstractFormModel.ChildStateChangeHandler, AbstractFormModel.ConvertingValueModelKey, AbstractFormModel.ParentStateChangeHandler |
Field Summary |
---|
Fields inherited from class org.springframework.binding.form.support.AbstractFormModel |
---|
childStateChangeHandler, parentStateChangeHandler |
Fields inherited from class org.springframework.binding.value.support.AbstractPropertyChangePublisher |
---|
logger |
Fields inherited from interface org.springframework.binding.form.ValidatingFormModel |
---|
VALIDATING_PROPERTY |
Fields inherited from interface org.springframework.binding.form.FormModel |
---|
COMMITTABLE_PROPERTY, DIRTY_PROPERTY, ENABLED_PROPERTY, READONLY_PROPERTY |
Constructor Summary | |
---|---|
DefaultFormModel()
|
|
DefaultFormModel(MutablePropertyAccessStrategy domainObjectAccessStrategy)
|
|
DefaultFormModel(MutablePropertyAccessStrategy domainObjectAccessStrategy,
boolean bufferChanges)
|
|
DefaultFormModel(Object domainObject)
|
|
DefaultFormModel(Object domainObject,
boolean buffered)
|
|
DefaultFormModel(ValueModel domainObjectHolder)
|
|
DefaultFormModel(ValueModel domainObjectHolder,
boolean buffered)
|
Method Summary | |
---|---|
void |
addChild(HierarchicalFormModel child)
Add child to this FormModel. |
protected void |
childStateChanged(PropertyChangeEvent evt)
Events from the child form model or value models that have side-effects on this form model should be handled here. |
protected void |
clearBindingError(DefaultFormModel.ValidatingFormValueModel valueModel)
|
void |
clearValidationMessage(ValidationMessage validationMessage)
Clear validation messages that are generated by a process separate from the standard Validator. |
protected void |
formPropertyValueChanged(String formProperty)
|
protected ValidationMessage |
getBindingErrorMessage(String propertyName,
Object valueBeingSet,
Exception e)
|
boolean |
getHasErrors()
Does this ValidatingFormModel or any of its children contain errors? |
ValidationResultsModel |
getValidationResults()
Returns the ValidationResultsModel which encapsulates the set of validation messages currently active against this form model. |
Validator |
getValidator()
Get the validator that will be used to validate the form model. |
protected void |
hasErrorsUpdated()
|
protected void |
init()
Initialization of DefaultFormModel. |
boolean |
isCommittable()
Returns true if the changes held by this form are able to be committed. |
boolean |
isValidating()
Is this form model currently validating? |
protected void |
parentStateChanged(PropertyChangeEvent evt)
Events from the parent form model that have side-effects on this form model should be handled here. |
protected void |
postProcessNewConvertingValueModel(String formProperty,
Class targetClass,
ValueModel valueModel)
Provides a hook for subclasses to perform some processing after a new converting value model has been added to this form model. |
protected void |
postProcessNewValueModel(String formProperty,
ValueModel valueModel)
Provides a hook for subclasses to perform some processing after a new value model has been added to this form model. |
protected ValueModel |
preProcessNewConvertingValueModel(String formProperty,
Class targetClass,
ValueModel formValueModel)
Provides a hook for subclasses to optionally decorate a new converting value model added to this form model. |
protected ValueModel |
preProcessNewValueModel(String formProperty,
ValueModel formValueModel)
Provides a hook for subclasses to optionally decorate a new value model added to this form model. |
protected void |
raiseBindingError(DefaultFormModel.ValidatingFormValueModel valueModel,
Object valueBeingSet,
Exception e)
|
void |
raiseValidationMessage(ValidationMessage validationMessage)
Provide validation messages that are generated by a process separate from the standard Validator. |
void |
removeChild(HierarchicalFormModel child)
Remove a child FormModel. |
void |
removeParent()
Remove the parent form model |
void |
setBindingErrorMessageProvider(BindingErrorMessageProvider bindingErrorMessageProvider)
|
void |
setParent(HierarchicalFormModel parent)
Sets the parent form model. |
void |
setValidating(boolean validating)
Sets whether or not validation is currently enabled for this form model. |
void |
setValidator(Validator validator)
Set the validator that will be used to validate the form model. |
String |
toString()
|
void |
validate()
Forces the form model to validate its self. |
protected void |
validateAfterPropertyChanged(String formProperty)
|
protected void |
validatingUpdated()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.binding.form.ConfigurableFormModel |
---|
add, add, add, addMethod, addMethod, setEnabled, setId, setReadOnly |
Methods inherited from interface org.springframework.binding.form.HierarchicalFormModel |
---|
getChildren, getParent |
Methods inherited from interface org.springframework.binding.form.FormModel |
---|
addCommitListener, commit, getFieldFace, getFieldMetadata, getFieldNames, getFormObject, getFormObjectHolder, getId, getValueModel, getValueModel, hasValueModel, isBuffered, isDirty, isEnabled, isReadOnly, registerPropertyConverter, removeCommitListener, reset, revert, setFormObject |
Methods inherited from interface org.springframework.binding.value.PropertyChangePublisher |
---|
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
Constructor Detail |
---|
public DefaultFormModel()
public DefaultFormModel(Object domainObject)
public DefaultFormModel(Object domainObject, boolean buffered)
public DefaultFormModel(ValueModel domainObjectHolder)
public DefaultFormModel(ValueModel domainObjectHolder, boolean buffered)
public DefaultFormModel(MutablePropertyAccessStrategy domainObjectAccessStrategy)
public DefaultFormModel(MutablePropertyAccessStrategy domainObjectAccessStrategy, boolean bufferChanges)
Method Detail |
---|
protected void init()
public boolean isValidating()
isValidating
in interface ValidatingFormModel
public void setValidating(boolean validating)
ValidatingFormModel
setValidating
in interface ValidatingFormModel
protected void validatingUpdated()
public void addChild(HierarchicalFormModel child)
AbstractFormModel
addChild
in interface HierarchicalFormModel
addChild
in class AbstractFormModel
child
- FormModel to add as child.public void removeChild(HierarchicalFormModel child)
AbstractFormModel
removeChild
in interface HierarchicalFormModel
removeChild
in class AbstractFormModel
child
- FormModel to remove from childlist.protected void childStateChanged(PropertyChangeEvent evt)
AbstractFormModel.parentStateChanged(PropertyChangeEvent)
.
Additionally the DefaultFormModel
adds the event:
ValidationResultsModel
as a child model of
the DefaultFormModel
as the result model is bundled together with
the value models.
childStateChanged
in class AbstractFormModel
public void setParent(HierarchicalFormModel parent)
HierarchicalFormModel
setParent
in interface HierarchicalFormModel
setParent
in class AbstractFormModel
protected void parentStateChanged(PropertyChangeEvent evt)
DefaultFormModel
adds the event:
parentStateChanged
in class AbstractFormModel
public void removeParent()
HierarchicalFormModel
removeParent
in interface HierarchicalFormModel
removeParent
in class AbstractFormModel
public ValidationResultsModel getValidationResults()
ValidatingFormModel
getValidationResults
in interface ValidatingFormModel
public boolean getHasErrors()
ValidatingFormModel
getHasErrors
in interface ValidatingFormModel
protected void hasErrorsUpdated()
public void validate()
ValidatingFormModel
validate
in interface ValidatingFormModel
public Validator getValidator()
ValidatingFormModel
getValidator
in interface ValidatingFormModel
public void setValidator(Validator validator)
Setting a validator will trigger a validate of the current object.
setValidator
in interface ValidatingFormModel
public boolean isCommittable()
FormModel
isCommittable
in interface FormModel
isCommittable
in class AbstractFormModel
protected ValueModel preProcessNewValueModel(String formProperty, ValueModel formValueModel)
AbstractFormModel
preProcessNewValueModel
in class AbstractFormModel
protected void postProcessNewValueModel(String formProperty, ValueModel valueModel)
AbstractFormModel
postProcessNewValueModel
in class AbstractFormModel
protected ValueModel preProcessNewConvertingValueModel(String formProperty, Class targetClass, ValueModel formValueModel)
AbstractFormModel
preProcessNewConvertingValueModel
in class AbstractFormModel
protected void postProcessNewConvertingValueModel(String formProperty, Class targetClass, ValueModel valueModel)
AbstractFormModel
postProcessNewConvertingValueModel
in class AbstractFormModel
protected void formPropertyValueChanged(String formProperty)
protected void validateAfterPropertyChanged(String formProperty)
formProperty
- the name of the only property that has changed since
the last call to validateAfterPropertyChange or null
if
this is not known/available.protected void raiseBindingError(DefaultFormModel.ValidatingFormValueModel valueModel, Object valueBeingSet, Exception e)
protected void clearBindingError(DefaultFormModel.ValidatingFormValueModel valueModel)
public void raiseValidationMessage(ValidationMessage validationMessage)
ValidatingFormModel
All error messages that are raised using this method must be cleared
using the method #cleanValdationMessage(ValidationMessage)
before
the form model can be commited.
raiseValidationMessage
in interface ValidatingFormModel
validationMessage
- the message to raisepublic void clearValidationMessage(ValidationMessage validationMessage)
ValidatingFormModel
clearValidationMessage
in interface ValidatingFormModel
validationMessage
- the message to clearprotected ValidationMessage getBindingErrorMessage(String propertyName, Object valueBeingSet, Exception e)
public void setBindingErrorMessageProvider(BindingErrorMessageProvider bindingErrorMessageProvider)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |