|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.richclient.application.support.ApplicationServicesAccessor
org.springframework.richclient.form.binding.support.AbstractBinder
org.springframework.richclient.form.binding.swing.AbstractListBinder
public abstract class AbstractListBinder
Abstract base class for list bindings.
The property selectableItems
is used as a source of list values. the value of
selectableItems
is converted to ListModel
by using the conversion service
The items of selectableItems
can be filtered by defining a constraint for filter
and
sorted by defining comparator
. Dynamic filtering and sorting is supported if the values of
filter
or comparator
implements Observable
Every value for selectableItems
, filter
and comparator
can be defined
for all created binding instances or by using a context map where the keys SELECTABLE_ITEMS_KEY
,
COMPARATOR_KEY
and FILTER_KEY
can be used for specifying the context dependent values.
If the context values of SELECTABLE_ITEMS_KEY
, COMPARATOR_KEY
and
FILTER_KEY
implement Closure
it will be used to create the instance for the value by passing
the value of selectableItems
, filter
or comparator
as the argument.
Please take into account that the argument for the closure can be null if the property is not set. This feature is
usefull to chain filter constraints.
Subclasses must implement createListBinding(JComponent, FormModel, String)
which creates the instance for
AbstractListBinding
. applyContext(AbstractListBinding, Map)
can be overwritten to apply additional
context values
Field Summary | |
---|---|
static String |
COMPARATOR_KEY
key for defining a context dependent comparator value that is used to sort the elements of selectableItems. |
static String |
FILTER_KEY
key for defining a context dependent filter constraint value that is used to filter the elements of selectableItems. |
static String |
SELECTABLE_ITEMS_KEY
key for defining a context dependent selectableItems value. |
Fields inherited from class org.springframework.richclient.form.binding.support.AbstractBinder |
---|
BINDING_CLIENT_PROPERTY_KEY, log |
Fields inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor |
---|
logger |
Constructor Summary | |
---|---|
AbstractListBinder(Class requiredSourceClass)
Creates a new instance by defining a type for the form fields and using the default context keys SELECTABLE_ITEMS_KEY , COMPARATOR_KEY and FILTER_KEY |
|
AbstractListBinder(Class requiredSourceClass,
String[] supportedContextKeys)
Creates a new instance by defining a type for the form fields and using the given context keys |
Method Summary | |
---|---|
protected void |
applyContext(AbstractListBinding binding,
Map context)
Applies any context or preset value. |
protected abstract AbstractListBinding |
createListBinding(JComponent control,
FormModel formModel,
String formPropertyPath)
Called to create the binding instance |
protected Object |
decorate(Object closure,
Object object)
Decorates an object instance if the closure value is an instance of Closure . |
protected Binding |
doBind(JComponent control,
FormModel formModel,
String formPropertyPath,
Map context)
Creates the binding and applies any context values |
Comparator |
getComparator()
Returns the Comparator which is used for bindings. |
Constraint |
getFilter()
Returns the Constraint which is used as a filter for the selectable items. |
Object |
getSelectableItems()
Returns the selectable items which where used as a source for the selectable items. |
void |
setComparator(Comparator comparator)
Defines the Comparator which is used for bindings. |
void |
setFilter(Constraint filter)
Defines the Constraint which is used as a filter for the selectable items. |
void |
setSelectableItems(Object selectableItems)
Defines the selectable items which where used as a source for the selectable items. |
Methods inherited from class org.springframework.richclient.form.binding.support.AbstractBinder |
---|
bind, bind, createControl, getPropertyType, getRequiredSourceClass, validateContextKeys |
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 |
Field Detail |
---|
public static final String SELECTABLE_ITEMS_KEY
public static final String COMPARATOR_KEY
Comparator
. See class description for more details.
public static final String FILTER_KEY
Constraint
. See class description for more details.
Constructor Detail |
---|
public AbstractListBinder(Class requiredSourceClass)
SELECTABLE_ITEMS_KEY
, COMPARATOR_KEY
and FILTER_KEY
requiredSourceClass
- the type of the form fields to bind, if null form fields can have any typepublic AbstractListBinder(Class requiredSourceClass, String[] supportedContextKeys)
requiredSourceClass
- the type of the form fields to bind, if null form fields can have any typesupportedContextKeys
- the keys which can be defined as context values
NullPointerException
- if supportedContextKeys is nullMethod Detail |
---|
public Comparator getComparator()
Comparator
which is used for bindings. The value can be overwritten with a context value for
COMPARATOR_KEY
public void setComparator(Comparator comparator)
Comparator
which is used for bindings. The value can be overwritten with a context value for
COMPARATOR_KEY
comparator
- the comparator. If null no comparator will be usedpublic Constraint getFilter()
Constraint
which is used as a filter for the selectable items. The value can be overwritten
with a context value for FILTER_KEY
public void setFilter(Constraint filter)
Constraint
which is used as a filter for the selectable items. The value can be overwritten
with a context value for FILTER_KEY
filter
- the filter constraint. If null no filter will be usedpublic Object getSelectableItems()
SELECTABLE_ITEMS_KEY
public void setSelectableItems(Object selectableItems)
SELECTABLE_ITEMS_KEY
selectableItems
- the selectable items. If null no selectable items will be usedprotected final Binding doBind(JComponent control, FormModel formModel, String formPropertyPath, Map context)
doBind
in class AbstractBinder
protected abstract AbstractListBinding createListBinding(JComponent control, FormModel formModel, String formPropertyPath)
control
- the control to bindformModel
- the formmodel with the value of the formPropertyPath
fieldformPropertyPath
- the field path to bind
protected void applyContext(AbstractListBinding binding, Map context)
binding
- the binding to apply the valuescontext
- contains context dependent valuesprotected Object decorate(Object closure, Object object)
closure
value is an instance of Closure
.
closure
- the closure which is used to decorate the object.object
- the value to decorate
closure
implements Closure
, otherwise the value of
object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |