org.oddjob.images
Class IconHelper

java.lang.Object
  extended by org.oddjob.images.IconHelper
All Implemented Interfaces:
Iconic

public class IconHelper
extends Object
implements Iconic

Icons for the JobTree. All from Anthony's WWW Images. Java Look and Feel Graphics.

Author:
Rob Gordon

Field Summary
static String ACTIVE
           
static ImageIcon activeIcon
           
static String COMPLETE
           
static ImageIcon completeIcon
           
static String EXCEPTION
           
static ImageIcon exceptionIcon
           
static String EXECUTING
           
static ImageIcon executingIcon
           
static String INITIALIZING
           
static ImageIcon initializingIcon
           
static String INVALID
           
static ImageIcon invalidIcon
           
static String NOT_COMPLETE
           
static ImageIcon notCompleteIcon
           
static String NULL
           
static ImageIcon nullIcon
           
static String READY
           
static ImageIcon readyIcon
           
static String SLEEPING
           
static ImageIcon sleepingIcon
           
static String STARTED
           
static ImageIcon startedIcon
           
static String STOPPED
           
static ImageIcon stoppedIcon
           
static String STOPPING
           
static ImageIcon stoppingIcon
           
 
Constructor Summary
IconHelper(Iconic source, String initialId)
          Constructor with default icon map.
IconHelper(Iconic source, String initialId, Map<String,ImageIcon> iconMap)
          Constructor.
 
Method Summary
 void addIconListener(IconListener listener)
          Add a listener.
 void changeIcon(String iconId)
          Change the icon by firing an iconEvent.
 String currentId()
          Get the current/last icon id.
 ImageIcon iconForId(String iconId)
          Return an ImageIcon for the given id.
 void removeIconListener(IconListener listener)
          Remove a listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final String NULL
See Also:
Constant Field Values

INITIALIZING

public static final String INITIALIZING
See Also:
Constant Field Values

READY

public static final String READY
See Also:
Constant Field Values

EXECUTING

public static final String EXECUTING
See Also:
Constant Field Values

COMPLETE

public static final String COMPLETE
See Also:
Constant Field Values

NOT_COMPLETE

public static final String NOT_COMPLETE
See Also:
Constant Field Values

EXCEPTION

public static final String EXCEPTION
See Also:
Constant Field Values

SLEEPING

public static final String SLEEPING
See Also:
Constant Field Values

STOPPING

public static final String STOPPING
See Also:
Constant Field Values

STOPPED

public static final String STOPPED
See Also:
Constant Field Values

STARTED

public static final String STARTED
See Also:
Constant Field Values

ACTIVE

public static final String ACTIVE
See Also:
Constant Field Values

INVALID

public static final String INVALID
See Also:
Constant Field Values

nullIcon

public static final ImageIcon nullIcon

initializingIcon

public static final ImageIcon initializingIcon

readyIcon

public static final ImageIcon readyIcon

executingIcon

public static final ImageIcon executingIcon

completeIcon

public static final ImageIcon completeIcon

notCompleteIcon

public static final ImageIcon notCompleteIcon

stoppingIcon

public static final ImageIcon stoppingIcon

stoppedIcon

public static final ImageIcon stoppedIcon

sleepingIcon

public static final ImageIcon sleepingIcon

invalidIcon

public static final ImageIcon invalidIcon

exceptionIcon

public static final ImageIcon exceptionIcon

startedIcon

public static final ImageIcon startedIcon

activeIcon

public static final ImageIcon activeIcon
Constructor Detail

IconHelper

public IconHelper(Iconic source,
                  String initialId)
Constructor with default icon map.

Parameters:
source - The source for events.
intialId - The initial icon id.

IconHelper

public IconHelper(Iconic source,
                  String initialId,
                  Map<String,ImageIcon> iconMap)
Constructor.

Parameters:
source - The source for events.
intialId - The initial icon id.
iconMap - The map of ids to icons to use.
Method Detail

iconForId

public ImageIcon iconForId(String iconId)
Return an ImageIcon for the given id.

Specified by:
iconForId in interface Iconic
Parameters:
iconId - The id.
Returns:
The ImageIcon never null.
Throws:
NoSuchIconException - If the icon doesn't exist.

changeIcon

public void changeIcon(String iconId)
Change the icon by firing an iconEvent.

Parameters:
iconId - The icon id.

currentId

public String currentId()
Get the current/last icon id.

Returns:
An iconId.

addIconListener

public void addIconListener(IconListener listener)
Description copied from interface: Iconic
Add a listener.

Specified by:
addIconListener in interface Iconic
Parameters:
listener - The IconListener.

removeIconListener

public void removeIconListener(IconListener listener)
Description copied from interface: Iconic
Remove a listener.

Specified by:
removeIconListener in interface Iconic
Parameters:
listener - The IconListener.