Class DecoratedRadianceIcon
- java.lang.Object
-
- org.pushingpixels.radiance.component.api.common.icon.DecoratedRadianceIcon
-
- All Implemented Interfaces:
javax.swing.Icon
,AsynchronousLoading
,RadianceIcon
public class DecoratedRadianceIcon extends java.lang.Object implements RadianceIcon, AsynchronousLoading
Implementation ofRadianceIcon
that adds decorations to a main icon.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DecoratedRadianceIcon.IconDecorator
Icon decorator interface.-
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 java.util.List<DecoratedRadianceIcon.IconDecorator>
decorators
List of icon decorators.private RadianceIcon
delegate
The main delegate icon.
-
Constructor Summary
Constructors Constructor Description DecoratedRadianceIcon(RadianceIcon delegate)
Creates a new decorated icon with no decorators.DecoratedRadianceIcon(RadianceIcon delegate, DecoratedRadianceIcon.IconDecorator... decorators)
Creates a new decorated icon.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAsynchronousLoadListener(AsynchronousLoadListener l)
Adds listener on the asynchronous loading events.void
addIconDecorator(DecoratedRadianceIcon.IconDecorator decorator)
Adds the specified decorator to the end of the decorator sequence.static RadianceIcon.Factory
factory(RadianceIcon.Factory original, DecoratedRadianceIcon.IconDecorator... decorators)
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
removeIconDecorator(DecoratedRadianceIcon.IconDecorator decorator)
Removes the specified decorator.void
setColorFilter(RadianceIcon.ColorFilter colorFilter)
void
setDimension(java.awt.Dimension newDimension)
Changes the dimension ofthis
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
-
delegate
private RadianceIcon delegate
The main delegate icon.
-
decorators
private java.util.List<DecoratedRadianceIcon.IconDecorator> decorators
List of icon decorators.
-
-
Constructor Detail
-
DecoratedRadianceIcon
public DecoratedRadianceIcon(RadianceIcon delegate, DecoratedRadianceIcon.IconDecorator... decorators)
Creates a new decorated icon.- Parameters:
delegate
- The main icon.decorators
- Icon decorators.
-
DecoratedRadianceIcon
public DecoratedRadianceIcon(RadianceIcon delegate)
Creates a new decorated icon with no decorators. Decorators can be added later withaddIconDecorator(IconDecorator)
.- Parameters:
delegate
- Main icon.
-
-
Method Detail
-
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
-
setDimension
public void setDimension(java.awt.Dimension newDimension)
Description copied from interface:RadianceIcon
Changes the dimension ofthis
icon.- Specified by:
setDimension
in interfaceRadianceIcon
- Parameters:
newDimension
- 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
-
addIconDecorator
public void addIconDecorator(DecoratedRadianceIcon.IconDecorator decorator)
Adds the specified decorator to the end of the decorator sequence. If the specified decorator already exists, it is not moved to the end of the sequence.- Parameters:
decorator
- Decorator to add.
-
removeIconDecorator
public void removeIconDecorator(DecoratedRadianceIcon.IconDecorator decorator)
Removes the specified decorator.- Parameters:
decorator
- Decorator to remove.
-
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.
-
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.
-
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.
-
factory
public static RadianceIcon.Factory factory(RadianceIcon.Factory original, DecoratedRadianceIcon.IconDecorator... decorators)
-
-