fcmodeler.view.figures
Class FilledRectangleHead

java.lang.Object
  |
  +--fcmodeler.view.figures.FilledRectangleHead
All Implemented Interfaces:
java.lang.Cloneable, diva.canvas.connector.ConnectorEnd, ConnectorEndExt

public class FilledRectangleHead
extends java.lang.Object
implements ConnectorEndExt

This is a class to draw a filled rectangle shape at the end of a connector. The way the class works is almost similar with Arrowhead. The only different part is in its reshape() method. The _polygonValid variable is removed here because it does not serve any purpose

Author:
xein

Constructor Summary
FilledRectangleHead()
          Creates the FilledRectangleHead at position (0,0) with the normal angle (n = 0)
FilledRectangleHead(double x, double y, double normal)
          Creates the FilledRectangleHead at position (x,y) with the angle at normal rad
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this FilledRectangleHead.
 java.awt.geom.Rectangle2D getBounds()
          Get the bounding box of the shape used to draw this connector end.
 void getConnection(java.awt.geom.Point2D p)
          Gets the connection point into the given point
 void getOrigin(java.awt.geom.Point2D p)
          Gets the origin into the given point
 void paint(java.awt.Graphics2D g2D)
          Paint the filled-rectangle-head.
 void reshape()
          Recalculate the shape of the decoration
 void setFlipped(boolean flag)
          Sets the flipped attribute of the FilledRectangleHead object
 void setNormal(double angle)
          Sets the normal attribute of the FilledRectangleHead object
 void setOrigin(double x, double y)
          Sets the origin attribute of the FilledRectangleHead object
 java.lang.String toString()
          Get the String representation for FilledRectangleHead
 void translate(double x, double y)
          Translate the origin by the given x and y coordinates
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilledRectangleHead

public FilledRectangleHead()
Creates the FilledRectangleHead at position (0,0) with the normal angle (n = 0)

FilledRectangleHead

public FilledRectangleHead(double x,
                           double y,
                           double normal)
Creates the FilledRectangleHead at position (x,y) with the angle at normal rad
Parameters:
x - x-coordinate of this FilledRectangleHead object
y - y-coordinate of this FilledRectangleHead object
normal - the angle in radian
Method Detail

clone

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

setNormal

public void setNormal(double angle)
Sets the normal attribute of the FilledRectangleHead object
Specified by:
setNormal in interface diva.canvas.connector.ConnectorEnd
Parameters:
angle - the new angle in radian

setFlipped

public void setFlipped(boolean flag)
Sets the flipped attribute of the FilledRectangleHead object
Parameters:
flag - The new flipped value

setOrigin

public void setOrigin(double x,
                      double y)
Sets the origin attribute of the FilledRectangleHead object
Specified by:
setOrigin in interface diva.canvas.connector.ConnectorEnd
Parameters:
x - The new x-coordinate
y - The new y-coordinate

getBounds

public java.awt.geom.Rectangle2D getBounds()
Get the bounding box of the shape used to draw this connector end.
Specified by:
getBounds in interface diva.canvas.connector.ConnectorEnd
Returns:
The bounds value

getConnection

public void getConnection(java.awt.geom.Point2D p)
Gets the connection point into the given point
Specified by:
getConnection in interface diva.canvas.connector.ConnectorEnd
Parameters:
p - the point of the connector end

getOrigin

public void getOrigin(java.awt.geom.Point2D p)
Gets the origin into the given point
Specified by:
getOrigin in interface diva.canvas.connector.ConnectorEnd
Parameters:
p - point of origin

reshape

public void reshape()
Recalculate the shape of the decoration

paint

public void paint(java.awt.Graphics2D g2D)
Paint the filled-rectangle-head. This method assumes that the graphics context is already set up with the correct paint and stroke.
Specified by:
paint in interface diva.canvas.connector.ConnectorEnd
Parameters:
g2D - the reference to a Graphics2D object

translate

public void translate(double x,
                      double y)
Translate the origin by the given x and y coordinates
Specified by:
translate in interface diva.canvas.connector.ConnectorEnd
Parameters:
x - x-coordinate of this FilledRectangleHead object
y - y-coordinate of this FilledRectangleHead object

toString

public java.lang.String toString()
Get the String representation for FilledRectangleHead
Overrides:
toString in class java.lang.Object
Returns:
the String representation