Class IconDeckRadianceIcon<T>
- java.lang.Object
-
- org.pushingpixels.radiance.component.api.common.icon.IconDeckRadianceIcon<T>
-
- Type Parameters:
T- enumeration key into the deck
- All Implemented Interfaces:
javax.swing.Icon,AsynchronousLoading,RadianceIcon
public class IconDeckRadianceIcon<T> extends java.lang.Object implements RadianceIcon, AsynchronousLoading
Implementation of theRadianceIconthat allows switching the icon painting at runtime. This class can be used as a delegate in theDecoratedRadianceIconwhere the "base" icon is changed at runtime without the need to recompute all the decorators.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.pushingpixels.radiance.common.api.icon.RadianceIcon
RadianceIcon.ColorFilter, RadianceIcon.Factory
-
-
Field Summary
Fields Modifier and Type Field Description private RadianceIconcurrentIconCurrently shown icon.private java.util.Map<T,? extends RadianceIcon>iconDeckThe icon deck.
-
Constructor Summary
Constructors Constructor Description IconDeckRadianceIcon(java.util.Map<T,? extends RadianceIcon> iconDeck)Creates the icon deck.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAsynchronousLoadListener(AsynchronousLoadListener l)Adds listener on the asynchronous loading events.intgetIconHeight()intgetIconWidth()booleanisLoading()Returns indication whether the content is still loading.voidpaintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)voidremoveAsynchronousLoadListener(AsynchronousLoadListener l)Removes listener on the asynchronous loading events.voidsetColorFilter(RadianceIcon.ColorFilter colorFilter)voidsetDimension(java.awt.Dimension dim)Changes the dimension ofthisicon.voidsetIcon(T key)Sets the currently shown icon.booleansupportsColorFilter()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pushingpixels.radiance.common.api.icon.RadianceIcon
toImage
-
-
-
-
Field Detail
-
currentIcon
private RadianceIcon currentIcon
Currently shown icon.
-
iconDeck
private final java.util.Map<T,? extends RadianceIcon> iconDeck
The icon deck.
-
-
Constructor Detail
-
IconDeckRadianceIcon
public IconDeckRadianceIcon(java.util.Map<T,? extends RadianceIcon> 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(java.awt.Dimension dim)
Description copied from interface:RadianceIconChanges the dimension ofthisicon.- Specified by:
setDimensionin interfaceRadianceIcon- Parameters:
dim- New dimension forthisicon.
-
supportsColorFilter
public boolean supportsColorFilter()
- Specified by:
supportsColorFilterin interfaceRadianceIcon
-
setColorFilter
public void setColorFilter(RadianceIcon.ColorFilter colorFilter)
- Specified by:
setColorFilterin interfaceRadianceIcon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeightin interfacejavax.swing.Icon
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidthin interfacejavax.swing.Icon
-
paintIcon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)- Specified by:
paintIconin interfacejavax.swing.Icon
-
addAsynchronousLoadListener
public void addAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface:AsynchronousLoadingAdds listener on the asynchronous loading events.- Specified by:
addAsynchronousLoadListenerin interfaceAsynchronousLoading- Parameters:
l- Listener to add.
-
isLoading
public boolean isLoading()
Description copied from interface:AsynchronousLoadingReturns indication whether the content is still loading.- Specified by:
isLoadingin interfaceAsynchronousLoading- Returns:
trueif the content is still loading,falseotherwise.
-
removeAsynchronousLoadListener
public void removeAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface:AsynchronousLoadingRemoves listener on the asynchronous loading events.- Specified by:
removeAsynchronousLoadListenerin interfaceAsynchronousLoading- Parameters:
l- Listener to remove.
-
-