de.kleopatra.view.factory
Class DefaultComponentTypeMap

java.lang.Object
  extended byde.kleopatra.view.factory.DefaultComponentTypeMap
All Implemented Interfaces:
ComponentTypeMap
Direct Known Subclasses:
SwingComponentTypeMap

public class DefaultComponentTypeMap
extends java.lang.Object
implements ComponentTypeMap

Default implementation.

Handles storage of classnames/classes, delegates classloading to ResourceManager, instantiates comps, provides hook for custom factories.

NOTE: the custom hook is processed after looking for a mapped class. This guarantees that type mappings added at runtime take precedence over hardcoded lookups.

Version:
$Revision: 1.1.1.1 $ - $Date: 2004/06/22 12:32:37 $
Author:
(C) Jeanette Winzenburg, Berlin

Field Summary
protected  java.util.Map componentMap
           
protected  java.util.Map containerMap
           
protected static java.util.logging.Logger LOGGER
           
protected  java.util.Set scrollableTypes
           
 
Constructor Summary
DefaultComponentTypeMap()
           
 
Method Summary
 void addComponentType(java.lang.Object componentType, java.lang.Class clazz)
           
 void addComponentType(java.lang.Object componentType, java.lang.String className)
           
 void addContainerType(java.lang.Object componentType, java.lang.Class clazz)
           
 void addContainerType(java.lang.Object containerType, java.lang.String className)
           
 void addScrollableType(java.lang.Object scrollableType)
           
protected  java.util.Map createMap()
           
protected  java.util.Set createSet()
           
protected  java.lang.Object factoryHook(java.lang.Object componentType)
          hook for subclasses to use custom component factories.
protected  java.lang.Class getClass(java.lang.Object componentType)
          returns a class for a given componentTyp null if not found or error.
protected  java.lang.Class getClassForEntry(java.lang.Object classEntry)
           
 java.lang.Object getComponentInstance(java.lang.Object componentType)
          returns an instance of a component as appropriate for the generic type componentType.
protected  java.util.Map getComponentMap()
           
 java.lang.Object getComponentType(java.lang.Class clazz)
          returns an identifier for the given class or null if not found.
 java.util.Set getComponentTypes()
          returns a Collection of all generic component types.
protected  java.util.Map getContainerMap()
           
 java.util.Set getContainerTypes()
          returns a Collection of all generic container types.
protected  java.util.Collection getScrollableTypes()
           
 boolean shouldScroll(java.lang.Object componentType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

componentMap

protected java.util.Map componentMap

containerMap

protected java.util.Map containerMap

scrollableTypes

protected java.util.Set scrollableTypes

LOGGER

protected static final java.util.logging.Logger LOGGER
Constructor Detail

DefaultComponentTypeMap

public DefaultComponentTypeMap()
Method Detail

addComponentType

public void addComponentType(java.lang.Object componentType,
                             java.lang.String className)
Specified by:
addComponentType in interface ComponentTypeMap

addContainerType

public void addContainerType(java.lang.Object containerType,
                             java.lang.String className)
Specified by:
addContainerType in interface ComponentTypeMap

addScrollableType

public void addScrollableType(java.lang.Object scrollableType)
Specified by:
addScrollableType in interface ComponentTypeMap

shouldScroll

public boolean shouldScroll(java.lang.Object componentType)
Specified by:
shouldScroll in interface ComponentTypeMap

addComponentType

public void addComponentType(java.lang.Object componentType,
                             java.lang.Class clazz)
Specified by:
addComponentType in interface ComponentTypeMap

addContainerType

public void addContainerType(java.lang.Object componentType,
                             java.lang.Class clazz)
Specified by:
addContainerType in interface ComponentTypeMap

getComponentInstance

public java.lang.Object getComponentInstance(java.lang.Object componentType)
returns an instance of a component as appropriate for the generic type componentType.

Implementation note: guarantees to first check the registered class mapping before trying to use thefactoryHook

Specified by:
getComponentInstance in interface ComponentTypeMap

getComponentTypes

public java.util.Set getComponentTypes()
Description copied from interface: ComponentTypeMap
returns a Collection of all generic component types.

Specified by:
getComponentTypes in interface ComponentTypeMap

getContainerTypes

public java.util.Set getContainerTypes()
Description copied from interface: ComponentTypeMap
returns a Collection of all generic container types.

Specified by:
getContainerTypes in interface ComponentTypeMap

getComponentType

public java.lang.Object getComponentType(java.lang.Class clazz)
returns an identifier for the given class or null if not found. used by life form readers. PENDING: does not yet cope with classes mapped directly (as opposed to mapped via className)

Specified by:
getComponentType in interface ComponentTypeMap

getClass

protected java.lang.Class getClass(java.lang.Object componentType)
returns a class for a given componentTyp null if not found or error. used by UIBuilder.


getClassForEntry

protected java.lang.Class getClassForEntry(java.lang.Object classEntry)
                                    throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

factoryHook

protected java.lang.Object factoryHook(java.lang.Object componentType)
hook for subclasses to use custom component factories. Should return a component instance for the generic type or null. here: returns null;


getComponentMap

protected java.util.Map getComponentMap()

getContainerMap

protected java.util.Map getContainerMap()

createMap

protected java.util.Map createMap()

getScrollableTypes

protected java.util.Collection getScrollableTypes()

createSet

protected java.util.Set createSet()


Copyright © 2003, 2004 SwingEmpire Jeanette Winzenburg. All Rights Reserved.