Class RotationDecorator

  • All Implemented Interfaces:
    Decorator

    public class RotationDecorator
    extends java.lang.Object
    implements Decorator
    Decorator that rotates a component about its center.
    • Constructor Summary

      Constructors 
      Constructor Description
      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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Bounds getBounds​(Component component)
      Returns the bounding area of the decorator.
      double getTheta()  
      java.awt.geom.AffineTransform getTransform​(Component component)
      Returns the transformation the decorator applies to the component's coordinate space.
      java.awt.Graphics2D prepare​(Component component, java.awt.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.pivot.wtk.effects.Decorator

        update
    • 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()
        Returns:
        The rotation angle, in radians.
      • setTheta

        public void setTheta​(double theta)
        Sets the rotation angle, in radians.
        Parameters:
        theta - The rotation angle, in radians.
      • prepare

        public java.awt.Graphics2D prepare​(Component component,
                                           java.awt.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
        Parameters:
        component - The component the decorator is attached to.
        graphics - The graphics context to draw into.
        Returns:
        The graphics context that should be used by the component or prior decorators.
      • getBounds

        public Bounds getBounds​(Component component)
        Returns the bounding area of the decorator.

        This default simply returns the bounds of the component's size.

        Specified by:
        getBounds in interface Decorator
        Parameters:
        component - The component that the decorator is attached to.
        Returns:
        The decorator's bounds, relative to the component's origin.
      • getTransform

        public java.awt.geom.AffineTransform getTransform​(Component component)
        Returns the transformation the decorator applies to the component's coordinate space.

        This default simply returns a new AffineTransform.

        Specified by:
        getTransform in interface Decorator
        Parameters:
        component - The component the decorator is attached to.
        Returns:
        The decorator's transform.