Class RadianceColorSchemeBundle
- java.lang.Object
-
- org.pushingpixels.radiance.theming.api.RadianceColorSchemeBundle
-
public class RadianceColorSchemeBundle extends java.lang.ObjectColor scheme bundle. Defines the visual appearance of a single decoration area of a skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRadianceColorSchemeBundle.Overlay
-
Field Summary
Fields Modifier and Type Field Description private RadianceColorSchemeactiveColorSchemeThe active color scheme of this bundle.private java.util.Map<RadianceThemingSlices.ColorSchemeAssociationKind,java.util.Map<ComponentState,ComponentState>>bestFillMapprivate java.util.Map<RadianceThemingSlices.ColorSchemeAssociationKind,java.util.Map<ComponentState,RadianceColorScheme>>colorSchemeMapMaps from color scheme association kinds to the map of color schemes.private RadianceColorSchemedisabledColorSchemeThe disabled color scheme of this bundle.private RadianceColorSchemedisabledSelectedSchemeIf there is no explicitly registered color scheme for the disabled selected component state, this field will contain a synthesized color scheme for the disabled selected state.private RadianceColorSchemeenabledColorSchemeThe enabled color scheme of this bundle.private RadianceColorSchemepressedSchemeIf there is no explicitly registered color scheme for pressed component state, this field will contain a synthesized color scheme for the pressed state.private RadianceColorSchemerolloverSelectedSchemeIf there is no explicitly registered color scheme for the rollover selected component state, this field will contain a synthesized color scheme for the rollover selected state.private RadianceColorSchemeselectedSchemeIf there is no explicitly registered color scheme for the selected component state, this field will contain a synthesized color scheme for the selected state.private java.util.Map<ComponentState,java.lang.Float>stateAlphaMapMaps from component state to the alpha channel applied on color scheme.private java.util.Map<ComponentState,java.lang.Float>stateHighlightAlphaMapMaps from component state to the alpha channel applied on highlight color scheme.
-
Constructor Summary
Constructors Constructor Description RadianceColorSchemeBundle(RadianceColorScheme activeColorScheme, RadianceColorScheme enabledColorScheme, RadianceColorScheme disabledColorScheme)Creates a new color scheme bundle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RadianceColorSchemegetActiveColorScheme()Returns the active color scheme of this bundle.floatgetAlpha(ComponentState componentState)Returns the alpha channel of color schemes for the specified component state.RadianceColorSchemegetColorScheme(ComponentState componentState)Returns the color scheme of the specified component in the specified component state.RadianceColorSchemegetColorScheme(RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState, boolean allowFallback)Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.RadianceColorSchemegetDisabledColorScheme()Returns the disabled color scheme of this bundle.RadianceColorSchemegetEnabledColorScheme()Returns the enabled color scheme of this bundle.floatgetHighlightAlpha(ComponentState componentState)Returns the alpha channel of the highlight color schemes for the specified component state.(package private) java.util.Set<ComponentState>getStatesWithAlpha()Returns the set of all component states that have non-trivial alpha associated with them.booleanhasAlphaFor(ComponentState componentState)booleanhasHighlightAlphaFor(ComponentState componentState)voidregisterAlpha(float alpha, ComponentState... states)Registers an alpha channel value for the specific component states.voidregisterColorScheme(RadianceColorScheme stateColorScheme, ComponentState... states)Registers a color scheme for the specific component state.voidregisterColorScheme(RadianceColorScheme scheme, RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState... states)Registers the color scheme to be used for the specified visual area of controls under the specified states.voidregisterHighlightAlpha(float alpha, ComponentState... states)Registers a highlight alpha channel value for the specific component states.voidregisterHighlightColorScheme(RadianceColorScheme stateHighlightScheme, ComponentState... states)Registers a highlight color scheme for the specific component state if the component state is notnull, or a global highlight color scheme otherwise.(package private) RadianceColorSchemeBundletransform(ColorSchemeTransform transform)Creates a new color scheme bundle that has the same settings as this color scheme bundle with the addition of applying the specified color scheme transformation on all the relevant color schemes
-
-
-
Field Detail
-
activeColorScheme
private RadianceColorScheme activeColorScheme
The active color scheme of this bundle.
-
enabledColorScheme
private RadianceColorScheme enabledColorScheme
The enabled color scheme of this bundle.
-
disabledColorScheme
private RadianceColorScheme disabledColorScheme
The disabled color scheme of this bundle.
-
stateAlphaMap
private java.util.Map<ComponentState,java.lang.Float> stateAlphaMap
Maps from component state to the alpha channel applied on color scheme. This map doesn't have to contain entries for allComponentStateinstances.
-
stateHighlightAlphaMap
private java.util.Map<ComponentState,java.lang.Float> stateHighlightAlphaMap
Maps from component state to the alpha channel applied on highlight color scheme. This map doesn't have to contain entries for allComponentStateinstances.
-
pressedScheme
private RadianceColorScheme pressedScheme
If there is no explicitly registered color scheme for pressed component state, this field will contain a synthesized color scheme for the pressed state.
-
disabledSelectedScheme
private RadianceColorScheme disabledSelectedScheme
If there is no explicitly registered color scheme for the disabled selected component state, this field will contain a synthesized color scheme for the disabled selected state.- See Also:
ComponentState.DISABLED_SELECTED
-
selectedScheme
private RadianceColorScheme selectedScheme
If there is no explicitly registered color scheme for the selected component state, this field will contain a synthesized color scheme for the selected state.- See Also:
ComponentState.SELECTED
-
rolloverSelectedScheme
private RadianceColorScheme rolloverSelectedScheme
If there is no explicitly registered color scheme for the rollover selected component state, this field will contain a synthesized color scheme for the rollover selected state.- See Also:
ComponentState.ROLLOVER_SELECTED
-
colorSchemeMap
private java.util.Map<RadianceThemingSlices.ColorSchemeAssociationKind,java.util.Map<ComponentState,RadianceColorScheme>> colorSchemeMap
Maps from color scheme association kinds to the map of color schemes. Different visual parts of controls in the specific decoration are can be painted with different color schemes. For example, a rollover button can use a light orange scheme for the gradient fill and a dark gray scheme for the border. In this case, this map will have:- An entry with key
RadianceThemingSlices.ColorSchemeAssociationKind.FILL. This entry has a map entry with keyComponentState.SELECTEDand value that points to the light orange scheme. - An entry with key
RadianceThemingSlices.ColorSchemeAssociationKind.BORDER. This entry has a map entry with keyComponentState.SELECTEDand value that points to the dark gray scheme.
- An entry with key
-
bestFillMap
private java.util.Map<RadianceThemingSlices.ColorSchemeAssociationKind,java.util.Map<ComponentState,ComponentState>> bestFillMap
-
-
Constructor Detail
-
RadianceColorSchemeBundle
public RadianceColorSchemeBundle(RadianceColorScheme activeColorScheme, RadianceColorScheme enabledColorScheme, RadianceColorScheme disabledColorScheme)
Creates a new color scheme bundle.- Parameters:
activeColorScheme- The active color scheme of this bundle.enabledColorScheme- The enabled color scheme of this bundle.disabledColorScheme- The disabled color scheme of this bundle.
-
-
Method Detail
-
registerAlpha
public void registerAlpha(float alpha, ComponentState... states)Registers an alpha channel value for the specific component states.- Parameters:
alpha- Alpha channel value.states- Component states.
-
registerColorScheme
public void registerColorScheme(RadianceColorScheme stateColorScheme, ComponentState... states)
Registers a color scheme for the specific component state.- Parameters:
stateColorScheme- Color scheme for the specified component state.states- Component states.
-
registerHighlightColorScheme
public void registerHighlightColorScheme(RadianceColorScheme stateHighlightScheme, ComponentState... states)
Registers a highlight color scheme for the specific component state if the component state is notnull, or a global highlight color scheme otherwise.- Parameters:
stateHighlightScheme- Highlight color scheme for the specified component state.states- Component states. Ifnull, the specified color scheme will be applied for all states left unspecified.
-
registerHighlightAlpha
public void registerHighlightAlpha(float alpha, ComponentState... states)Registers a highlight alpha channel value for the specific component states.- Parameters:
alpha- Highlight alpha channel value.states- Component states.
-
getColorScheme
public RadianceColorScheme getColorScheme(ComponentState componentState)
Returns the color scheme of the specified component in the specified component state.- Parameters:
componentState- Component state.- Returns:
- The color scheme of the component in the specified component state.
-
hasHighlightAlphaFor
public boolean hasHighlightAlphaFor(ComponentState componentState)
-
getHighlightAlpha
public float getHighlightAlpha(ComponentState componentState)
Returns the alpha channel of the highlight color schemes for the specified component state. Before calling this API, callhasHighlightAlphaFor(ComponentState). This API returns 1.0f for states that do not have an explicitly registered alpha channel value.- Parameters:
componentState- Component state.- Returns:
- Highlight color scheme alpha channel.
-
hasAlphaFor
public boolean hasAlphaFor(ComponentState componentState)
-
getAlpha
public float getAlpha(ComponentState componentState)
Returns the alpha channel of color schemes for the specified component state. Before calling this API, callhasAlphaFor(ComponentState). This API returns 1.0f for states that do not have an explicitly registered alpha channel value.- Parameters:
componentState- Component state.- Returns:
- Color scheme alpha channel.
-
getActiveColorScheme
public RadianceColorScheme getActiveColorScheme()
Returns the active color scheme of this bundle.- Returns:
- The active color scheme of this bundle.
-
getEnabledColorScheme
public RadianceColorScheme getEnabledColorScheme()
Returns the enabled color scheme of this bundle.- Returns:
- The enabled color scheme of this bundle.
-
getDisabledColorScheme
public RadianceColorScheme getDisabledColorScheme()
Returns the disabled color scheme of this bundle.- Returns:
- The disabled color scheme of this bundle.
-
registerColorScheme
public void registerColorScheme(RadianceColorScheme scheme, RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState... states)
Registers the color scheme to be used for the specified visual area of controls under the specified states. For example, if the light orange scheme has to be used for gradient fill for rollover selected and rollover controls, the parameters would be:scheme=light orange scheme-
associationKind=RadianceThemingSlices.ColorSchemeAssociationKind.FILL -
states=ComponentState.ROLLOVER_SELECTED,ComponentState.ROLLOVER_UNSELECTED
- Parameters:
scheme- Color scheme.associationKind- Color scheme association kind that specifies the visual areas of controls to be painted with this color scheme.states- Component states that further restrict the usage of the specified color scheme.
-
getColorScheme
public RadianceColorScheme getColorScheme(RadianceThemingSlices.ColorSchemeAssociationKind associationKind, ComponentState componentState, boolean allowFallback)
Returns the color scheme to be used for painting the specified visual area of the component under the specified component state.- Parameters:
associationKind- Color scheme association kind.componentState- Component state.allowFallback- If true, this method will return a color scheme for the fallback association kind.- Returns:
- Color scheme to be used for painting the specified visual area of the component under the specified component state.
- See Also:
registerColorScheme(RadianceColorScheme, ComponentState...)
-
transform
RadianceColorSchemeBundle transform(ColorSchemeTransform transform)
Creates a new color scheme bundle that has the same settings as this color scheme bundle with the addition of applying the specified color scheme transformation on all the relevant color schemes- Parameters:
transform- Color scheme transformation.- Returns:
- The new color scheme bundle.
-
getStatesWithAlpha
java.util.Set<ComponentState> getStatesWithAlpha()
Returns the set of all component states that have non-trivial alpha associated with them. Non-trivial alpha is a value that is strictly less than 1.0.- Returns:
- All component states that have associated non-trivial alpha values.
-
-