dsto.dfc.swing.icons
Class IconicRegistry

java.lang.Object
  extended by dsto.dfc.swing.icons.IconicRegistry

public class IconicRegistry
extends Object

A registry mapping class types to their IconicFactory's.

Version:
$Revision$
Author:
Matthew Phillips

Field Summary
protected  HashMap factories
           
 
Constructor Summary
IconicRegistry()
           
 
Method Summary
 IconicFactory get(Class type)
          Get the factory for a given type.
 IconicFactory get(Object value)
          Get the factory for a given value.
 Iconic getIconicValue(Object value)
          Get an Iconic value.
static IconicRegistry getInstance()
          The default shared instance.
 void register(Class type, Iconic iconic)
          Register an iconic value that applies to all instances of a given type.
 void register(Class type, IconicFactory factory)
          Register a factory for a given type.
 void register(Class type, String name, Icon icon)
          Register an icon that applies to all instances of a given type.
 void unregister(Class type)
          Remove the registered factory for a given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factories

protected HashMap factories
Constructor Detail

IconicRegistry

public IconicRegistry()
Method Detail

getInstance

public static IconicRegistry getInstance()
The default shared instance.


register

public void register(Class type,
                     String name,
                     Icon icon)
Register an icon that applies to all instances of a given type.

Parameters:
type - The type of value.
icon - The icon to use for all instances of type.
See Also:
register(Class,IconicFactory)

register

public void register(Class type,
                     Iconic iconic)
Register an iconic value that applies to all instances of a given type.

Parameters:
type - The type of value.
iconic - The iconic value to use for all instances of type.
See Also:
register(Class,IconicFactory)

register

public void register(Class type,
                     IconicFactory factory)
Register a factory for a given type.

Parameters:
type - The type. Subclasses of this type are not matched.
factory - The factory for the type. May be null to clear the factory for the type.
See Also:
register(Class, Iconic)

unregister

public void unregister(Class type)
Remove the registered factory for a given type.


get

public IconicFactory get(Object value)
Get the factory for a given value. This is a shortcut to get (Class): only the type of the value is significant

Parameters:
value - The value.
Returns:
The factory, or null if none.

get

public IconicFactory get(Class type)
Get the factory for a given type.

Parameters:
type - The type.
Returns:
The factory, or null if none.

getIconicValue

public Iconic getIconicValue(Object value)
Get an Iconic value. If value if Iconic, this simply returns the value, otherwise an attempt to find a factory is made and the the Iconic value from that is returned.

Parameters:
value - The value.
Returns:
The iconic value, or null if value is not Iconic and no factory is found.


Copyright © 2008 Commonwealth of Australia