org.springframework.richclient.form
Class AbstractTableMasterForm

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.AbstractMasterForm
                  extended by org.springframework.richclient.form.AbstractTableMasterForm
All Implemented Interfaces:
CommitListener, ControlFactory, Form

public abstract class AbstractTableMasterForm
extends AbstractMasterForm

This is an abstract implementation of AbstractMasterForm that uses a GlazedTableModel and JTable to represent the master information.

Derived types must implement:

getColumnPropertyNames()
To specify the properties for the table columns
AbstractMasterForm.createDetailForm(org.springframework.binding.form.HierarchicalFormModel, org.springframework.binding.value.ValueModel, org.springframework.binding.value.support.ObservableList)
To construct the detail half of this master/detail form pair

Author:
Larry Streepy

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.richclient.form.AbstractMasterForm
AbstractMasterForm.ListSelectionHandler
 
Field Summary
 
Fields inherited from class org.springframework.richclient.form.AbstractMasterForm
IS_CREATING_PROPERTY, SELECTION_INDEX_PROPERTY
 
Fields inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor
logger
 
Constructor Summary
AbstractTableMasterForm(HierarchicalFormModel parentFormModel, String property, String formId, Class detailType)
          Construct a new AbstractTableMasterForm using the given parent form model and property path.
 
Method Summary
protected  JComponent createFormControl()
           
protected  JTable createTable(TableModel tableModel)
          Create the master table.
protected  TableModel createTableModel()
          Create the table model for the master table.
 void creatingNewObject()
          Indicates that we are creating a new detail object.
protected abstract  String[] getColumnPropertyNames()
          Get the property names to show in columns of the master table.
protected  ca.odell.glazedlists.EventList getEventList()
           
 ca.odell.glazedlists.matchers.Matcher getFilterMatcher()
          Get the Matcher to be used in filtering the elements of the master set.
 ca.odell.glazedlists.matchers.MatcherEditor getFilterMatcherEditor()
          Get the MatcherEditor to be used in filtering the elements of the master set.
protected  JTable getMasterTable()
           
protected  TableModel getMasterTableModel()
           
protected  Dimension getMasterTablePreferredSize(Dimension currentSize)
          Get the preferred size of the master table.
protected  ListSelectionModel getSelectionModel()
          Get the selection model for the master list representation.
 Comparator getSortComparator()
          Get the comparator to use for sorting the table.
protected  void setEventList(ca.odell.glazedlists.EventList list)
           
 void setFilterMatcher(ca.odell.glazedlists.matchers.Matcher matcher)
          Set the Matcher to be used in filtering the elements of the master set.
 void setFilterMatcherEditor(ca.odell.glazedlists.matchers.MatcherEditor matcherEditor)
          Set the MatcherEditor to be used in filtering the elements of the master set.
 void setSortComparator(Comparator comparator)
          Set the comparator to use for sorting the table.
 void setSortProperty(String propertyName)
          Set the name of the property on which to compare for sorting elements in the master table.
 
Methods inherited from class org.springframework.richclient.form.AbstractMasterForm
configure, createButtonBar, createDeleteButton, createDeleteCommand, createDetailForm, createNewFormObjectCommand, deleteSelectedItems, getCollectionValueModel, getCommandGroup, getConfirmDeleteMessage, getDeleteCommand, getDeleteCommandId, getDetailForm, getDetailFormModel, getDetailType, getFormData, getMasterCollectionType, getMasterEventList, getNewFormObjectCommand, getNewFormObjectCommandId, getPopupMenu, getRootEventList, getSelectionHandler, handleExternalRootEventListChange, installEventList, installSelectionHandler, isConfirmDelete, maybeCreateNewObject, maybeDeleteSelectedItems, newSingleLineResultsReporter, setConfirmDelete, setDetailForm, setDetailType, uninstallSelectionHandler, updateControlsForState
 
Methods inherited from class org.springframework.richclient.form.AbstractForm
addChildForm, addFormObjectChangeListener, addFormValueChangeListener, addGuarded, addGuarded, addValidationListener, addValidationResultsReporter, attachFormErrorGuard, attachFormGuard, commit, constructSecurityControllerId, createCommitButton, createControl, createNewFormObjectButton, createNewObject, detachFormGuard, getBindingFactory, getChildForm, getCommitCommand, getCommitCommandFaceDescriptorId, getCommitSecurityControllerId, getDefaultButton, getEditableFormObject, getEditingFormObjectIndex, getFormModel, getFormObject, getId, getNewFormObjectSecurityControllerId, getParent, getRevertCommand, getRevertCommandFaceDescriptorId, getValidationResultsReporters, getValue, getValueModel, handleEnabledChange, hasErrors, init, isDirty, isEditingNewFormObject, isEnabled, postCommit, 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
 

Constructor Detail

AbstractTableMasterForm

public AbstractTableMasterForm(HierarchicalFormModel parentFormModel,
                               String property,
                               String formId,
                               Class detailType)
Construct a new AbstractTableMasterForm using the given parent form model and property path. The form model for this class will be constructed by getting the value model of the specified property from the parent form model and constructing a DeepCopyBufferedCollectionValueModel on top of it. Unless AbstractMasterForm#getListListModel() has been overriden, the table will contain all the elements in the domain object referenced by property.

Parameters:
parentFormModel - Parent form model to access for this form's data
property - Property containing this forms data (must be a collection or an array)
formId - Id of this form
detailType - Type of detail object managed by this master form
Method Detail

setFilterMatcher

public void setFilterMatcher(ca.odell.glazedlists.matchers.Matcher matcher)
Set the Matcher to be used in filtering the elements of the master set. Note that only one of a Matcher or MatcherEditor may be used, not both. If both are specified, then the Matcher will take precedence.

Parameters:
matcher - The Matcher to use to filter elements in the master set.

getFilterMatcher

public ca.odell.glazedlists.matchers.Matcher getFilterMatcher()
Get the Matcher to be used in filtering the elements of the master set.

Returns:
matcher

setFilterMatcherEditor

public void setFilterMatcherEditor(ca.odell.glazedlists.matchers.MatcherEditor matcherEditor)
Set the MatcherEditor to be used in filtering the elements of the master set. Note that only one of a Matcher or MatcherEditor may be used, not both. If both are specified, then the Matcher will take precedence.

Parameters:
matcherEditor - The MatcherEditor to use to filter elements in the master set.

getFilterMatcherEditor

public ca.odell.glazedlists.matchers.MatcherEditor getFilterMatcherEditor()
Get the MatcherEditor to be used in filtering the elements of the master set.

Returns:
matcherEditor

setSortComparator

public void setSortComparator(Comparator comparator)
Set the comparator to use for sorting the table.

Parameters:
comparator - to use for sorting the table

getSortComparator

public Comparator getSortComparator()
Get the comparator to use for sorting the table.

Returns:
comparator to use for sorting the table

setSortProperty

public void setSortProperty(String propertyName)
Set the name of the property on which to compare for sorting elements in the master table.

Parameters:
propertyName - Name of the property on which to sort.

createFormControl

protected JComponent createFormControl()
Specified by:
createFormControl in class AbstractForm

createTable

protected JTable createTable(TableModel tableModel)
Create the master table.

Parameters:
tableModel - to use in the table
Returns:
table, default implementation uses the component factory to create the table

createTableModel

protected TableModel createTableModel()
Create the table model for the master table.

Returns:
table model to install

getMasterTablePreferredSize

protected Dimension getMasterTablePreferredSize(Dimension currentSize)
Get the preferred size of the master table. The current (requested) size is provided for reference. This default implementation just returns the provided current size.

Parameters:
currentSize - Current (requested) preferred size of the master table
Returns:
preferred size

getSelectionModel

protected ListSelectionModel getSelectionModel()
Get the selection model for the master list representation.

Specified by:
getSelectionModel in class AbstractMasterForm
Returns:
selection model or null if master table has not been constructed yet

getColumnPropertyNames

protected abstract String[] getColumnPropertyNames()
Get the property names to show in columns of the master table.

Returns:
String[] array of property names

creatingNewObject

public void creatingNewObject()
Indicates that we are creating a new detail object.

Overrides:
creatingNewObject in class AbstractMasterForm

getEventList

protected ca.odell.glazedlists.EventList getEventList()
Returns:
Returns the eventList.

setEventList

protected void setEventList(ca.odell.glazedlists.EventList list)
Parameters:
list - The eventList to set.

getMasterTable

protected JTable getMasterTable()
Returns:
Returns the masterTable.

getMasterTableModel

protected TableModel getMasterTableModel()
Returns:
Returns the masterTableModel.


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