com.pietschy.command
Class AbstractReflectionIconFactory

java.lang.Object
  extended by com.pietschy.command.AbstractReflectionIconFactory
All Implemented Interfaces:
IconFactory

public abstract class AbstractReflectionIconFactory
extends java.lang.Object
implements IconFactory

Provides a base implementation of IconFactory that translates icon strings in the configuration files to method calls. Subclasses must implement a method for every method type specified by the configuration files.

For example, a configuration of:

   command@face.icon=factory:createColoredIcon(200,127,127)
will result in a reflective call to the method:
   public Icon createColoredIcon(String s1, String s2, String s3)
on the implemetation of this class.

See Also:
Defaults.setIconFactory(com.pietschy.command.configuration.IconFactory)

Constructor Summary
AbstractReflectionIconFactory()
           
 
Method Summary
 javax.swing.Icon createIcon(java.lang.String iconValue)
          Interprest the specified iconValue as a method call to be invoked on this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractReflectionIconFactory

public AbstractReflectionIconFactory()
Method Detail

createIcon

public javax.swing.Icon createIcon(java.lang.String iconValue)
                            throws java.lang.Exception
Interprest the specified iconValue as a method call to be invoked on this class.

For example, a configuration of

   command@face.icon=factory:createColoredIcon(200,127,127)
will result in a reflective call to the method
   public Icon createColoredIcon(String s1, String s2, String s3)
on the subclass.

Specified by:
createIcon in interface IconFactory
Parameters:
iconValue - the icon text specified in the configuration file which will be interpreted as a method call on the subclass.
Returns:
an Icon created by the method specified in iconValue.
Throws:
java.lang.Exception - if the subclass throws and exception, or if there is an error invoking the method.


Copyright © 2006 - 2007 Andrew Pietsch