org.apache.pivot.wtk.effects
Class RotationDecorator

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

public class RotationDecorator
extends Object
implements Decorator

Decorator that rotates a component about its center.


Constructor Summary
RotationDecorator()
          Creates a new rotation decorator with the default theta value (zero).
RotationDecorator(double theta)
          Creates a new rotation decorator with the specified theta value.
 
Method Summary
 Bounds getBounds(Component component)
          Returns the bounding area of the decorator.
 double getTheta()
          Gets the rotation angle, in radians.
 AffineTransform getTransform(Component component)
          Returns the transformation the decorator applies to the component's coordinate space.
 Graphics2D prepare(Component component, Graphics2D graphics)
          Prepares the graphics context into which the component or prior decorator will paint.
 void setTheta(double theta)
          Sets the rotation angle, in radians.
 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

RotationDecorator

public RotationDecorator()
Creates a new rotation decorator with the default theta value (zero).


RotationDecorator

public RotationDecorator(double theta)
Creates a new rotation decorator with the specified theta value.

Parameters:
theta - The rotation angle, in radians.
Method Detail

getTheta

public double getTheta()
Gets the rotation angle, in radians.


setTheta

public void setTheta(double theta)
Sets the rotation angle, in radians.


prepare

public Graphics2D prepare(Component component,
                          Graphics2D graphics)
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()
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 component)
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 component)
Returns the transformation the decorator applies to the component's coordinate space.

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