|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.richclient.application.support.ApplicationServicesAccessor
org.springframework.richclient.factory.AbstractControlFactory
org.springframework.richclient.form.AbstractForm
public abstract class AbstractForm
Base implementation of a Form. Commands provided:
FormModel.commit() method.
Writes data to backing bean. Guarded mask FormGuard.ON_NOERRORS,
FormGuard.ON_ISDIRTY and FormGuard.ON_ENABLED.FormModel.revert() method.
Fall back to the values of the backing bean. Guarded mask
FormGuard.ON_ISDIRTY and FormGuard.ON_ENABLED.FormModel. Guarded mask FormGuard.ON_ENABLED
| Field Summary |
|---|
| Fields inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor |
|---|
logger |
| Constructor Summary | |
|---|---|
protected |
AbstractForm()
Default constructor will use the uncapitalized simplename of the class to construct its id. |
protected |
AbstractForm(FormModel formModel)
Create an AbstractForm with the given FormModel. |
protected |
AbstractForm(FormModel formModel,
String formId)
Create an AbstractForm. |
protected |
AbstractForm(HierarchicalFormModel parentFormModel,
String formId,
String childFormObjectPropertyPath)
Create a Form with a FormModel that has a child-parent relation with the provided parentFormModel. |
protected |
AbstractForm(HierarchicalFormModel parentFormModel,
String formId,
ValueModel childFormObjectHolder)
Create a Form with a FormModel that has a child-parent relation with the provided parentFormModel. |
protected |
AbstractForm(Object formObject)
Convenience constructor which creates a FormModel by calling
FormModelHelper.createFormModel(Object). |
protected |
AbstractForm(String formId)
Id configurable constructor. |
| Method Summary | |
|---|---|
void |
addChildForm(Form childForm)
Add a child (or sub) form to this form. |
void |
addFormObjectChangeListener(PropertyChangeListener listener)
|
void |
addFormValueChangeListener(String formPropertyPath,
PropertyChangeListener listener)
|
void |
addGuarded(Guarded guarded)
Attach the given Guarded object with the default mask to the
formModel. |
void |
addGuarded(Guarded guarded,
int mask)
Attach the given Guarded object with the specified mask to the
formModel. |
void |
addValidationListener(ValidationListener listener)
Add a ValidationListener. |
void |
addValidationResultsReporter(ValidationResultsReporter reporter)
Add a ValidationResultsReporter to this Form. |
protected void |
attachFormErrorGuard(Guarded guarded)
|
protected void |
attachFormGuard(Guarded guarded,
int mask)
|
void |
commit()
Commit all values of the FormModel. |
protected String |
constructSecurityControllerId(String commandFaceId)
Construct a default security controller Id for a given command face id. |
protected JButton |
createCommitButton()
|
protected JComponent |
createControl()
Subclasses must override this method to create a new instance of the control that this factory produces. |
protected abstract JComponent |
createFormControl()
|
protected JButton |
createNewFormObjectButton()
|
protected Object |
createNewObject()
Create a new object to install into the form. |
protected void |
detachFormGuard(Guarded guarded)
|
BindingFactory |
getBindingFactory()
Returns a BindingFactory bound to the inner FormModel to
provide binding support. |
protected Form |
getChildForm(String id)
Return a child form of this form with the given form id. |
ActionCommand |
getCommitCommand()
|
protected String |
getCommitCommandFaceDescriptorId()
|
protected String |
getCommitSecurityControllerId()
Subclasses may override to return a security controller id to be attached to the commit command. |
protected JButton |
getDefaultButton()
|
protected Object |
getEditableFormObject(int selectionIndex)
|
protected int |
getEditingFormObjectIndex()
|
ValidatingFormModel |
getFormModel()
Returns the formModel used by the form. |
Object |
getFormObject()
Convenience method to return the formObject currently used in the inner formModel. |
String |
getId()
Returns the id of this form. |
ActionCommand |
getNewFormObjectCommand()
|
protected String |
getNewFormObjectCommandId()
|
protected String |
getNewFormObjectSecurityControllerId()
Subclasses may override to return a security controller id to be attached to the newFormObject command. |
protected HierarchicalFormModel |
getParent()
Returns the parent of this Form's FormModel or null. |
ActionCommand |
getRevertCommand()
|
protected String |
getRevertCommandFaceDescriptorId()
|
List |
getValidationResultsReporters()
Returns the list of ValidationResultsReporters of this Form. |
Object |
getValue(String formProperty)
Convenience method to get the value of a specific property from the inner formModel. |
ValueModel |
getValueModel(String formProperty)
Convenience method to get the valueModel of a specific property from the inner formModel. |
protected void |
handleEnabledChange(boolean enabled)
|
boolean |
hasErrors()
Returns true if the inner FormModel has
errors. |
protected void |
init()
Hook called when constructing the Form. |
boolean |
isDirty()
|
boolean |
isEditingNewFormObject()
|
boolean |
isEnabled()
|
ValidationResultsReporter |
newSingleLineResultsReporter(Messagable messageReceiver)
Construct the validation results reporter for this form and attach it to the provided Guarded object. |
void |
postCommit(FormModel formModel)
Called just after a form model is commited. |
void |
preCommit(FormModel formModel)
Called just before a form model is about to commit. |
void |
removeChildForm(Form childForm)
Remove the given Form as child from this Form. |
void |
removeFormObjectChangeListener(PropertyChangeListener listener)
|
void |
removeFormValueChangeListener(String formPropertyPath,
PropertyChangeListener listener)
|
void |
removeGuarded(Guarded guarded)
Detach the Guarded object. |
void |
removeValidationListener(ValidationListener listener)
Remove a ValidationListener. |
void |
removeValidationResultsReporter(ValidationResultsReporter reporter)
Remove the given ValidationResultsReporter from this Form. |
void |
reset()
Reset the FormModel. |
void |
revert()
Revert the FormModel. |
void |
setClearFormOnCommit(boolean clearFormOnCommit)
|
protected void |
setDefaultButton(JButton button)
|
protected void |
setEditableFormObjects(ObservableList editableFormObjects)
|
protected void |
setEditingFormObjectIndexHolder(ValueModel valueModel)
|
protected void |
setEditingFormObjectIndexSilently(int index)
|
protected void |
setEditingNewFormObject(boolean editingNewFormOject)
Set the "editing new form object" state as indicated. |
void |
setEnabled(boolean enabled)
|
protected void |
setFormModel(ValidatingFormModel formModel)
Set the FormModel for this Form. |
protected void |
setFormModelDefaultEnabledState()
Set the form's enabled state based on a default policy--specifically, disable if the form object is null or the form object is guarded and is marked as disabled. |
void |
setFormObject(Object formObject)
Convenience method to set the formObject on the inner formModel. |
protected void |
setId(String formId)
Set the id used to configure this Form. |
| Methods inherited from class org.springframework.richclient.factory.AbstractControlFactory |
|---|
createControlIfNecessary, getControl, isControlCreated, isSingleton, setSingleton |
| Methods inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor |
|---|
getActiveWindow, getApplication, getApplicationContext, getApplicationName, getApplicationServices, getCommandConfigurer, getComponentFactory, getConversionService, getIconSource, getImageSource, getMessage, getMessage, getMessage, getMessage, getMessages, getMessageSource, getObjectConfigurer, getService |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.springframework.richclient.factory.ControlFactory |
|---|
getControl |
| Constructor Detail |
|---|
protected AbstractForm()
protected AbstractForm(String formId)
protected AbstractForm(Object formObject)
FormModel by calling
FormModelHelper.createFormModel(Object).
formObject - object used to create the formModel.AbstractForm(FormModel)protected AbstractForm(FormModel formModel)
FormModel. Use the
formModel's id to configure the Form.
AbstractForm(FormModel, String)
protected AbstractForm(FormModel formModel,
String formId)
protected AbstractForm(HierarchicalFormModel parentFormModel,
String formId,
String childFormObjectPropertyPath)
parentFormModel - the parent formModel.formId - id used for this Form's configuration.childFormObjectPropertyPath - the path relative to the
parentFormModel's formObject that leads to the child formObject that will
be handled by this Form.FormModelHelper.createChildPageFormModel(HierarchicalFormModel,
String, String)
protected AbstractForm(HierarchicalFormModel parentFormModel,
String formId,
ValueModel childFormObjectHolder)
parentFormModel - the parent formModel.formId - id used for this Form's configuration.childFormObjectHolder - the valueModel of the parentFormModel that
holds the child formObject that will be handled by this Form.FormModelHelper.createChildPageFormModel(HierarchicalFormModel,
String, ValueModel)| Method Detail |
|---|
protected void init()
public String getId()
Form
getId in interface Formprotected void setId(String formId)
public ValidatingFormModel getFormModel()
Form
getFormModel in interface Formpublic BindingFactory getBindingFactory()
BindingFactory bound to the inner FormModel to
provide binding support.
protected void setFormModel(ValidatingFormModel formModel)
FormModel for this Form. Normally a Form won't
change it's FormModel as this may lead to an inconsistent state. Only use
this when the formModel isn't set yet.
TODO check why we do allow setting when no control is created.
ValueModels might exist already leading to an inconsistent state.
formModel - protected HierarchicalFormModel getParent()
null.
public void addChildForm(Form childForm)
Validation listeners are unique to a form, so calling
addValidationListener(ValidationListener) will only add a
listener to this form. If you want to listen to the child forms, you will
need to add a validation listener on each child form of interest.
Note: It is very important that the child form provided be created using a form model that is a child model of this form's form model. If this is not done, then commit and revert operations will not be properly delegated to the child form models.
addChildForm in interface FormchildForm - to addpublic List getValidationResultsReporters()
Form
getValidationResultsReporters in interface Formpublic void addValidationResultsReporter(ValidationResultsReporter reporter)
Form
addValidationResultsReporter in interface Formpublic void removeValidationResultsReporter(ValidationResultsReporter reporter)
Form
removeValidationResultsReporter in interface Formpublic void removeChildForm(Form childForm)
Form
removeChildForm in interface Formprotected Form getChildForm(String id)
id - of child form
protected void setEditableFormObjects(ObservableList editableFormObjects)
protected void setEditingFormObjectIndexHolder(ValueModel valueModel)
public boolean isEditingNewFormObject()
protected void setEditingNewFormObject(boolean editingNewFormOject)
editingNewFormOject - protected int getEditingFormObjectIndex()
protected Object getEditableFormObject(int selectionIndex)
public void setClearFormOnCommit(boolean clearFormOnCommit)
protected JButton getDefaultButton()
protected void setDefaultButton(JButton button)
protected final JComponent createControl()
AbstractControlFactory
createControl in class AbstractControlFactoryprotected void setFormModelDefaultEnabledState()
protected abstract JComponent createFormControl()
protected void handleEnabledChange(boolean enabled)
public ActionCommand getNewFormObjectCommand()
public ActionCommand getCommitCommand()
public ActionCommand getRevertCommand()
protected Object createNewObject()
protected void setEditingFormObjectIndexSilently(int index)
public void preCommit(FormModel formModel)
CommitListener
preCommit in interface CommitListenerpublic void postCommit(FormModel formModel)
CommitListener
postCommit in interface CommitListenerprotected final JButton createNewFormObjectButton()
protected final JButton createCommitButton()
protected String getNewFormObjectCommandId()
protected String getCommitCommandFaceDescriptorId()
protected String getRevertCommandFaceDescriptorId()
protected String getNewFormObjectSecurityControllerId()
[formModel.id] + "." + [getNewFormObjectCommandId()].
This id can be mapped to a specific security controller using the SecurityControllerManager service.
SecurityControllerManagerprotected String getCommitSecurityControllerId()
[formModel.id] + "." + [getCommitCommandFaceDescriptorId()].
This id can be mapped to a specific security controller using the SecurityControllerManager service.
SecurityControllerManagerprotected String constructSecurityControllerId(String commandFaceId)
[formModel.id] + "." + [commandFaceId] if the form model
id is not null.
[commandFaceId] if the form model is null.
null if the commandFaceId is null.
commandFaceId -
protected void attachFormErrorGuard(Guarded guarded)
protected void attachFormGuard(Guarded guarded,
int mask)
protected void detachFormGuard(Guarded guarded)
public Object getFormObject()
Form
getFormObject in interface Formpublic void setFormObject(Object formObject)
Form
setFormObject in interface Formpublic Object getValue(String formProperty)
Form
getValue in interface Formpublic ValueModel getValueModel(String formProperty)
Form
getValueModel in interface Formpublic boolean isEnabled()
public void setEnabled(boolean enabled)
public void addValidationListener(ValidationListener listener)
Form
addValidationListener in interface Formpublic void removeValidationListener(ValidationListener listener)
Form
removeValidationListener in interface Formpublic ValidationResultsReporter newSingleLineResultsReporter(Messagable messageReceiver)
SimpleValidationResultsReporter will be constructed and returned.
All registered child forms will be attached to the same
guarded and messageReceiver as this form.
newSingleLineResultsReporter in interface FormmessageReceiver - the message receiver used by the created
resultsReporter.
public void addFormObjectChangeListener(PropertyChangeListener listener)
public void removeFormObjectChangeListener(PropertyChangeListener listener)
public void addFormValueChangeListener(String formPropertyPath,
PropertyChangeListener listener)
public void removeFormValueChangeListener(String formPropertyPath,
PropertyChangeListener listener)
public boolean isDirty()
public boolean hasErrors()
Formtrue if the inner FormModel has
errors.
hasErrors in interface Formpublic void commit()
FormFormModel.
commit in interface FormFormModel.commit()public void revert()
FormFormModel.
revert in interface FormFormModel.revert()public void reset()
FormFormModel.
reset in interface FormFormModel.reset()public void addGuarded(Guarded guarded)
FormGuarded object with the default mask to the
formModel.
addGuarded in interface FormForm.addGuarded(Guarded, int),
FormGuard
public void addGuarded(Guarded guarded,
int mask)
FormGuarded object with the specified mask to the
formModel.
addGuarded in interface FormFormGuardpublic void removeGuarded(Guarded guarded)
FormGuarded object.
removeGuarded in interface Form
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||