org.apache.pivot.wtk.media.drawing
Class Shape

java.lang.Object
  extended by org.apache.pivot.wtk.media.drawing.Shape
Direct Known Subclasses:
Arc, CubicCurve, Ellipse, Group, Line, Path, QuadCurve, Rectangle, Text

public abstract class Shape
extends Object

Abstract base class for shapes.

TODO Add a strokeDashArray property.


Nested Class Summary
static class Shape.Rotate
          Represents a rotation transformation.
static class Shape.Scale
          Represents a scale transformation.
static class Shape.Transform
          Interface encapsulating an affine transformation.
 class Shape.TransformSequence
          Represents a sequence of affine transformations applied to this shape.
static class Shape.Translate
          Represents a translation transformation.
 
Constructor Summary
Shape()
           
 
Method Summary
abstract  void draw(Graphics2D graphics)
           
 Bounds getBounds()
          Returns the bounds of the shape.
 Paint getFill()
           
 Point getOrigin()
           
 Group getParent()
           
 ListenerList<ShapeListener> getShapeListeners()
           
 ListenerList<ShapeTransformListener> getShapeTransformListeners()
           
 Paint getStroke()
           
 int getStrokeThickness()
           
 Bounds getTransformedBounds()
          Returns the transformed bounds of the shape.
 Shape.TransformSequence getTransforms()
           
 int getX()
           
 int getY()
           
protected  void invalidate()
           
protected  boolean isValid()
           
 boolean isVisible()
           
protected  void setBounds(int x, int y, int width, int height)
          Sets the bounds of the shape.
 void setFill(Paint fill)
           
 void setFill(String fill)
           
 void setOrigin(int x, int y)
           
 void setOrigin(Point origin)
           
protected  void setParent(Group parent)
           
 void setStroke(Paint stroke)
           
 void setStroke(String stroke)
           
 void setStrokeThickness(int strokeThickness)
           
 void setVisible(boolean visible)
           
 void setX(int x)
           
 void setY(int y)
           
protected  void update()
           
protected  void update(Bounds bounds)
           
protected  void update(int x, int y, int width, int height)
           
protected  void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shape

public Shape()
Method Detail

getParent

public Group getParent()

setParent

protected void setParent(Group parent)

getX

public int getX()

setX

public void setX(int x)

getY

public int getY()

setY

public void setY(int y)

getOrigin

public Point getOrigin()

setOrigin

public void setOrigin(int x,
                      int y)

setOrigin

public void setOrigin(Point origin)

getBounds

public Bounds getBounds()
Returns the bounds of the shape.

Returns:
The component's bounding area, including the stroke thickness. The x and y coordinates are relative to the parent group's origin.

setBounds

protected void setBounds(int x,
                         int y,
                         int width,
                         int height)
Sets the bounds of the shape.

Parameters:
x -
y -
width -
height -

getTransformedBounds

public Bounds getTransformedBounds()
Returns the transformed bounds of the shape.

Returns:
The resulting bounds after all transforms have been applied.

getFill

public Paint getFill()

setFill

public void setFill(Paint fill)

setFill

public final void setFill(String fill)

getStroke

public Paint getStroke()

setStroke

public void setStroke(Paint stroke)

setStroke

public final void setStroke(String stroke)

getStrokeThickness

public int getStrokeThickness()

setStrokeThickness

public void setStrokeThickness(int strokeThickness)

isVisible

public boolean isVisible()

setVisible

public void setVisible(boolean visible)

draw

public abstract void draw(Graphics2D graphics)

getTransforms

public Shape.TransformSequence getTransforms()

invalidate

protected void invalidate()

validate

protected void validate()

isValid

protected boolean isValid()

update

protected final void update()

update

protected final void update(Bounds bounds)

update

protected void update(int x,
                      int y,
                      int width,
                      int height)

getShapeListeners

public ListenerList<ShapeListener> getShapeListeners()

getShapeTransformListeners

public ListenerList<ShapeTransformListener> getShapeTransformListeners()