Class RadianceSkin
- java.lang.Object
-
- org.pushingpixels.radiance.theming.api.RadianceSkin
-
- All Implemented Interfaces:
RadianceTrait
- Direct Known Subclasses:
AutumnSkin
,CeruleanSkin
,FieldOfWheatSkin
,GeminiSkin
,GreenMagicSkin
,HarvestSkin
,MagellanSkin
,MagmaSkin
,MarinerSkin
,ModerateSkin
,NightShadeSkin
,OfficeBlack2007Skin
,OfficeBlue2007Skin
,OfficeSilver2007Skin
,RadianceSkin.Accented
,RavenSkin
,SaharaSkin
,SentinelSkin
,StreetlightsSkin
,TwilightSkin
public abstract class RadianceSkin extends java.lang.Object implements RadianceTrait
Base abstract class for Radiance skins.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RadianceSkin.Accented
Base class for skins that can be configured with accent color schemes.static interface
RadianceSkin.ColorSchemes
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<RadianceThemingSlices.DecorationAreaType,RadianceColorScheme>
backgroundColorSchemeMap
Maps decoration area type to the background color schemes.protected RadianceBorderPainter
borderPainter
The border painter ofthis
skin.protected RadianceButtonShaper
buttonShaper
The button shaper ofthis
skin.private java.util.Map<RadianceThemingSlices.ColorOverlayType,java.util.Map<RadianceThemingSlices.DecorationAreaType,java.util.Map<ComponentState,java.awt.Color>>>
colorOverlayMap
private java.util.Map<RadianceThemingSlices.DecorationAreaType,RadianceColorSchemeBundle>
colorSchemeBundleMap
Maps decoration area type to the color scheme bundles.private java.util.Set<RadianceThemingSlices.DecorationAreaType>
decoratedAreaSet
Set of all decoration area types that are not explicitly registered incolorSchemeBundleMap
but still are considered as decoration areas in this skin.protected RadianceDecorationPainter
decorationPainter
The decoration painter ofthis
skin.protected RadianceFillPainter
fillPainter
The fill painter ofthis
skin.protected RadianceBorderPainter
highlightBorderPainter
The highlight border painter ofthis
skin.protected RadianceFillPainter
highlightFillPainter
The highlight fill painter ofthis
skin.private java.util.Map<java.lang.Integer,RadianceColorScheme>
optionPaneIconColorSchemeMap
private java.util.Map<RadianceThemingSlices.DecorationAreaType,java.util.List<RadianceOverlayPainter>>
overlayPaintersMap
Maps decoration area type to the registered overlay painters.private java.util.Set<ComponentState>
statesWithAlpha
All component states that have associated non-trivial alpha values.
-
Constructor Summary
Constructors Modifier Constructor Description protected
RadianceSkin()
Constructs the basic data structures for a skin.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addCustomEntriesToTable(javax.swing.UIDefaults table)
Adds skin-specific entries to the UI defaults table.void
addOverlayPainter(RadianceOverlayPainter overlayPainter, RadianceThemingSlices.DecorationAreaType... areaTypes)
Adds the specified overlay painter to the end of the list of overlay painters associated with the specified decoration area types.void
clearOverlayPainters(RadianceThemingSlices.DecorationAreaType... areaTypes)
Removes all overlay painters associated with the specified decoration area types.RadianceColorScheme
getActiveColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns the main active color scheme for the specific decoration area type.float
getAlpha(java.awt.Component comp, ComponentState componentState)
Returns the alpha channel of the color scheme of the component.RadianceColorScheme
getBackgroundColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns the background color scheme for the specified decoration area type.RadianceBorderPainter
getBorderPainter()
Returns the border painter of this skin.RadianceButtonShaper
getButtonShaper()
Returns the button shaper of this skin.RadianceColorScheme
getColorScheme(java.awt.Component comp, ComponentState componentState)
Returns the color scheme of the specified component in the specified component state.RadianceColorScheme
getColorScheme(java.awt.Component comp, RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.RadianceColorScheme
getColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType, RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of components in the specified decoration area.static RadianceSkin.ColorSchemes
getColorSchemes(java.io.InputStream inputStream)
Returns the collection of color schemes in the specified input stream.RadianceDecorationPainter
getDecorationPainter()
Returns the decoration painter of this skin.RadianceColorScheme
getDirectColorScheme(java.awt.Component comp, RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.RadianceColorScheme
getDisabledColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns the main disabled color scheme for the specific decoration area type.RadianceColorScheme
getEnabledColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns the main enabled color scheme for the specific decoration area type.RadianceFillPainter
getFillPainter()
Returns the fill painter of this skin.float
getHighlightAlpha(java.awt.Component comp, ComponentState componentState)
Returns the alpha channel of the highlight color scheme of the component.RadianceBorderPainter
getHighlightBorderPainter()
Returns the highlight border painter of this skin.RadianceFillPainter
getHighlightFillPainter()
Returns the highlight painter of this skin.RadianceColorScheme
getOptionPaneIconColorScheme(int optionPaneMessageType)
java.awt.Color
getOverlayColor(RadianceThemingSlices.ColorOverlayType colorOverlayType, RadianceThemingSlices.DecorationAreaType decorationAreaType, ComponentState componentState)
java.util.List<RadianceOverlayPainter>
getOverlayPainters(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns a non-null, non-modifiable list of overlay painters associated with the specified decoration area type.boolean
isRegisteredAsDecorationArea(RadianceThemingSlices.DecorationAreaType decorationType)
Returns indication whether the specified decoration area type should have their background painted byRadianceDecorationPainter.paintDecorationArea(Graphics2D, Component, RadianceThemingSlices.DecorationAreaType, int, int, RadianceSkin)
instead of a simple background fill.boolean
isValid()
Checks whether this skin is valid.void
registerAsDecorationArea(RadianceColorScheme backgroundColorScheme, RadianceColorSchemeBundle.Overlay noneTransformationOverlay, RadianceThemingSlices.DecorationAreaType... areaTypes)
Registers the specified background color scheme and a color scheme bundle overlay to be used on controls in decoration areas.void
registerAsDecorationArea(RadianceColorScheme backgroundColorScheme, RadianceThemingSlices.DecorationAreaType... areaTypes)
Registers the specified background color scheme to be used on controls in decoration areas.void
registerDecorationAreaSchemeBundle(RadianceColorSchemeBundle bundle, RadianceColorScheme backgroundColorScheme, RadianceThemingSlices.DecorationAreaType... areaTypes)
Registers the specified color scheme bundle and background color scheme to be used on controls in decoration areas.void
registerDecorationAreaSchemeBundle(RadianceColorSchemeBundle bundle, RadianceThemingSlices.DecorationAreaType... areaTypes)
Registers the specified color scheme bundle to be used on controls in decoration areas.void
removeOverlayPainter(RadianceOverlayPainter overlayPainter, RadianceThemingSlices.DecorationAreaType... areaTypes)
Removes the specified overlay painter from the list of overlay painters associated with the specified decoration area types.void
setOptionPaneIconColorScheme(RadianceColorScheme colorScheme, int... optionPaneMessageTypes)
void
setOverlayColor(java.awt.Color color, RadianceThemingSlices.ColorOverlayType colorOverlayType, RadianceThemingSlices.DecorationAreaType decorationAreaType, ComponentState... componentStates)
RadianceSkin
transform(ColorSchemeTransform transform, java.lang.String name)
Creates a new skin that has the same settings as this skin with the addition of applying the specified color scheme transformation on all the relevant color schemes.-
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.theming.api.trait.RadianceTrait
getDisplayName
-
-
-
-
Field Detail
-
colorSchemeBundleMap
private java.util.Map<RadianceThemingSlices.DecorationAreaType,RadianceColorSchemeBundle> colorSchemeBundleMap
Maps decoration area type to the color scheme bundles. Must contain an entry forRadianceThemingSlices.DecorationAreaType.NONE
.
-
backgroundColorSchemeMap
private java.util.Map<RadianceThemingSlices.DecorationAreaType,RadianceColorScheme> backgroundColorSchemeMap
Maps decoration area type to the background color schemes.
-
overlayPaintersMap
private java.util.Map<RadianceThemingSlices.DecorationAreaType,java.util.List<RadianceOverlayPainter>> overlayPaintersMap
Maps decoration area type to the registered overlay painters. Each decoration area type can have more than one overlay painter.
-
buttonShaper
protected RadianceButtonShaper buttonShaper
The button shaper ofthis
skin. Must be non-null
.
-
fillPainter
protected RadianceFillPainter fillPainter
The fill painter ofthis
skin. Must be non-null
.
-
highlightFillPainter
protected RadianceFillPainter highlightFillPainter
The highlight fill painter ofthis
skin. Must be non-null
.
-
borderPainter
protected RadianceBorderPainter borderPainter
The border painter ofthis
skin. Must be non-null
.
-
highlightBorderPainter
protected RadianceBorderPainter highlightBorderPainter
The highlight border painter ofthis
skin. Can benull
.
-
decorationPainter
protected RadianceDecorationPainter decorationPainter
The decoration painter ofthis
skin. Must be non-null
.
-
decoratedAreaSet
private java.util.Set<RadianceThemingSlices.DecorationAreaType> decoratedAreaSet
Set of all decoration area types that are not explicitly registered incolorSchemeBundleMap
but still are considered as decoration areas in this skin. Controls in such areas will have their background painted byRadianceDecorationPainter.paintDecorationArea(Graphics2D, Component, RadianceThemingSlices.DecorationAreaType, int, int, RadianceSkin)
instead of a simple background fill.
-
statesWithAlpha
private java.util.Set<ComponentState> statesWithAlpha
All component states that have associated non-trivial alpha values.
-
colorOverlayMap
private java.util.Map<RadianceThemingSlices.ColorOverlayType,java.util.Map<RadianceThemingSlices.DecorationAreaType,java.util.Map<ComponentState,java.awt.Color>>> colorOverlayMap
-
optionPaneIconColorSchemeMap
private java.util.Map<java.lang.Integer,RadianceColorScheme> optionPaneIconColorSchemeMap
-
-
Method Detail
-
getBorderPainter
public final RadianceBorderPainter getBorderPainter()
Returns the border painter of this skin.
-
getHighlightBorderPainter
public final RadianceBorderPainter getHighlightBorderPainter()
Returns the highlight border painter of this skin.- Returns:
- The highlight border painter of this skin. The return value of
this method may be
null
. In this case, callgetBorderPainter()
.
-
getButtonShaper
public final RadianceButtonShaper getButtonShaper()
Returns the button shaper of this skin.
-
getFillPainter
public final RadianceFillPainter getFillPainter()
Returns the fill painter of this skin.
-
getHighlightFillPainter
public final RadianceFillPainter getHighlightFillPainter()
Returns the highlight painter of this skin.
-
getDecorationPainter
public final RadianceDecorationPainter getDecorationPainter()
Returns the decoration painter of this skin.
-
addCustomEntriesToTable
void addCustomEntriesToTable(javax.swing.UIDefaults table)
Adds skin-specific entries to the UI defaults table.- Parameters:
table
- UI defaults table.
-
getColorScheme
public final RadianceColorScheme getColorScheme(java.awt.Component comp, ComponentState componentState)
Returns the color scheme of the specified component in the specified component state.- Parameters:
comp
- Component.componentState
- Component state.- Returns:
- The color scheme of the component in the specified component state.
-
getHighlightAlpha
public final float getHighlightAlpha(java.awt.Component comp, ComponentState componentState)
Returns the alpha channel of the highlight color scheme of the component.- Parameters:
comp
- Component.componentState
- Component state.- Returns:
- Highlight color scheme alpha channel.
-
getAlpha
public final float getAlpha(java.awt.Component comp, ComponentState componentState)
Returns the alpha channel of the color scheme of the component.- Parameters:
comp
- Component.componentState
- Component state.- Returns:
- Color scheme alpha channel.
-
registerDecorationAreaSchemeBundle
public void registerDecorationAreaSchemeBundle(RadianceColorSchemeBundle bundle, RadianceColorScheme backgroundColorScheme, RadianceThemingSlices.DecorationAreaType... areaTypes)
Registers the specified color scheme bundle and background color scheme to be used on controls in decoration areas.- Parameters:
bundle
- The color scheme bundle to use on controls in decoration areas.backgroundColorScheme
- The color scheme to use for background of controls in decoration areas.areaTypes
- Enumerates the area types that are affected by the parameters.
-
registerDecorationAreaSchemeBundle
public void registerDecorationAreaSchemeBundle(RadianceColorSchemeBundle bundle, RadianceThemingSlices.DecorationAreaType... areaTypes)
Registers the specified color scheme bundle to be used on controls in decoration areas.- Parameters:
bundle
- The color scheme bundle to use on controls in decoration areas.areaTypes
- Enumerates the area types that are affected by the parameters.
-
registerAsDecorationArea
public void registerAsDecorationArea(RadianceColorScheme backgroundColorScheme, RadianceThemingSlices.DecorationAreaType... areaTypes)
Registers the specified background color scheme to be used on controls in decoration areas.- Parameters:
backgroundColorScheme
- The color scheme to use for background of controls in decoration areas.areaTypes
- Enumerates the area types that are affected by the parameters. Each decoration area type will be painted byRadianceDecorationPainter.paintDecorationArea(Graphics2D, Component, RadianceThemingSlices.DecorationAreaType, int, int, RadianceSkin)
-
registerAsDecorationArea
public void registerAsDecorationArea(RadianceColorScheme backgroundColorScheme, RadianceColorSchemeBundle.Overlay noneTransformationOverlay, RadianceThemingSlices.DecorationAreaType... areaTypes)
Registers the specified background color scheme and a color scheme bundle overlay to be used on controls in decoration areas.- Parameters:
backgroundColorScheme
- The color scheme to use for background of controls in decoration areas.noneTransformationOverlay
- Overlay to be applied to theRadianceColorSchemeBundle
registered on theRadianceThemingSlices.DecorationAreaType.NONE
, with the resulting color scheme bundle to be used on #areaTypes.areaTypes
- Enumerates the area types that are affected by the parameters. Each decoration area type will be painted byRadianceDecorationPainter.paintDecorationArea(Graphics2D, Component, RadianceThemingSlices.DecorationAreaType, int, int, RadianceSkin)
-
isRegisteredAsDecorationArea
public boolean isRegisteredAsDecorationArea(RadianceThemingSlices.DecorationAreaType decorationType)
Returns indication whether the specified decoration area type should have their background painted byRadianceDecorationPainter.paintDecorationArea(Graphics2D, Component, RadianceThemingSlices.DecorationAreaType, int, int, RadianceSkin)
instead of a simple background fill.- Parameters:
decorationType
- Decoration area type.- Returns:
true
if specified decoration area type should have their background painted byRadianceDecorationPainter.paintDecorationArea(Graphics2D, Component, RadianceThemingSlices.DecorationAreaType, int, int, RadianceSkin)
,false
otherwise.
-
getActiveColorScheme
public final RadianceColorScheme getActiveColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns the main active color scheme for the specific decoration area type. Custom painting code that needs to consult the colors of the specific component should usegetColorScheme(Component, ComponentState)
method and variousRadianceColorScheme
methods.- Parameters:
decorationAreaType
- Decoration area type.- Returns:
- The main active color scheme for this skin.
- See Also:
getColorScheme(Component, ComponentState)
-
getEnabledColorScheme
public final RadianceColorScheme getEnabledColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns the main enabled color scheme for the specific decoration area type. Custom painting code that needs to consult the colors of the specific component should usegetColorScheme(Component, ComponentState)
method and variousRadianceColorScheme
methods.- Parameters:
decorationAreaType
- Decoration area type.- Returns:
- The main enabled color scheme for this skin.
- See Also:
getColorScheme(Component, ComponentState)
-
getDisabledColorScheme
public final RadianceColorScheme getDisabledColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns the main disabled color scheme for the specific decoration area type. Custom painting code that needs to consult the colors of the specific component should usegetColorScheme(Component, ComponentState)
method and variousRadianceColorScheme
methods.- Parameters:
decorationAreaType
- Decoration area type.- Returns:
- The main disabled color scheme for this skin.
- See Also:
getColorScheme(Component, ComponentState)
-
addOverlayPainter
public void addOverlayPainter(RadianceOverlayPainter overlayPainter, RadianceThemingSlices.DecorationAreaType... areaTypes)
Adds the specified overlay painter to the end of the list of overlay painters associated with the specified decoration area types.- Parameters:
overlayPainter
- Overlay painter to add to the end of the list of overlay painters associated with the specified decoration area types.areaTypes
- Decoration area types.
-
removeOverlayPainter
public void removeOverlayPainter(RadianceOverlayPainter overlayPainter, RadianceThemingSlices.DecorationAreaType... areaTypes)
Removes the specified overlay painter from the list of overlay painters associated with the specified decoration area types.- Parameters:
overlayPainter
- Overlay painter to remove from the list of overlay painters associated with the specified decoration area types.areaTypes
- Decoration area types.
-
clearOverlayPainters
public void clearOverlayPainters(RadianceThemingSlices.DecorationAreaType... areaTypes)
Removes all overlay painters associated with the specified decoration area types.- Parameters:
areaTypes
- Decoration area types.
-
getOverlayPainters
public java.util.List<RadianceOverlayPainter> getOverlayPainters(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns a non-null, non-modifiable list of overlay painters associated with the specified decoration area type.- Parameters:
decorationAreaType
- Decoration area type.- Returns:
- A non-null, non-modifiable list of overlay painters associated with the specified decoration area type.
-
getColorScheme
public final RadianceColorScheme getColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType, RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of components in the specified decoration area.- Parameters:
decorationAreaType
- Decoration area type.associationKind
- Color scheme association kind.componentState
- Component state.- Returns:
- Color scheme to be used for painting the specified visual area of components in the specified decoration area.
-
getColorScheme
public final RadianceColorScheme getColorScheme(java.awt.Component comp, RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.- Parameters:
comp
- Component.associationKind
- Color scheme association kind.componentState
- Component state.- Returns:
- Color scheme to be used for painting the specified visual area of the component under the specified component state.
-
getDirectColorScheme
public final RadianceColorScheme getDirectColorScheme(java.awt.Component comp, RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState)
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.- Parameters:
comp
- Component.associationKind
- Color scheme association kind.componentState
- Component state.- Returns:
- Color scheme to be used for painting the specified visual area of the component under the specified component state.
-
transform
public RadianceSkin transform(ColorSchemeTransform transform, java.lang.String name)
Creates a new skin that has the same settings as this skin with the addition of applying the specified color scheme transformation on all the relevant color schemes.- Parameters:
transform
- Color scheme transformation.name
- The name of the new skin.- Returns:
- The new skin.
-
getBackgroundColorScheme
public final RadianceColorScheme getBackgroundColorScheme(RadianceThemingSlices.DecorationAreaType decorationAreaType)
Returns the background color scheme for the specified decoration area type. This method is mainly for the internal use ofRadianceDecorationPainter.paintDecorationArea(Graphics2D, Component, RadianceThemingSlices.DecorationAreaType, int, int, RadianceSkin)
but can be used in applications that wish to provide custom overlay background painting.- Parameters:
decorationAreaType
- Decoration area type.- Returns:
- The background color scheme for the specified decoration area type.
-
setOverlayColor
public void setOverlayColor(java.awt.Color color, RadianceThemingSlices.ColorOverlayType colorOverlayType, RadianceThemingSlices.DecorationAreaType decorationAreaType, ComponentState... componentStates)
-
getOverlayColor
public java.awt.Color getOverlayColor(RadianceThemingSlices.ColorOverlayType colorOverlayType, RadianceThemingSlices.DecorationAreaType decorationAreaType, ComponentState componentState)
-
setOptionPaneIconColorScheme
public void setOptionPaneIconColorScheme(RadianceColorScheme colorScheme, int... optionPaneMessageTypes)
-
getOptionPaneIconColorScheme
public RadianceColorScheme getOptionPaneIconColorScheme(int optionPaneMessageType)
-
isValid
public boolean isValid()
Checks whether this skin is valid. A valid skin must have a color scheme bundle forRadianceThemingSlices.DecorationAreaType.NONE
and non-null
button shaper, gradient painter, border painter, highlight painter and decoration painter. If call toRadianceThemingCortex.GlobalScope.setSkin(String)
orRadianceThemingCortex.GlobalScope.setSkin(RadianceSkin)
does not seem to have any visible effect (returningfalse
), call this method to verify that your skin is valid.- Returns:
true
if this skin is valid,false
otherwise.
-
getColorSchemes
public static RadianceSkin.ColorSchemes getColorSchemes(java.io.InputStream inputStream)
Returns the collection of color schemes in the specified input stream.- Parameters:
inputStream
- Input stream for the resource containing the description of Radiance color schemes.- Returns:
- The collection of color schemes in the specified input stream.
-
-