org.pushingpixels.flamingo.api.common.icon
Class IconDeckResizableIcon<T>

java.lang.Object
  extended by org.pushingpixels.flamingo.api.common.icon.IconDeckResizableIcon<T>
Type Parameters:
T - enumeration key into the deck
All Implemented Interfaces:
Icon, AsynchronousLoading, ResizableIcon

public class IconDeckResizableIcon<T>
extends Object
implements ResizableIcon, AsynchronousLoading

Implementation of the ResizableIcon that allows switching the icon painting at runtime. This class can be used as a delegate in the DecoratedResizableIcon where the "base" icon is changed at runtime without the need to recompute all the decorators.


Constructor Summary
IconDeckResizableIcon(Map<T,? extends ResizableIcon> iconDeck)
          Creates the icon deck.
 
Method Summary
 void addAsynchronousLoadListener(AsynchronousLoadListener l)
          Adds listener on the asynchronous loading events.
 int getIconHeight()
           
 int getIconWidth()
           
 boolean isLoading()
          Returns indication whether the content is still loading.
 void paintIcon(Component c, Graphics g, int x, int y)
           
 void removeAsynchronousLoadListener(AsynchronousLoadListener l)
          Removes listener on the asynchronous loading events.
 void setDimension(Dimension dim)
          Changes the dimension of this icon.
 void setIcon(T key)
          Sets the currently shown icon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconDeckResizableIcon

public IconDeckResizableIcon(Map<T,? extends ResizableIcon> iconDeck)
Creates the icon deck.

Parameters:
iconDeck - Icon deck.
Method Detail

setIcon

public void setIcon(T key)
Sets the currently shown icon.

Parameters:
key - Icon key.

setDimension

public void setDimension(Dimension dim)
Description copied from interface: ResizableIcon
Changes the dimension of this icon.

Specified by:
setDimension in interface ResizableIcon
Parameters:
dim - New dimension for this icon.

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface Icon

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface Icon

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface Icon

addAsynchronousLoadListener

public void addAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface: AsynchronousLoading
Adds listener on the asynchronous loading events.

Specified by:
addAsynchronousLoadListener in interface AsynchronousLoading
Parameters:
l - Listener to add.

isLoading

public boolean isLoading()
Description copied from interface: AsynchronousLoading
Returns indication whether the content is still loading.

Specified by:
isLoading in interface AsynchronousLoading
Returns:
true if the content is still loading, false otherwise.

removeAsynchronousLoadListener

public void removeAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface: AsynchronousLoading
Removes listener on the asynchronous loading events.

Specified by:
removeAsynchronousLoadListener in interface AsynchronousLoading
Parameters:
l - Listener to remove.