org.oddjob.webapp.model
Class IconRegistry

java.lang.Object
  extended by org.oddjob.webapp.model.IconRegistry

public class IconRegistry
extends Object

A registry of icons so they can be served up to the view. This registry works on the principle that an icon id identifies the same icon for all jobs.

Author:
Rob Gordon.

Constructor Summary
IconRegistry()
           
 
Method Summary
 void register(String iconId, Iconic iconic)
          Register an iconId.
 byte[] retrieve(String iconId)
          Retrieve an IconTip for a given icon id.
protected  void writeIcon(ImageIcon icon, OutputStream out)
          Write the icon to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconRegistry

public IconRegistry()
Method Detail

register

public void register(String iconId,
                     Iconic iconic)
Register an iconId. If the icon id isn't registered already, the icon is looked up.

Parameters:
iconId - The iconId.
iconic - The Iconic that can provide the lookup.

writeIcon

protected void writeIcon(ImageIcon icon,
                         OutputStream out)
Write the icon to an output stream.

Parameters:
icon - The icon.
out - The output stream. This method will close the output stream.

retrieve

public byte[] retrieve(String iconId)
Retrieve an IconTip for a given icon id.

Parameters:
iconId - The iconId.
Returns:
The IconTip, null if none exists if nothing is registered for that id.