se.datadosen.util
Class PropertyBinder

java.lang.Object
  extended by se.datadosen.util.PropertyBinder

public class PropertyBinder
extends java.lang.Object

Utility class for synchronizing a Swing GUI with a Property object. Synchronization is performed when calling getProperties() and syncUI(). Matching is done where the name of a property corresponds to the name of a GUI element. Currently handles JText components, JCheckBox, JComboBox and JColorSelector
Copyright (c) 2003, David Ekholm Datadosen


Nested Class Summary
static interface PropertyBinder.ComponentBinder
          Add support for other component types
 
Constructor Summary
PropertyBinder()
           
 
Method Summary
static java.util.Properties getProperties(JComponentHolder jComponentHolder)
          Read properties from a UI.
static java.util.Properties getProperties(JComponentHolder jComponentHolder, java.util.Properties existing)
          Read properties from a UI.
static PropertyBinder.ComponentBinder registerComponentBinder(java.lang.Class componentClass, PropertyBinder.ComponentBinder binder)
          Add support for other component types (subclasses of JComponent)
static void syncUI(java.util.Map props, JComponentHolder jComponentHolder)
          Update a UI from a Map object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyBinder

public PropertyBinder()
Method Detail

getProperties

public static java.util.Properties getProperties(JComponentHolder jComponentHolder)
Read properties from a UI.

Parameters:
jComponentHolder - object containing Swing type member variables/components
Returns:
A property object where the keys have the same names as the member components

getProperties

public static java.util.Properties getProperties(JComponentHolder jComponentHolder,
                                                 java.util.Properties existing)
Read properties from a UI.

Parameters:
jComponentHolder - object containing Swing type member variables/components
existing - Properties object to add properties to
Returns:
A property object where the keys have the same names as the member components
Throws:
java.lang.RuntimeException

syncUI

public static void syncUI(java.util.Map props,
                          JComponentHolder jComponentHolder)
Update a UI from a Map object.

Parameters:
props - Properties to pass to UI
jComponentHolder - object containing Swing type member variables/components to be synchronized.
Throws:
java.lang.RuntimeException

registerComponentBinder

public static PropertyBinder.ComponentBinder registerComponentBinder(java.lang.Class componentClass,
                                                                     PropertyBinder.ComponentBinder binder)
Add support for other component types (subclasses of JComponent)

Parameters:
componentClass -
handler -
Returns:
Since:
8.4