org.jdesktop.binding.swingx
Class BindingFactory

java.lang.Object
  extended by org.jdesktop.binding.swingx.BindingFactory
Direct Known Subclasses:
ExtBindingFactory

public class BindingFactory
extends java.lang.Object

Choosing strategy for creating Bindings.

Extracted from DefaultFormFactory to have a "pluggable" place for creating custom bindings. The usage of a BindingCreator should be viewed as an implementation detail, they don't do much. PENDING: there's a implicit coupling to ComponentMap - the BindingMap assumes that the ComponentMap did a good enough job when choosing components.

PENDING: should be factored into an interface and a default implementation.

PENDING: really want to configure the component here?

Author:
Jeanette Winzenburg

Nested Class Summary
static class BindingFactory.CheckBoxBindingCreator
           
static class BindingFactory.ComboBoxBindingCreator
           
static class BindingFactory.DatePickerBindingCreator
           
static class BindingFactory.HyperlinkBindingCreator
           
static class BindingFactory.ImagePanelBindingCreator
           
static class BindingFactory.LabelBindingCreator
           
 class BindingFactory.LabelMetaBindingCreator
          BindingCreator for binding a label to the metaData of the given field.
static class BindingFactory.ListBindingCreator
           
static class BindingFactory.RadioGroupBindingCreator
           
static class BindingFactory.RequiredBindingCreator
           
static class BindingFactory.SpinnerBindingCreator
           
 class BindingFactory.TableBindingCreator
           
static class BindingFactory.TextBindingCreator
           
 
Constructor Summary
BindingFactory()
           
 
Method Summary
 Binding createBinding(javax.swing.JComponent component, DataModel model, java.lang.String fieldName)
          Creates and returns Binding between the component and a field of the DataModel.
 Binding createMetaBinding(javax.swing.JLabel label, DataModel model, java.lang.String fieldName)
          Creates and returns Binding between the component and the metaData of a field of the DataModel.
protected  BindingCreator findByAssignable(java.lang.Class componentClass)
           
protected  BindingCreator getBindingCreator(javax.swing.JComponent component)
          encapsulates lookup strategy to find an appropriate BindingCreator for the given component.
protected  java.util.Map getBindingMap()
           
static BindingFactory getInstance()
           
protected  BindingCreator getMetaBindingCreator()
          returns the unique BindingCreator for binding (a label) to the metaData - typically to the label property.
protected  void initBindingMap(java.util.Map map)
           
static void setInstance(BindingFactory bindingMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BindingFactory

public BindingFactory()
Method Detail

getInstance

public static BindingFactory getInstance()

setInstance

public static void setInstance(BindingFactory bindingMap)

createBinding

public Binding createBinding(javax.swing.JComponent component,
                             DataModel model,
                             java.lang.String fieldName)
Creates and returns Binding between the component and a field of the DataModel. PENDING: null return value? Or better throw BindingException if no appropriate creator found?

Parameters:
component -
model -
fieldName -
Returns:
Throws:
java.lang.NullPointerException - if any of the parameters is null.

createMetaBinding

public Binding createMetaBinding(javax.swing.JLabel label,
                                 DataModel model,
                                 java.lang.String fieldName)
Creates and returns Binding between the component and the metaData of a field of the DataModel. Typically this is used to bind a label to the label property of the field's metaData. PENDING: null return value? Or better throw BindingException if no appropriate creator found?

Parameters:
component -
model -
fieldName -
Returns:
Throws:
java.lang.NullPointerException - if any of the parameters is null.

getMetaBindingCreator

protected BindingCreator getMetaBindingCreator()
returns the unique BindingCreator for binding (a label) to the metaData - typically to the label property.

Returns:

getBindingCreator

protected BindingCreator getBindingCreator(javax.swing.JComponent component)
encapsulates lookup strategy to find an appropriate BindingCreator for the given component.

Here:

  1. look-up by component class
  2. look-up by assignables to component class

Parameters:
component -
Returns:
a BindingCreator which can create a binding to the component or null if none is found.

findByAssignable

protected BindingCreator findByAssignable(java.lang.Class componentClass)

getBindingMap

protected java.util.Map getBindingMap()

initBindingMap

protected void initBindingMap(java.util.Map map)


Copyright © 2005 Sun Microsystems All Rights Reserved.