org.springframework.richclient.widget.editor
Class AbstractDataEditorWidget

Show UML class diagram
java.lang.Object
  extended by org.springframework.richclient.application.support.ApplicationServicesAccessor
      extended by org.springframework.richclient.widget.AbstractWidget
          extended by org.springframework.richclient.widget.AbstractTitledWidget
              extended by org.springframework.richclient.widget.editor.AbstractDataEditorWidget
All Implemented Interfaces:
BeanNameAware, PropertyChangePublisher, DescriptionConfigurable, Guarded, TitleConfigurable, Messagable, ImageConfigurable, SelectionWidget, TitledWidget, Widget
Direct Known Subclasses:
DefaultDataEditorWidget

public abstract class AbstractDataEditorWidget
extends AbstractTitledWidget
implements TitledWidget, SelectionWidget

AbstractDataEditorWidget implements a basic editor screen, based on 3 parts:

  1. a table with sortable columns and a local quick search
  2. a filter to reduce the dataset
  3. a detail section for the details of 1 entity


Field Summary
protected static String CREATE_COMMAND_ID
           
static com.jgoodies.forms.layout.ColumnSpec FILL_COLUMN_SPEC
           
static com.jgoodies.forms.layout.ColumnSpec FILL_NOGROW_COLUMN_SPEC
           
static com.jgoodies.forms.layout.RowSpec FILL_ROW_SPEC
           
static boolean OFF
           
static boolean ON
           
protected  Observer tableSelectionObserver
          Observer listening to changes in the table selection.
static String UNSAVEDCHANGES_UNCOMMITTABLE_WARNING_ID
           
static String UNSAVEDCHANGES_WARNING_ID
           
protected static String UPDATE_COMMAND_ID
           
 
Fields inherited from class org.springframework.richclient.widget.AbstractWidget
showing
 
Fields inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor
logger
 
Fields inherited from interface org.springframework.richclient.dialog.Messagable
MESSAGE_PROPERTY
 
Fields inherited from interface org.springframework.richclient.widget.Widget
EMPTY_WIDGET
 
Constructor Summary
AbstractDataEditorWidget()
          Default constructor will initialise the necessary listeners/observers.
 
Method Summary
 void addDataProviderListener(Class dataProviderEventSource, DataProviderListener listener)
           
 boolean canClose()
          Checks whether this component can be closed visually, for example when there are no unsaved changes.
protected abstract  Object cloneEntity(Object sampleObject)
           
protected  ActionCommand createAddRowCommand()
           
protected  ActionCommand createClearFilterCommand()
           
protected  ActionCommand createCloneRowCommand()
           
protected  ActionCommand createCreateCommand()
          Creates the create command.
protected  JComponent createDataEditorWidget()
           
abstract  Widget createDetailWidget()
           
protected  ActionCommand createEditRowCommand()
           
protected  ActionCommand createEmptyFilterCommand()
           
protected  ActionCommand createExecuteFilterCommand()
           
protected  Observer createListSelectionObserver()
          Creates the observer that listens to selections in the listView.
protected abstract  Object createNewEntity(Object committedObject)
           
protected  JComponent createQuickAddCheckBox()
           
protected  ActionCommand createRefreshCommand()
           
protected  ActionCommand createRemoveRowCommand()
           
protected  ActionCommand createUpdateCommand()
          Creates the save command.
 JComponent createWidgetContent()
          
protected  void doCreate()
          Creates a new data object according to following steps:

form commit formObject sent to back-end back-end creates item back-end returns new item to client new item is selected in dataEditor if possible

protected  void doUpdate()
          Save the changes made in the detailForm according to following steps:

commit form formObject sent to back-end changes are handled in back-end changed object is returned to client old object is replaced by changed object

protected abstract  void executeFilter()
           
abstract  void executeFilter(Map<String,Object> parameters)
           
protected  ActionCommand getAddRowCommand()
           
 ActionCommand getClearFilterCommand()
           
protected  ActionCommand getCloneRowCommand()
           
 List<AbstractCommand> getCommands()
          Returns a list of commands for this widget.
protected  ActionCommand getCommitCommand()
          Convenience method to retrieve the action command that should be used when changes are made in the detailForm.
protected  JComponent getCommitComponent()
           
protected  AbstractCommand[] getControlCommands()
           
 ActionCommand getCopySelectedRowsToClipboardCommand()
           
 ActionCommand getCreateCommand()
          Returns the create command, lazily creates one if needed.
abstract  AbstractForm getDetailForm()
           
protected  JComponent getDetailPanel()
           
protected  JComponent getEditButtons()
           
protected  ActionCommand getEditRowCommand()
           
protected  ActionCommand getEmptyFilterCommand()
           
 ActionCommand getExecuteFilterCommand()
           
protected  Object[] getFilterCriteria()
           
protected abstract  FilterForm getFilterForm()
           
protected  AbstractCommand getHelpCommand()
           
 ActionCommand getRefreshCommand()
           
protected  ActionCommand getRemoveRowsCommand()
           
protected  AbstractCommand getRevertCommand()
           
 String getSearchString()
           
protected  ActionCommand getSelectCommand()
           
 Object getSelectedRowObject()
           
 Object getSelection()
           
protected  CommandGroup getTableFilterControlCommands()
           
protected  JComponent getTableFilterPanel()
           
protected  CommandGroup getTablePopupMenuCommandGroup()
          Returns the commandGroup that should be used to create the popup menu for the table.
protected  double getTableResizeWeight()
           
abstract  TableWidget getTableWidget()
           
 AbstractCommand getToggleDetailCommand()
           
 SplitPaneExpansionToggleCommand getToggleFilterCommand()
           
 ActionCommand getUpdateCommand()
          Returns the save command, lazily creates one if needed.
protected abstract  DefaultValidationResultsModel getValidationResults()
           
protected abstract  boolean isAddRowSupported()
           
protected abstract  boolean isCloneRowSupported()
           
protected abstract  boolean isFilterSupported()
           
protected abstract  boolean isRemoveRowsSupported()
           
 boolean isSelectMode()
           
protected abstract  boolean isUpdateRowSupported()
           
protected  Object loadEntityDetails(Object baseObject)
           
protected abstract  Object loadEntityDetails(Object baseObject, boolean forceLoad)
          Fetch the detailed object from the back-end.
protected  void newRow(Object newClone)
           
 ValidationResultsReporter newSingleLineResultsReporter(Messagable messagable)
          
protected  void onRowSelection(Object rowObject)
           
 void removeDataProviderListener(Class dataProviderEventSource, DataProviderListener listener)
           
protected abstract  void removeEntity(Object objectToRemove)
           
protected  void removeRows()
           
 void removeSelectionCommand()
           
protected  void replaceRowObject(Object oldRowObject, Object newRowObject)
           
protected abstract  Object saveEntity(Object committedObject)
           
 void setDataProviderEventSources(List dataProviderEventSources)
           
 void setMultipleSelectionInSelectMode(boolean multipleSelection)
           
 void setSearchString(String queryString)
          Set the local text filter field value
 void setSelectedRowObject(Object selectedObject)
           
abstract  Object setSelectedSearch(Object searchCriteria)
           
 void setSelectionCommand(ActionCommand command)
          Command called to set the selection for the widget.
 void setSelectMode(boolean selectMode)
          Set the select mode of this dataEditor.
 
Methods inherited from class org.springframework.richclient.widget.AbstractTitledWidget
addPropertyChangeListener, addPropertyChangeListener, getComponent, getDescription, getId, isEnabled, removePropertyChangeListener, removePropertyChangeListener, setBeanName, setCaption, setDescription, setEnabled, setId, setImage, setMessage, setTitle
 
Methods inherited from class org.springframework.richclient.widget.AbstractWidget
isShowing, onAboutToHide, onAboutToShow
 
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.widget.TitledWidget
getId
 
Methods inherited from interface org.springframework.richclient.core.Guarded
isEnabled, setEnabled
 
Methods inherited from interface org.springframework.richclient.dialog.Messagable
setMessage
 
Methods inherited from interface org.springframework.binding.value.PropertyChangePublisher
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface org.springframework.richclient.core.TitleConfigurable
setTitle
 
Methods inherited from interface org.springframework.richclient.image.config.ImageConfigurable
setImage
 
Methods inherited from interface org.springframework.richclient.core.DescriptionConfigurable
setCaption, setDescription
 
Methods inherited from interface org.springframework.beans.factory.BeanNameAware
setBeanName
 
Methods inherited from interface org.springframework.richclient.widget.Widget
getComponent, isShowing, onAboutToHide, onAboutToShow
 

Field Detail

UPDATE_COMMAND_ID

protected static final String UPDATE_COMMAND_ID
See Also:
Constant Field Values

CREATE_COMMAND_ID

protected static final String CREATE_COMMAND_ID
See Also:
Constant Field Values

UNSAVEDCHANGES_WARNING_ID

public static final String UNSAVEDCHANGES_WARNING_ID
See Also:
Constant Field Values

UNSAVEDCHANGES_UNCOMMITTABLE_WARNING_ID

public static final String UNSAVEDCHANGES_UNCOMMITTABLE_WARNING_ID
See Also:
Constant Field Values

FILL_ROW_SPEC

public static final com.jgoodies.forms.layout.RowSpec FILL_ROW_SPEC

FILL_NOGROW_COLUMN_SPEC

public static final com.jgoodies.forms.layout.ColumnSpec FILL_NOGROW_COLUMN_SPEC

FILL_COLUMN_SPEC

public static final com.jgoodies.forms.layout.ColumnSpec FILL_COLUMN_SPEC

ON

public static final boolean ON
See Also:
Constant Field Values

OFF

public static final boolean OFF
See Also:
Constant Field Values

tableSelectionObserver

protected Observer tableSelectionObserver
Observer listening to changes in the table selection.

Constructor Detail

AbstractDataEditorWidget

public AbstractDataEditorWidget()
Default constructor will initialise the necessary listeners/observers.

Method Detail

createListSelectionObserver

protected Observer createListSelectionObserver()
Creates the observer that listens to selections in the listView. Normally forwards the selection to the detailForm.


setSelectMode

public void setSelectMode(boolean selectMode)
Set the select mode of this dataEditor.


isSelectMode

public boolean isSelectMode()

setSearchString

public void setSearchString(String queryString)
Set the local text filter field value

Parameters:
queryString - filterText.

getSearchString

public String getSearchString()

getSelectedRowObject

public Object getSelectedRowObject()

setSelectedRowObject

public void setSelectedRowObject(Object selectedObject)

setSelectedSearch

public abstract Object setSelectedSearch(Object searchCriteria)

createWidgetContent

public JComponent createWidgetContent()

Specified by:
createWidgetContent in class AbstractTitledWidget

createDataEditorWidget

protected final JComponent createDataEditorWidget()

getTableResizeWeight

protected double getTableResizeWeight()

getCommands

public List<AbstractCommand> getCommands()
Returns a list of commands for this widget.

Specified by:
getCommands in interface Widget
Overrides:
getCommands in class AbstractWidget

getDetailPanel

protected JComponent getDetailPanel()

getEditButtons

protected JComponent getEditButtons()

getCommitComponent

protected JComponent getCommitComponent()

getCommitCommand

protected ActionCommand getCommitCommand()
Convenience method to retrieve the action command that should be used when changes are made in the detailForm. This can be update or add, according to whether a row is selected and changed or no row is selected.

Returns:
the command that should be used to save changes in the form.

getUpdateCommand

public ActionCommand getUpdateCommand()
Returns the save command, lazily creates one if needed.


createUpdateCommand

protected ActionCommand createUpdateCommand()
Creates the save command.

See Also:
doUpdate()

doUpdate

protected void doUpdate()
Save the changes made in the detailForm according to following steps:

  1. commit form
  2. formObject sent to back-end
  3. changes are handled in back-end
  4. changed object is returned to client
  5. old object is replaced by changed object


getCreateCommand

public ActionCommand getCreateCommand()
Returns the create command, lazily creates one if needed.


createCreateCommand

protected ActionCommand createCreateCommand()
Creates the create command.

See Also:
doCreate()

doCreate

protected void doCreate()
Creates a new data object according to following steps:

  1. form commit
  2. formObject sent to back-end
  3. back-end creates item
  4. back-end returns new item to client
  5. new item is selected in dataEditor if possible


getRevertCommand

protected AbstractCommand getRevertCommand()

getValidationResults

protected abstract DefaultValidationResultsModel getValidationResults()

newSingleLineResultsReporter

public ValidationResultsReporter newSingleLineResultsReporter(Messagable messagable)

Specified by:
newSingleLineResultsReporter in interface TitledWidget
Overrides:
newSingleLineResultsReporter in class AbstractTitledWidget

createQuickAddCheckBox

protected JComponent createQuickAddCheckBox()

getTableFilterPanel

protected JComponent getTableFilterPanel()

getTablePopupMenuCommandGroup

protected CommandGroup getTablePopupMenuCommandGroup()
Returns the commandGroup that should be used to create the popup menu for the table.


getTableFilterControlCommands

protected CommandGroup getTableFilterControlCommands()

onRowSelection

protected void onRowSelection(Object rowObject)

newRow

protected void newRow(Object newClone)

removeRows

protected void removeRows()

getToggleDetailCommand

public AbstractCommand getToggleDetailCommand()

getToggleFilterCommand

public SplitPaneExpansionToggleCommand getToggleFilterCommand()

getAddRowCommand

protected ActionCommand getAddRowCommand()

createAddRowCommand

protected ActionCommand createAddRowCommand()

getEditRowCommand

protected ActionCommand getEditRowCommand()

createEditRowCommand

protected ActionCommand createEditRowCommand()

getCloneRowCommand

protected ActionCommand getCloneRowCommand()

createCloneRowCommand

protected ActionCommand createCloneRowCommand()

getRemoveRowsCommand

protected ActionCommand getRemoveRowsCommand()

createRemoveRowCommand

protected ActionCommand createRemoveRowCommand()

getRefreshCommand

public ActionCommand getRefreshCommand()

getCopySelectedRowsToClipboardCommand

public ActionCommand getCopySelectedRowsToClipboardCommand()

createRefreshCommand

protected ActionCommand createRefreshCommand()

getClearFilterCommand

public ActionCommand getClearFilterCommand()

createClearFilterCommand

protected ActionCommand createClearFilterCommand()

getExecuteFilterCommand

public ActionCommand getExecuteFilterCommand()

createExecuteFilterCommand

protected ActionCommand createExecuteFilterCommand()

getEmptyFilterCommand

protected ActionCommand getEmptyFilterCommand()

createEmptyFilterCommand

protected ActionCommand createEmptyFilterCommand()

getHelpCommand

protected AbstractCommand getHelpCommand()

getFilterCriteria

protected Object[] getFilterCriteria()

getSelectCommand

protected ActionCommand getSelectCommand()

getControlCommands

protected AbstractCommand[] getControlCommands()

isFilterSupported

protected abstract boolean isFilterSupported()

isUpdateRowSupported

protected abstract boolean isUpdateRowSupported()

isAddRowSupported

protected abstract boolean isAddRowSupported()

isCloneRowSupported

protected abstract boolean isCloneRowSupported()

isRemoveRowsSupported

protected abstract boolean isRemoveRowsSupported()

getFilterForm

protected abstract FilterForm getFilterForm()

getDetailForm

public abstract AbstractForm getDetailForm()

createDetailWidget

public abstract Widget createDetailWidget()

getTableWidget

public abstract TableWidget getTableWidget()

executeFilter

protected abstract void executeFilter()

executeFilter

public abstract void executeFilter(Map<String,Object> parameters)

loadEntityDetails

protected final Object loadEntityDetails(Object baseObject)

loadEntityDetails

protected abstract Object loadEntityDetails(Object baseObject,
                                            boolean forceLoad)
Fetch the detailed object from the back-end. If the baseObject is already detailed, the baseObject can be returned directly if and only if no forceLoad is requested. This logic is also apparent in the DataProvider class.

Parameters:
baseObject - object containing enough information to fetch a detailed version.
forceLoad - if true always load the detailed object from the back-end, if false a shortcut can be implemented by returning the baseObject directly.
Returns:
the detailed object

saveEntity

protected abstract Object saveEntity(Object committedObject)

createNewEntity

protected abstract Object createNewEntity(Object committedObject)

cloneEntity

protected abstract Object cloneEntity(Object sampleObject)

removeEntity

protected abstract void removeEntity(Object objectToRemove)

canClose

public boolean canClose()
Description copied from class: AbstractWidget
Checks whether this component can be closed visually, for example when there are no unsaved changes. Default: Widget can be closed.

Specified by:
canClose in interface Widget
Overrides:
canClose in class AbstractWidget
Returns:
true if the widget can be closed without problems.

replaceRowObject

protected void replaceRowObject(Object oldRowObject,
                                Object newRowObject)

setDataProviderEventSources

public final void setDataProviderEventSources(List dataProviderEventSources)

addDataProviderListener

public final void addDataProviderListener(Class dataProviderEventSource,
                                          DataProviderListener listener)

removeDataProviderListener

public final void removeDataProviderListener(Class dataProviderEventSource,
                                             DataProviderListener listener)

getSelection

public Object getSelection()
Specified by:
getSelection in interface SelectionWidget
Returns:
The selected object(s)

setSelectionCommand

public void setSelectionCommand(ActionCommand command)
Description copied from interface: SelectionWidget
Command called to set the selection for the widget. I.e. a double-click listener on the table that selects the current selected row and closes the view to the table.sluiten

Specified by:
setSelectionCommand in interface SelectionWidget

setMultipleSelectionInSelectMode

public void setMultipleSelectionInSelectMode(boolean multipleSelection)

removeSelectionCommand

public void removeSelectionCommand()
Specified by:
removeSelectionCommand in interface SelectionWidget


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