org.jvnet.substance.api
Class SubstanceColorSchemeBundle

java.lang.Object
  extended by org.jvnet.substance.api.SubstanceColorSchemeBundle
All Implemented Interfaces:
java.lang.Cloneable

public class SubstanceColorSchemeBundle
extends java.lang.Object
implements java.lang.Cloneable

Color scheme bundle. Defines the visual appearance of a single decoration area of a skin.

Author:
Kirill Grouchnikov
See Also:
DecorationAreaType, SubstanceSkin

Field Summary
protected  SubstanceColorScheme activeColorScheme
          The active color scheme of this bundle.
protected  SubstanceColorScheme defaultColorScheme
          The default color scheme of this bundle.
protected  SubstanceColorScheme disabledColorScheme
          The disabled color scheme of this bundle.
protected  SubstanceColorScheme disabledSelectedScheme
          If there is no explicitly registered color scheme for the disabled selected component states, this field will contain a synthesized color scheme for the disabled selected state.
protected  SubstanceColorScheme pressedScheme
          If there is no explicitly registered color scheme for pressed component states, this field will contain a synthesized color scheme for a pressed state.
protected  java.util.Map<ComponentState,java.lang.Float> stateAlphaMap
          Maps from component state to the alpha channel applied on color scheme.
protected  java.util.Map<ComponentState,SubstanceColorScheme> stateBorderColorSchemeMap
          Maps from component state to the matching color schemes for border color schemes.
protected  java.util.Map<ComponentState,SubstanceColorScheme> stateColorSchemeMap
          Maps from component state to the matching color schemes.
protected  java.util.Map<ComponentState,SubstanceColorScheme> stateHighlightColorSchemeMap
          Maps from component state to the matching color schemes for highlight color schemes.
protected  java.util.Map<ComponentState,java.lang.Float> stateHighlightSchemeAlphaMap
          Maps from component state to the alpha channel applied on highlight color scheme.
 
Constructor Summary
SubstanceColorSchemeBundle(SubstanceColorScheme activeColorScheme, SubstanceColorScheme defaultColorScheme, SubstanceColorScheme disabledColorScheme)
          Creates a new color scheme bundle.
 
Method Summary
protected  java.lang.Object clone()
           
 SubstanceColorScheme getActiveColorScheme()
          Returns the active color scheme of this bundle.
 float getAlpha(java.awt.Component comp, ComponentState componentState)
          Returns the alpha channel of the color scheme of the component.
 SubstanceColorScheme getBorderColorScheme(java.awt.Component comp, ComponentState componentState)
          Returns the color scheme for painting component border in the specified state.
 SubstanceColorScheme getColorScheme(java.awt.Component comp, ComponentState componentState, boolean toIgnoreHighlights)
          Returns the color scheme of the specified component in the specified component state.
 SubstanceColorScheme getDefaultColorScheme()
          Returns the default color scheme of this bundle.
 SubstanceColorScheme getDisabledColorScheme()
          Returns the disabled color scheme of this bundle.
 float getHighlightAlpha(java.awt.Component comp, ComponentState componentState)
          Returns the alpha channel of the highlight color scheme of the component.
 SubstanceColorScheme getHighlightColorScheme(java.awt.Component comp, ComponentState componentState)
          Returns the highlight color scheme of the component.
 void registerBorderColorScheme(SubstanceColorScheme stateBorderScheme, ComponentState... states)
          Registers a border color scheme for the specific component state if the component state is not null, or a global border color scheme otherwise.
 void registerColorScheme(SubstanceColorScheme stateColorScheme, ComponentState... states)
          Registers a color scheme for the specific component state.
 void registerColorScheme(SubstanceColorScheme stateColorScheme, float alpha, ComponentState... states)
          Registers a color scheme for the specific component state.
 void registerHighlightColorScheme(SubstanceColorScheme stateHighlightScheme, ComponentState... states)
          Registers a highlight color scheme for the specific component state if the component state is not null, or a global highlight color scheme otherwise.
 void registerHighlightColorScheme(SubstanceColorScheme stateHighlightScheme, float alpha, ComponentState... states)
          Registers a highlight color scheme for the specific component state if the component state is not null, or a global highlight color scheme otherwise.
 SubstanceColorSchemeBundle 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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activeColorScheme

protected SubstanceColorScheme activeColorScheme
The active color scheme of this bundle.


defaultColorScheme

protected SubstanceColorScheme defaultColorScheme
The default color scheme of this bundle.


disabledColorScheme

protected SubstanceColorScheme disabledColorScheme
The disabled color scheme of this bundle.


stateColorSchemeMap

protected java.util.Map<ComponentState,SubstanceColorScheme> stateColorSchemeMap
Maps from component state to the matching color schemes. This map doesn't have to contain entries for all ComponentState instances.


stateAlphaMap

protected 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 all ComponentState instances.


stateHighlightColorSchemeMap

protected java.util.Map<ComponentState,SubstanceColorScheme> stateHighlightColorSchemeMap
Maps from component state to the matching color schemes for highlight color schemes. This map doesn't have to contain entries for all ComponentState instances.


stateHighlightSchemeAlphaMap

protected java.util.Map<ComponentState,java.lang.Float> stateHighlightSchemeAlphaMap
Maps from component state to the alpha channel applied on highlight color scheme. This map doesn't have to contain entries for all ComponentState instances.


stateBorderColorSchemeMap

protected java.util.Map<ComponentState,SubstanceColorScheme> stateBorderColorSchemeMap
Maps from component state to the matching color schemes for border color schemes. This map doesn't have to contain entries for all ComponentState instances.


pressedScheme

protected SubstanceColorScheme pressedScheme
If there is no explicitly registered color scheme for pressed component states, this field will contain a synthesized color scheme for a pressed state.


disabledSelectedScheme

protected SubstanceColorScheme disabledSelectedScheme
If there is no explicitly registered color scheme for the disabled selected component states, this field will contain a synthesized color scheme for the disabled selected state.

Constructor Detail

SubstanceColorSchemeBundle

public SubstanceColorSchemeBundle(SubstanceColorScheme activeColorScheme,
                                  SubstanceColorScheme defaultColorScheme,
                                  SubstanceColorScheme disabledColorScheme)
Creates a new color scheme bundle.

Parameters:
activeColorScheme - The active color scheme of this bundle.
defaultColorScheme - The default color scheme of this bundle.
disabledColorScheme - The disabled color scheme of this bundle.
Method Detail

registerColorScheme

public void registerColorScheme(SubstanceColorScheme stateColorScheme,
                                float alpha,
                                ComponentState... states)
Registers a color scheme for the specific component state.

Parameters:
stateColorScheme - Color scheme for the specified component state.
alpha - Alpha channel for the color scheme.
states - Component states.

registerColorScheme

public void registerColorScheme(SubstanceColorScheme 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(SubstanceColorScheme stateHighlightScheme,
                                         ComponentState... states)
Registers a highlight color scheme for the specific component state if the component state is not null, or a global highlight color scheme otherwise.

Parameters:
stateHighlightScheme - Highlight color scheme for the specified component state.
states - Component states. If null, the specified color scheme will be applied for all states left unspecified.

registerHighlightColorScheme

public void registerHighlightColorScheme(SubstanceColorScheme stateHighlightScheme,
                                         float alpha,
                                         ComponentState... states)
Registers a highlight color scheme for the specific component state if the component state is not null, or a global highlight color scheme otherwise.

Parameters:
stateHighlightScheme - Highlight color scheme for the specified component state.
alpha - Alpha channel for the highlight color scheme.
states - Component states. If null, the specified color scheme will be applied for all states left unspecified.

getColorScheme

public SubstanceColorScheme getColorScheme(java.awt.Component comp,
                                           ComponentState componentState,
                                           boolean toIgnoreHighlights)
Returns the color scheme of the specified component in the specified component state.

Parameters:
comp - Component.
componentState - Component state.
toIgnoreHighlights - If true, the highlight scheme map will not be consulted.
Returns:
The color scheme of the component in the specified component state.

getHighlightColorScheme

public SubstanceColorScheme getHighlightColorScheme(java.awt.Component comp,
                                                    ComponentState componentState)
Returns the highlight color scheme of the component.

Parameters:
comp - Component.
componentState - Component state.
Returns:
Component highlight color scheme.

getHighlightAlpha

public 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 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.

getActiveColorScheme

public SubstanceColorScheme getActiveColorScheme()
Returns the active color scheme of this bundle.

Returns:
The active color scheme of this bundle.

getDefaultColorScheme

public SubstanceColorScheme getDefaultColorScheme()
Returns the default color scheme of this bundle.

Returns:
The default color scheme of this bundle.

getDisabledColorScheme

public SubstanceColorScheme getDisabledColorScheme()
Returns the disabled color scheme of this bundle.

Returns:
The disabled color scheme of this bundle.

getBorderColorScheme

public SubstanceColorScheme getBorderColorScheme(java.awt.Component comp,
                                                 ComponentState componentState)
Returns the color scheme for painting component border in the specified state.

Parameters:
comp - Component.
componentState - Component state.
Returns:
Color scheme for painting component border in the specified state.

registerBorderColorScheme

public void registerBorderColorScheme(SubstanceColorScheme stateBorderScheme,
                                      ComponentState... states)
Registers a border color scheme for the specific component state if the component state is not null, or a global border color scheme otherwise.

Parameters:
stateBorderScheme - Border color scheme for the specified component states.
states - Component states. If null, the specified color scheme will be applied for all states left unspecified.

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

transform

public SubstanceColorSchemeBundle 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.