org.jvnet.substance.painter.decoration
Class SubstanceDecorationUtilities

java.lang.Object
  extended by org.jvnet.substance.painter.decoration.SubstanceDecorationUtilities

public class SubstanceDecorationUtilities
extends java.lang.Object

Contains various utility methods related to decoration areas. This class is for internal use only.

Author:
Kirill Grouchnikov
See Also:
DecorationAreaType, SubstanceLookAndFeel.setDecorationType(JComponent, DecorationAreaType), SubstanceLookAndFeel#setDecorationType(JComponent, DecorationAreaType, boolean), SubstanceSkin#registerAsDecorationArea(org.jvnet.substance.api. SubstanceColorScheme, DecorationAreaType...), SubstanceSkin#registerDecorationAreaSchemeBundle(org.jvnet.substance.api. SubstanceColorSchemeBundle, DecorationAreaType...), SubstanceSkin#registerDecorationAreaSchemeBundle(org.jvnet.substance.api. SubstanceColorSchemeBundle, org.jvnet.substance.api.SubstanceColorScheme, DecorationAreaType...)

Constructor Summary
SubstanceDecorationUtilities()
           
 
Method Summary
static void clearDecorationType(javax.swing.JComponent comp)
          Clears the client properties related to the decoration area type.
static DecorationAreaType getDecorationType(java.awt.Component comp)
          Returns the decoration area type of the specified component.
static DecorationAreaType getImmediateDecorationType(java.awt.Component comp)
          Returns the immediate decoration area type of the specified component.
static void paintDecorationBackground(java.awt.Graphics g, java.awt.Component c, boolean force)
          Paints the decoration background on the specified component.
static void setDecorationType(javax.swing.JComponent comp, DecorationAreaType type)
          Sets the decoration type of the specified component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstanceDecorationUtilities

public SubstanceDecorationUtilities()
Method Detail

setDecorationType

public static void setDecorationType(javax.swing.JComponent comp,
                                     DecorationAreaType type)
Sets the decoration type of the specified component.

Parameters:
comp - Component.
type - Decoration type of the component and its children if isPropagatingToChildren is true.
isPropagatingToChildren - If true, the decoration type will be applied to the component children.

clearDecorationType

public static void clearDecorationType(javax.swing.JComponent comp)
Clears the client properties related to the decoration area type.

Parameters:
comp - Component.

getDecorationType

public static DecorationAreaType getDecorationType(java.awt.Component comp)
Returns the decoration area type of the specified component. The component and its ancestor hierarchy are scanned for the registered decoration area type. The farthest ancestor that was passed to #setDecorationType(JComponent, DecorationAreaType, boolean) with the isPropagatingToChildren not set to false (the second part is not checked for the component itself) defines the result.

Parameters:
comp - Component.
Returns:
Decoration area type of the component.

getImmediateDecorationType

public static DecorationAreaType getImmediateDecorationType(java.awt.Component comp)
Returns the immediate decoration area type of the specified component. The component is checked for the registered decoration area type. If #setDecorationType(JComponent, DecorationAreaType, boolean) was not called on this component, this method returns null.

Parameters:
comp - Component.
Returns:
Immediate decoration area type of the component.

paintDecorationBackground

public static void paintDecorationBackground(java.awt.Graphics g,
                                             java.awt.Component c,
                                             boolean force)
Paints the decoration background on the specified component. The decoration background is not painted when the force parameter is false and at least one of the following conditions holds:

Parameters:
g - Graphics context.
c - Component.
force - If true, the painting of decoration background is enforced.