|
||||||||||
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.form.binding.support.AbstractBinder
org.springframework.richclient.form.binding.swing.ShuttleListBinder
public class ShuttleListBinder
Binder for handling ShuttleList component. Use the following keys to configure the produced binding:
SELECTABLE_ITEMS_HOLDER_KEY
SELECTED_ITEMS_HOLDER_KEY
SELECTED_ITEM_TYPE_KEY
COMPARATOR_KEY
RENDERER_KEY
ListCellRenderer
for elements of the value
sets. This is typically used if the String value of the elements is not
appropriate for use in the shuttle lists.
FORM_ID
<bean id="binderSelectionStrategy" class="org.springframework.richclient.form.binding.swing.SwingBinderSelectionStrategy"> <property name="bindersForControlTypes"> <map> <entry> <key> <value type="java.lang.Class">org.springframework.richclient.components.ShuttleList</value> </key> <bean class="org.springframework.richclient.components.ShuttleListBinder" /> </entry> </map> </property> </bean>
Also, see SwingBindingFactoryProvider
and
SwingBindingFactoryProvider
for how to configure and use that binding
factory, which offers convenience methods for constructing a bound shuttle
list. With the provider, factory, and binder registered, the following code
can be used to add a bound shuttle list to a form:
final SandboxSwingBindingFactory bf = (SandboxSwingBindingFactory) getBindingFactory(); TableFormBuilder formBuilder = new TableFormBuilder( bf ); ... String[] languages = new String[] { "java", "perl", "ruby", "C#" }; List languagesList = Arrays.asList( languages ); formBuilder.add( bf.createBoundShuttleList( "languageSkills", languagesList ), "align=left" );
Field Summary | |
---|---|
static String |
COMPARATOR_KEY
|
static String |
FORM_ID
|
static String |
MODEL_KEY
|
static String |
RENDERER_KEY
|
static String |
SELECTABLE_ITEMS_HOLDER_KEY
|
static String |
SELECTED_ITEM_TYPE_KEY
|
static String |
SELECTED_ITEMS_HOLDER_KEY
|
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 | |
---|---|
|
ShuttleListBinder()
Constructor. |
protected |
ShuttleListBinder(String[] supportedContextKeys)
Constructor allowing the specification of additional/alternate context keys. |
Method Summary | |
---|---|
protected void |
applyContext(ShuttleListBinding binding,
Map context)
Apply the values from the context to the specified binding. |
static Map |
createBindingContext(FormModel formModel,
String selectionFormProperty,
ValueModel selectableItemsHolder,
String renderedProperty)
Utility method to construct the context map used to configure instances of ShuttleListBinding created by this binder. |
protected JComponent |
createControl(Map context)
|
protected Binding |
doBind(JComponent control,
FormModel formModel,
String formPropertyPath,
Map context)
|
void |
setShowEditButton(boolean showEditButton)
|
Methods inherited from class org.springframework.richclient.form.binding.support.AbstractBinder |
---|
bind, bind, 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_HOLDER_KEY
public static final String SELECTED_ITEMS_HOLDER_KEY
public static final String SELECTED_ITEM_TYPE_KEY
public static final String MODEL_KEY
public static final String FORM_ID
public static final String COMPARATOR_KEY
public static final String RENDERER_KEY
Constructor Detail |
---|
public ShuttleListBinder()
protected ShuttleListBinder(String[] supportedContextKeys)
supportedContextKeys
- Context keys supported by subclassMethod Detail |
---|
public void setShowEditButton(boolean showEditButton)
public static Map createBindingContext(FormModel formModel, String selectionFormProperty, ValueModel selectableItemsHolder, String renderedProperty)
ShuttleListBinding
created by this binder.
Binds the values specified in the collection contained within
selectableItemsHolder
to a ShuttleList
, with any
user selection being placed in the form property referred to by
selectionFormProperty
. Each item in the list will be
rendered by looking up a property on the item by the name contained in
renderedProperty
, retrieving the value of the property,
and rendering that value in the UI.
Note that the selection in the bound list will track any changes to the
selectionFormProperty
. This is especially useful to
preselect items in the list - if selectionFormProperty
is
not empty when the list is bound, then its content will be used for the
initial selection.
selectionFormProperty
- form property to hold user's selection. This
property must be a Collection
or array type.selectableItemsHolder
- ValueModel
containing the
items with which to populate the list.renderedProperty
- the property to be queried for each item in the
list, the result of which will be used to render that item in the
UI. May be null, in which case the selectable items will be
rendered as strings.protected Binding doBind(JComponent control, FormModel formModel, String formPropertyPath, Map context)
doBind
in class AbstractBinder
protected void applyContext(ShuttleListBinding binding, Map context)
binding
- Binding to updatecontext
- Map of context values to apply to the bindingprotected JComponent createControl(Map context)
createControl
in class AbstractBinder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |