chrriis.uihierarchy
Class UIHConfig

java.lang.Object
  extended bychrriis.uihierarchy.UIHConfig

public class UIHConfig
extends Object

The centralized place for UIH configuration. The configuration also retains the information regarding names to components mapping.

Version:
1.0 2003.12.2
Author:
Christopher Deckers (chrriis@brainlex.com)

Method Summary
 Accessor createAccessor(String names)
          Create an accessor for some mapped levels.
 Accessor createAccessor(String names, String excludedNames)
          Create an accessor for some mapped levels, with excluding some.
 ComponentCreator getComponentCreator(Class objectClass)
          Get the component creator associated to an object class.
static UIHConfig getDefault()
          Get the default configuration, which is used when nothing specific was configured for a particular instance.
 LayoutHConstraints getLayoutConstraints(Class layoutClass)
          Get the layout constraints handler associated to a layout class.
 Unit getUnit(String unitName)
          Get the unit that is registered with the given name.
 boolean isAutoRealizing()
          Indicate if the hierarchy auto realizes itself at the last close().
 boolean isSwingPreferred()
          Indicate if Swing is preferred over AWT.
 void registerUnit(Unit unit)
          Register a unit, using the names it defines.
 void registerUnit(Unit unit, String[] names)
          Register a unit, with some names that define it.
 void setAccessorFactory(AccessorFactory accessorFactory)
          Set the accessor factory to use when an accessor needs to be created.
 void setAutoRealizing(boolean isAutoRealizing)
          Set whether the hierarchy will auto realize itself at the last close() or if an explicit call to realize() must be made after the last close().
 void setComponentCreator(Class objectClass, ComponentCreator componentCreator)
          Register a component creator associated to an object class.
 void setDebugger(Debugger debugger)
          Set the debugger to use to debug the hierarchy levels.
 void setLayoutConstraints(Class layoutClass, LayoutHConstraints layoutHConstraints)
          Register a layout constraints handler associated to a layout class.
 void setSwingPreferred(boolean isSwingPreferred)
          Set whether Swing is preferred over AWT for implicit component generation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefault

public static UIHConfig getDefault()
Get the default configuration, which is used when nothing specific was configured for a particular instance. Any change made to this default configuration will affect all the configurations.

Returns:
The default configuration.

isSwingPreferred

public boolean isSwingPreferred()
Indicate if Swing is preferred over AWT.

Returns:
True if Swing is preferred over AWT for component implicit generation.

setSwingPreferred

public void setSwingPreferred(boolean isSwingPreferred)
Set whether Swing is preferred over AWT for implicit component generation. This is true by defaul.

Parameters:
isSwingPreferred - True if Swing should be used when available.

isAutoRealizing

public boolean isAutoRealizing()
Indicate if the hierarchy auto realizes itself at the last close().

Returns:
True if the hierarchy auto realizes itself.

setAutoRealizing

public void setAutoRealizing(boolean isAutoRealizing)
Set whether the hierarchy will auto realize itself at the last close() or if an explicit call to realize() must be made after the last close().

Parameters:
isAutoRealizing - True if the hierarchy is to realize itself automatically.

setLayoutConstraints

public void setLayoutConstraints(Class layoutClass,
                                 LayoutHConstraints layoutHConstraints)
Register a layout constraints handler associated to a layout class.

Parameters:
layoutClass - The layout class for which to set the constraints.
layoutHConstraints - The constraints.

getLayoutConstraints

public LayoutHConstraints getLayoutConstraints(Class layoutClass)
Get the layout constraints handler associated to a layout class.

Parameters:
layoutClass - The layout class for which to set the constraints.
Returns:
The constraints, or null if none are associated.

setComponentCreator

public void setComponentCreator(Class objectClass,
                                ComponentCreator componentCreator)
Register a component creator associated to an object class.

Parameters:
objectClass - The class of the object the creator handles.
componentCreator - The creator of components to associate.

getComponentCreator

public ComponentCreator getComponentCreator(Class objectClass)
Get the component creator associated to an object class.

Parameters:
objectClass - The class of the object the creator handles.
Returns:
The component creator, or null if none is associated.

setAccessorFactory

public void setAccessorFactory(AccessorFactory accessorFactory)
Set the accessor factory to use when an accessor needs to be created.

Parameters:
accessorFactory - The new factory of accessors.

setDebugger

public void setDebugger(Debugger debugger)
Set the debugger to use to debug the hierarchy levels.

Parameters:
debugger - The new debugger.

createAccessor

public Accessor createAccessor(String names)
Create an accessor for some mapped levels. If some levels appear more than once in the mapping, they will be considered only once.
This method uses the accessor factory currently defined, so one can cast the resulting accessor to a more suitable accessor.

Parameters:
names - The names of the hierarchy levels to get, in a comma separated String if more than one name is to be specified.
Returns:
The hierarchy level accessor.
See Also:
AccessorFactory

createAccessor

public Accessor createAccessor(String names,
                               String excludedNames)
Create an accessor for some mapped levels, with excluding some. If several levels appear more than once in the mapping, they will be considered only once.
This method uses the accessor factory currently defined, so one can cast the resulting accessor to a more suitable accessor.

Parameters:
names - The names of the hierarchy levels to get, in a comma separated String if more than one name is to be specified.
excludedNames - The names of the levels to exclude when creating an accessor on the names.
Returns:
The hierarchy level accessor.
See Also:
AccessorFactory

registerUnit

public void registerUnit(Unit unit)
Register a unit, using the names it defines.

Parameters:
unit - The unit to register.

registerUnit

public void registerUnit(Unit unit,
                         String[] names)
Register a unit, with some names that define it.

Parameters:
unit - The unit to register.
names - The names that identify the unit.

getUnit

public Unit getUnit(String unitName)
Get the unit that is registered with the given name.

Parameters:
unitName - The name of the unit to get.
Returns:
The unit or null if it could not be found.