org.springframework.richclient.form.binding.swing
Class SwingBindingFactory

java.lang.Object
  extended by org.springframework.richclient.form.binding.support.AbstractBindingFactory
      extended by org.springframework.richclient.form.binding.swing.SwingBindingFactory
All Implemented Interfaces:
BindingFactory
Direct Known Subclasses:
SandboxSwingBindingFactory

public class SwingBindingFactory
extends AbstractBindingFactory

A convenient implementation of BindingFactory. Provides a set of methods that address the typical binding requirements of Swing based forms.

Author:
Oliver Hutchison

Nested Class Summary
protected static class SwingBindingFactory.BeanPropertyEditorClosure
           
 
Constructor Summary
SwingBindingFactory(FormModel formModel)
           
 
Method Summary
 Binding createBoundCheckBox(String formProperty)
           
 Binding createBoundComboBox(String formProperty)
           
 Binding createBoundComboBox(String formProperty, Object selectableItems)
           
 Binding createBoundComboBox(String formProperty, Object selectableItems, String renderedProperty)
           
 Binding createBoundComboBox(String formProperty, String selectableItemsProperty, String renderedItemProperty)
           
 Binding createBoundComboBox(String formProperty, ValueModel selectableItemsHolder)
           
 Binding createBoundComboBox(String formProperty, ValueModel selectableItemsHolder, String renderedProperty)
           
 Binding createBoundFormattedTextField(String formProperty)
           
 Binding createBoundFormattedTextField(String formProperty, JFormattedTextField.AbstractFormatterFactory formatterFactory)
           
 Binding createBoundLabel(String formProperty)
           
 Binding createBoundList(String formProperty)
           
 Binding createBoundList(String selectionFormProperty, Object selectableItems)
          Binds the values specified in the collection contained within selectableItems to a JList, with any user selection being placed in the form property referred to by selectionFormProperty.
 Binding createBoundList(String selectionFormProperty, Object selectableItems, String renderedProperty)
           
 Binding createBoundList(String selectionFormProperty, Object selectableItems, String renderedProperty, Integer forceSelectMode)
          Binds the value(s) specified in selectableItems to a JList, with any user selection being placed in the form property referred to by selectionFormProperty.
 Binding createBoundList(String selectionFormProperty, ValueModel selectableItemsHolder)
          Binds the values specified in the collection contained within selectableItemsHolder to a JList, with any user selection being placed in the form property referred to by selectionFormProperty.
 Binding createBoundList(String selectionFormProperty, ValueModel selectableItemsHolder, String renderedProperty)
          Binds the values specified in the collection contained within selectableItemsHolder to a JList, with any user selection being placed in the form property referred to by selectionFormProperty.
 ObservableList createBoundListModel(String formProperty)
          Deprecated.  
 Binding createBoundSpinner(String formProperty)
           
 Binding createBoundTextArea(String formProperty)
           
 Binding createBoundTextArea(String formProperty, int rows, int columns)
           
 Binding createBoundTextField(String formProperty)
           
 Binding createBoundToggleButton(String formProperty)
           
 
Methods inherited from class org.springframework.richclient.form.binding.support.AbstractBindingFactory
bindControl, bindControl, createBinding, createBinding, createBinding, createBinding, createContext, getBinderSelectionStrategy, getFormModel, interceptBinding, setBinderSelectionStrategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingBindingFactory

public SwingBindingFactory(FormModel formModel)
Method Detail

createBoundTextField

public Binding createBoundTextField(String formProperty)

createBoundTextArea

public Binding createBoundTextArea(String formProperty)

createBoundTextArea

public Binding createBoundTextArea(String formProperty,
                                   int rows,
                                   int columns)

createBoundFormattedTextField

public Binding createBoundFormattedTextField(String formProperty)

createBoundFormattedTextField

public Binding createBoundFormattedTextField(String formProperty,
                                             JFormattedTextField.AbstractFormatterFactory formatterFactory)

createBoundSpinner

public Binding createBoundSpinner(String formProperty)

createBoundLabel

public Binding createBoundLabel(String formProperty)

createBoundToggleButton

public Binding createBoundToggleButton(String formProperty)

createBoundCheckBox

public Binding createBoundCheckBox(String formProperty)

createBoundComboBox

public Binding createBoundComboBox(String formProperty)

createBoundComboBox

public Binding createBoundComboBox(String formProperty,
                                   Object selectableItems)
Parameters:
formProperty - the property to be bound
selectableItems - a Collection or array containing the list of items that may be selected

createBoundComboBox

public Binding createBoundComboBox(String formProperty,
                                   ValueModel selectableItemsHolder)

createBoundComboBox

public Binding createBoundComboBox(String formProperty,
                                   String selectableItemsProperty,
                                   String renderedItemProperty)

createBoundComboBox

public Binding createBoundComboBox(String formProperty,
                                   Object selectableItems,
                                   String renderedProperty)

createBoundComboBox

public Binding createBoundComboBox(String formProperty,
                                   ValueModel selectableItemsHolder,
                                   String renderedProperty)

createBoundListModel

public ObservableList createBoundListModel(String formProperty)
Deprecated. 

This method will most likely move over to FormModel


createBoundList

public Binding createBoundList(String formProperty)

createBoundList

public Binding createBoundList(String selectionFormProperty,
                               Object selectableItems)
Binds the values specified in the collection contained within selectableItems to a JList, with any user selection being placed in the form property referred to by selectionFormProperty. Each item in the list will be rendered as a String. 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. This method uses default behavior to determine the selection mode of the resulting JList: if selectionFormProperty refers to a Collection type property, then ListSelectionModel.MULTIPLE_INTERVAL_SELECTION will be used, otherwise ListSelectionModel.SINGLE_SELECTION will be used.

Parameters:
selectionFormProperty - form property to hold user's selection. This property must either be compatible with the item objects contained in selectableItemsHolder (in which case only single selection makes sense), or must be a Collection type, which allows for multiple selection.
selectableItems - a Collection or array containing the items with which to populate the list.
Returns:

createBoundList

public Binding createBoundList(String selectionFormProperty,
                               Object selectableItems,
                               String renderedProperty)

createBoundList

public Binding createBoundList(String selectionFormProperty,
                               ValueModel selectableItemsHolder,
                               String renderedProperty)
Binds the values specified in the collection contained within selectableItemsHolder to a JList, 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. This method uses default behavior to determine the selection mode of the resulting JList: if selectionFormProperty refers to a Collection type property, then ListSelectionModel.MULTIPLE_INTERVAL_SELECTION will be used, otherwise ListSelectionModel.SINGLE_SELECTION will be used.

Parameters:
selectionFormProperty - form property to hold user's selection. This property must either be compatible with the item objects contained in selectableItemsHolder (in which case only single selection makes sense), or must be a Collection type, which allows for multiple selection.
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
Returns:

createBoundList

public Binding createBoundList(String selectionFormProperty,
                               ValueModel selectableItemsHolder)
Binds the values specified in the collection contained within selectableItemsHolder to a JList, with any user selection being placed in the form property referred to by selectionFormProperty. Each item in the list will be rendered as a String. 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. This method uses default behavior to determine the selection mode of the resulting JList: if selectionFormProperty refers to a Collection type property, then ListSelectionModel.MULTIPLE_INTERVAL_SELECTION will be used, otherwise ListSelectionModel.SINGLE_SELECTION will be used.

Parameters:
selectionFormProperty - form property to hold user's selection. This property must either be compatible with the item objects contained in selectableItemsHolder (in which case only single selection makes sense), or must be a Collection type, which allows for multiple selection.
selectableItemsHolder - ValueModel containing the items with which to populate the list.
Returns:

createBoundList

public Binding createBoundList(String selectionFormProperty,
                               Object selectableItems,
                               String renderedProperty,
                               Integer forceSelectMode)
Binds the value(s) specified in selectableItems to a JList, 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.

Parameters:
selectionFormProperty - form property to hold user's selection. This property must either be compatible with the item objects contained in selectableItemsHolder (in which case only single selection makes sense), or must be a Collection type, which allows for multiple selection.
selectableItems - Object containing the item(s) with which to populate the list. Can be an instance Collection, Object[], a ValueModel or Object
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.
forceSelectMode - forces the list selection mode. Must be one of the constants defined in ListSelectionModel or null for default behavior. If null, then ListSelectionModel.MULTIPLE_INTERVAL_SELECTION will be used if selectionFormProperty refers to a Collection type property, otherwise ListSelectionModel.SINGLE_SELECTION will be used.
Returns:


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