fcmodeler.view.figures
Class RoundRectangleNodeShape

java.lang.Object
  |
  +--fcmodeler.view.figures.RoundRectangleNodeShape
All Implemented Interfaces:
java.lang.Cloneable, NodeShape

public class RoundRectangleNodeShape
extends java.lang.Object
implements NodeShape

A NodeShape implementation providing a round rectangular node shape. RoundRectangleNodeShape uses a RoundRectangle2D.Double as its Shape object.

Since:
JDK1.3
Version:
$Revision: 1.4 $
Author:
Zach Cox

Constructor Summary
RoundRectangleNodeShape()
          Creates a new RoundRectangleNodeShape with coordinates (0,0), zero width, and zero height.
RoundRectangleNodeShape(double x, double y, double w, double h)
          Creates a new RoundRectangleNodeShape with the specified coordinates, width, and height.
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this RoundRectangleNodeShape.
 void enclose(java.awt.geom.Rectangle2D rectangle)
          Ensures that this RoundRectangleNodeShape completely encloses the specified rectangle.
 java.awt.Shape getShape()
          Returns the Shape object represented by this RoundRectangleNodeshape.
 void position(double x, double y)
          Positions this RoundRectangleNodeshape at the specified coordinates.
 java.lang.String toString()
           
 void transform(java.awt.geom.AffineTransform transform)
          Transforms this RoundRectangleNodeshape using the specified AffineTransform.
 void translate(double dx, double dy)
          Translates this RoundRectangleNodeshape by the specified x and y values.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoundRectangleNodeShape

public RoundRectangleNodeShape()
Creates a new RoundRectangleNodeShape with coordinates (0,0), zero width, and zero height.

RoundRectangleNodeShape

public RoundRectangleNodeShape(double x,
                               double y,
                               double w,
                               double h)
Creates a new RoundRectangleNodeShape with the specified coordinates, width, and height.
Parameters:
x - the x-coordinate of this RoundRectangleNodeShape.
y - the y-coordinate of this RoundRectangleNodeShape.
w - the width of this RoundRectangleNodeShape.
h - the height of this RoundRectangleNodeShape.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this RoundRectangleNodeShape. The returned Object is guaranteed to be of type RoundRectangleNodeShape and is also guaranteed to have copies of any mutable fields of this object.
Specified by:
clone in interface NodeShape
Overrides:
clone in class java.lang.Object
Returns:
a clone of this RoundRectangleNodeShape.
Throws:
java.lang.CloneNotSupportedException - should never be thrown, as this class extends Object and implements Cloneable by implementing NodeShape.

enclose

public void enclose(java.awt.geom.Rectangle2D rectangle)
Ensures that this RoundRectangleNodeShape completely encloses the specified rectangle.
Specified by:
enclose in interface NodeShape
Parameters:
rectangle - the rectangle to enclose.

getShape

public java.awt.Shape getShape()
Returns the Shape object represented by this RoundRectangleNodeshape.
Specified by:
getShape in interface NodeShape
Returns:
the Shape object represented by this RoundRectangleNodeshape.

position

public void position(double x,
                     double y)
Positions this RoundRectangleNodeshape at the specified coordinates. Note that calling this method may create a new Shape instance. Therefore, a new call to getShape may be necessary after calling this method.
Specified by:
position in interface NodeShape
Parameters:
x - the x-coordinate of the new position.
y - the y-coordinate of the new position.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

transform

public void transform(java.awt.geom.AffineTransform transform)

Transforms this RoundRectangleNodeshape using the specified AffineTransform. Note that calling this method may create a new Shape instance. Therefore, a new call to getShape may be necessary after calling this method.

This method will throw an UnsupportedOperationException until a way to modify a Rectangle2D.Double based on the specified AffineTransform is found.

Specified by:
transform in interface NodeShape
Parameters:
transform - the AffineTransform used to transform this RoundRectangleNodeshape object.

translate

public void translate(double dx,
                      double dy)
Translates this RoundRectangleNodeshape by the specified x and y values. Note that calling this method may create a new Shape instance. Therefore, a new call to getShape may be necessary after calling this method.
Specified by:
translate in interface NodeShape
Parameters:
dx - the amount to translate the x direction.
dy - the amount to translate in the y direction.