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 ofRadianceIconthat adds decorations to a main icon.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDecoratedRadianceIcon.IconDecoratorIcon 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>decoratorsList of icon decorators.private RadianceIcondelegateThe 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 voidaddAsynchronousLoadListener(AsynchronousLoadListener l)Adds listener on the asynchronous loading events.voidaddIconDecorator(DecoratedRadianceIcon.IconDecorator decorator)Adds the specified decorator to the end of the decorator sequence.static RadianceIcon.Factoryfactory(RadianceIcon.Factory original, DecoratedRadianceIcon.IconDecorator... decorators)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.voidremoveIconDecorator(DecoratedRadianceIcon.IconDecorator decorator)Removes the specified decorator.voidsetColorFilter(RadianceIcon.ColorFilter colorFilter)voidsetDimension(java.awt.Dimension newDimension)Changes the dimension ofthisicon.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
-
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:
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
-
setDimension
public void setDimension(java.awt.Dimension newDimension)
Description copied from interface:RadianceIconChanges the dimension ofthisicon.- Specified by:
setDimensionin interfaceRadianceIcon- Parameters:
newDimension- New dimension forthisicon.
-
supportsColorFilter
public boolean supportsColorFilter()
- Specified by:
supportsColorFilterin interfaceRadianceIcon
-
setColorFilter
public void setColorFilter(RadianceIcon.ColorFilter colorFilter)
- Specified by:
setColorFilterin 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:AsynchronousLoadingAdds listener on the asynchronous loading events.- Specified by:
addAsynchronousLoadListenerin interfaceAsynchronousLoading- Parameters:
l- Listener to add.
-
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.
-
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.
-
factory
public static RadianceIcon.Factory factory(RadianceIcon.Factory original, DecoratedRadianceIcon.IconDecorator... decorators)
-
-