org.apache.pivot.wtk.effects
Class ShadeDecorator

java.lang.Object
  extended by org.apache.pivot.wtk.effects.ShadeDecorator
All Implemented Interfaces:
Decorator

public class ShadeDecorator
extends Object
implements Decorator

Decorator that applies a "shade" to a component. The shade is a rectangle of the same size as the component that is painted over the component using a given color and opacity value.


Constructor Summary
ShadeDecorator()
          Creates a new ShadeDecorator with the default opacity and shade color.
ShadeDecorator(float opacity, Color color)
          Creates a new ShadeDecorator with the specified opacity and shade color.
 
Method Summary
 Bounds getBounds(Component componentArgument)
          Returns the bounding area of the decorator.
 Color getColor()
          Returns the color of the decorator
 float getOpacity()
          Returns the opacity of the decorator, in [0,1].
 AffineTransform getTransform(Component componentArgument)
          Returns the transformation the decorator applies to the component's coordinate space.
 Graphics2D prepare(Component componentArgument, Graphics2D graphicsArgument)
          Prepares the graphics context into which the component or prior decorator will paint.
 void setColor(Color color)
          Sets the color of the decorator
 void setColor(String color)
          Sets the color of the decorator
 void setOpacity(float opacity)
          Sets the opacity of the decorator.
 void setOpacity(Number opacity)
          Sets the opacity of the decorator.
 void update()
          Updates the graphics context into which the component or prior decorator was painted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShadeDecorator

public ShadeDecorator()
Creates a new ShadeDecorator with the default opacity and shade color.


ShadeDecorator

public ShadeDecorator(float opacity,
                      Color color)
Creates a new ShadeDecorator with the specified opacity and shade color.

Parameters:
opacity - The opacity of the shade, between 0 and 1, exclusive.
color - The color of the shade.
Method Detail

getOpacity

public float getOpacity()
Returns the opacity of the decorator, in [0,1].


setOpacity

public void setOpacity(float opacity)
Sets the opacity of the decorator.

Parameters:
opacity - A number between 0 (transparent) and 1 (opaque)

setOpacity

public void setOpacity(Number opacity)
Sets the opacity of the decorator.

Parameters:
opacity - A number between 0 (transparent) and 1 (opaque)

getColor

public Color getColor()
Returns the color of the decorator


setColor

public void setColor(Color color)
Sets the color of the decorator


setColor

public final void setColor(String color)
Sets the color of the decorator

Parameters:
color - Any of the color values recognized by Pivot.

prepare

public Graphics2D prepare(Component componentArgument,
                          Graphics2D graphicsArgument)
Description copied from interface: Decorator
Prepares the graphics context into which the component or prior decorator will paint. This method is called immediately prior to Component.paint(Graphics2D); decorators are called in descending order.

Specified by:
prepare in interface Decorator
Returns:
The graphics context that should be used by the component or prior decorators.

update

public void update()
Description copied from interface: Decorator
Updates the graphics context into which the component or prior decorator was painted. This method is called immediately after Component.paint(Graphics2D); decorators are called in ascending order.

Specified by:
update in interface Decorator

getBounds

public Bounds getBounds(Component componentArgument)
Description copied from interface: Decorator
Returns the bounding area of the decorator.

Specified by:
getBounds in interface Decorator
Returns:
The decorator's bounds, relative to the component's origin.

getTransform

public AffineTransform getTransform(Component componentArgument)
Description copied from interface: Decorator
Returns the transformation the decorator applies to the component's coordinate space.

Specified by:
getTransform in interface Decorator
Returns:
The decorator's transform.