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 theRadianceIcon
that allows switching the icon painting at runtime. This class can be used as a delegate in theDecoratedRadianceIcon
where 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 RadianceIcon
currentIcon
Currently shown icon.private java.util.Map<T,? extends RadianceIcon>
iconDeck
The 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 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(java.awt.Component c, java.awt.Graphics g, int x, int y)
void
removeAsynchronousLoadListener(AsynchronousLoadListener l)
Removes listener on the asynchronous loading events.void
setColorFilter(RadianceIcon.ColorFilter colorFilter)
void
setDimension(java.awt.Dimension dim)
Changes the dimension ofthis
icon.void
setIcon(T key)
Sets the currently shown icon.boolean
supportsColorFilter()
-
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:RadianceIcon
Changes the dimension ofthis
icon.- Specified by:
setDimension
in interfaceRadianceIcon
- Parameters:
dim
- New dimension forthis
icon.
-
supportsColorFilter
public boolean supportsColorFilter()
- Specified by:
supportsColorFilter
in interfaceRadianceIcon
-
setColorFilter
public void setColorFilter(RadianceIcon.ColorFilter colorFilter)
- Specified by:
setColorFilter
in interfaceRadianceIcon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeight
in interfacejavax.swing.Icon
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidth
in interfacejavax.swing.Icon
-
paintIcon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
- Specified by:
paintIcon
in interfacejavax.swing.Icon
-
addAsynchronousLoadListener
public void addAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface:AsynchronousLoading
Adds listener on the asynchronous loading events.- Specified by:
addAsynchronousLoadListener
in interfaceAsynchronousLoading
- 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 interfaceAsynchronousLoading
- 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 interfaceAsynchronousLoading
- Parameters:
l
- Listener to remove.
-
-