org.springframework.richclient.form
Class AbstractDetailForm

java.lang.Object
  extended by org.springframework.richclient.application.support.ApplicationServicesAccessor
      extended by org.springframework.richclient.factory.AbstractControlFactory
          extended by org.springframework.richclient.form.AbstractForm
              extended by org.springframework.richclient.form.AbstractDetailForm
All Implemented Interfaces:
CommitListener, PropertyChangePublisher, ControlFactory, Form

public abstract class AbstractDetailForm
extends AbstractForm
implements PropertyChangePublisher

This is an abstract base implementation of the detail side of a Master/Detail form pair. Derived types need only implement AbstractForm.createFormControl().

The various form commands can be secured by specifying security controller id's for the command. Use the AbstractForm.getCommitSecurityControllerId() and AbstractForm.getNewFormObjectCommand().

Author:
Larry Streepy

Field Summary
static String EDIT_STATE_PROPERTY
          Edit state property name for change notifications.
static int STATE_CLEAR
          State indicating that we are editing no object.
static int STATE_CREATE
          State indicating that we are creating a new object.
static int STATE_EDIT
          State indicating that we are editing an existing object.
 
Fields inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor
logger
 
Constructor Summary
protected AbstractDetailForm(FormModel formModel, String formId, ObservableList editableItemList)
           
  AbstractDetailForm(HierarchicalFormModel parentFormModel, String formId, ValueModel childFormObjectHolder, ObservableList masterList)
          Construct a detail form using the provided parent form model (we will construct our own form model as a child of the parent model).
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Register a listener to all properties of this publisher.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Register a listener to a specific property.
protected  JComponent createButtonBar()
          Return a standardized row of command buttons, right-justified and all of the same size, with OK as the default button, and no mnemonics used, as per the Java Look and Feel guidelines.
protected  ActionCommand createCancelCommand()
          Create the cancel command.
 void creatingNewObject()
          Set the form for "create new object" mode.
protected  void firePropertyChange(String propertyName, int oldValue, int newValue)
           
 ActionCommand getCancelCommand()
          Return the configured cancel command, creating it if necessary.
protected  String getCancelCommandFaceDescriptorId()
           
protected  String getCommitCommandFaceDescriptorId()
           
 ValueHolder getEditingIndexHolder()
          Get the value holder containing the editing index.
 int getEditState()
          Get the current edit state: one of STATE_CLEAR, STATE_CREATE, or STATE_EDIT.
protected  String getNewFormObjectSecurityControllerId()
          Override to return null for the new object security controller id.
protected  String getRevertCommandFaceDescriptorId()
           
 int getSelectedIndex()
           
 void postCommit(FormModel formModel)
          Commit this forms data back to the master table.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove the listener from all properties of this publisher.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove the listener from a specific property.
protected  void setEditState(int editState)
          Set the current edit state.
protected  void setMasterList(ObservableList masterList)
          Set the master list model.
 void setSelectedIndex(int index)
          Set the selected object index.
protected  void updateControlsForState()
          Update our controls based on our state.
 
Methods inherited from class org.springframework.richclient.form.AbstractForm
addChildForm, addFormObjectChangeListener, addFormValueChangeListener, addGuarded, addGuarded, addValidationListener, addValidationResultsReporter, attachFormErrorGuard, attachFormGuard, commit, constructSecurityControllerId, createCommitButton, createControl, createFormControl, createNewFormObjectButton, createNewObject, detachFormGuard, getBindingFactory, getChildForm, getCommitCommand, getCommitSecurityControllerId, getDefaultButton, getEditableFormObject, getEditingFormObjectIndex, getFormModel, getFormObject, getId, getNewFormObjectCommand, getNewFormObjectCommandId, getParent, getRevertCommand, getValidationResultsReporters, getValue, getValueModel, handleEnabledChange, hasErrors, init, isDirty, isEditingNewFormObject, isEnabled, newSingleLineResultsReporter, preCommit, removeChildForm, removeFormObjectChangeListener, removeFormValueChangeListener, removeGuarded, removeValidationListener, removeValidationResultsReporter, reset, revert, setClearFormOnCommit, setDefaultButton, setEditableFormObjects, setEditingFormObjectIndexHolder, setEditingFormObjectIndexSilently, setEditingNewFormObject, setEnabled, setFormModel, setFormModelDefaultEnabledState, setFormObject, setId
 
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
 

Field Detail

STATE_CLEAR

public static final int STATE_CLEAR
State indicating that we are editing no object.

See Also:
Constant Field Values

STATE_EDIT

public static final int STATE_EDIT
State indicating that we are editing an existing object.

See Also:
Constant Field Values

STATE_CREATE

public static final int STATE_CREATE
State indicating that we are creating a new object.

See Also:
Constant Field Values

EDIT_STATE_PROPERTY

public static final String EDIT_STATE_PROPERTY
Edit state property name for change notifications.

See Also:
Constant Field Values
Constructor Detail

AbstractDetailForm

protected AbstractDetailForm(FormModel formModel,
                             String formId,
                             ObservableList editableItemList)
Parameters:
pageFormModel -

AbstractDetailForm

public AbstractDetailForm(HierarchicalFormModel parentFormModel,
                          String formId,
                          ValueModel childFormObjectHolder,
                          ObservableList masterList)
Construct a detail form using the provided parent form model (we will construct our own form model as a child of the parent model). The provided masterList will be installed as the set of editable form objects.

Parameters:
parentFormModel -
formId -
childFormObjectHolder -
masterList - ObservableList holding the editable items
Method Detail

setMasterList

protected void setMasterList(ObservableList masterList)
Set the master list model.

Parameters:
masterList - list to use as our master data

setSelectedIndex

public void setSelectedIndex(int index)
Set the selected object index.

Parameters:
index - of selected item

getSelectedIndex

public int getSelectedIndex()
Returns:
index of item being edited

getEditingIndexHolder

public ValueHolder getEditingIndexHolder()
Get the value holder containing the editing index. This allows triggers to monitor for changes in the index of the object we are editing.

Returns:

creatingNewObject

public void creatingNewObject()
Set the form for "create new object" mode. This will set controls as needed for this edit mode.


updateControlsForState

protected void updateControlsForState()
Update our controls based on our state.


setEditState

protected void setEditState(int editState)
Set the current edit state.

Parameters:
new - edit state

getEditState

public int getEditState()
Get the current edit state: one of STATE_CLEAR, STATE_CREATE, or STATE_EDIT.

Returns:
current state

postCommit

public void postCommit(FormModel formModel)
Commit this forms data back to the master table. Let our super class do all the work and then just inform our master table that the value has changed.

Specified by:
postCommit in interface CommitListener
Overrides:
postCommit in class AbstractForm

getRevertCommandFaceDescriptorId

protected String getRevertCommandFaceDescriptorId()
Overrides:
getRevertCommandFaceDescriptorId in class AbstractForm

getCommitCommandFaceDescriptorId

protected String getCommitCommandFaceDescriptorId()
Overrides:
getCommitCommandFaceDescriptorId in class AbstractForm

getCancelCommandFaceDescriptorId

protected String getCancelCommandFaceDescriptorId()

getNewFormObjectSecurityControllerId

protected String getNewFormObjectSecurityControllerId()
Override to return null for the new object security controller id. We do this because this command is not used directly, so it shouldn't be controlled. The AbstractMasterForm is responsible for the real (invocable) instance of this command.

Overrides:
getNewFormObjectSecurityControllerId in class AbstractForm
Returns:
null
See Also:
SecurityControllerManager

getCancelCommand

public ActionCommand getCancelCommand()
Return the configured cancel command, creating it if necessary.

Returns:
cancel command

createCancelCommand

protected ActionCommand createCancelCommand()
Create the cancel command. This will cancel the "create new" operation and reset the form.

Returns:
cancel command action

createButtonBar

protected JComponent createButtonBar()
Return a standardized row of command buttons, right-justified and all of the same size, with OK as the default button, and no mnemonics used, as per the Java Look and Feel guidelines.


addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: PropertyChangePublisher
Register a listener to all properties of this publisher.

Specified by:
addPropertyChangeListener in interface PropertyChangePublisher
Parameters:
listener - the PropertyChangeListener to register.

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: PropertyChangePublisher
Remove the listener from all properties of this publisher.

Specified by:
removePropertyChangeListener in interface PropertyChangePublisher
Parameters:
listener - the PropertyChangeListener to remove.

addPropertyChangeListener

public final void addPropertyChangeListener(String propertyName,
                                            PropertyChangeListener listener)
Description copied from interface: PropertyChangePublisher
Register a listener to a specific property.

Specified by:
addPropertyChangeListener in interface PropertyChangePublisher
Parameters:
propertyName - the property to monitor.
listener - the PropertyChangeListener to register.

removePropertyChangeListener

public final void removePropertyChangeListener(String propertyName,
                                               PropertyChangeListener listener)
Description copied from interface: PropertyChangePublisher
Remove the listener from a specific property.

Specified by:
removePropertyChangeListener in interface PropertyChangePublisher
Parameters:
propertyName - the property that was being monitored.
listener - the PropertyChangeListener to remove.

firePropertyChange

protected final void firePropertyChange(String propertyName,
                                        int oldValue,
                                        int newValue)


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