fcmodeler.view
Class NodeFigure

java.lang.Object
  |
  +--diva.canvas.AbstractFigure
        |
        +--fcmodeler.view.NodeFigure
All Implemented Interfaces:
diva.canvas.CanvasComponent, diva.canvas.Figure, PermanentFigure, diva.util.UserObjectContainer, diva.canvas.VisibleComponent

public class NodeFigure
extends diva.canvas.AbstractFigure
implements PermanentFigure

A Figure representing a node. NodeFigure consists of an arbitrary shape with a string label. The shape is backed by a BasicFigure and the label is backed by a LabelFigure.

Since:
JDK1.3
Version:
$Revision: 1.3 $
Author:
Julie Dickerson , Zach Cox

Constructor Summary
NodeFigure()
          Creates a new NodeFigure using an empty label.
NodeFigure(diva.canvas.toolbox.LabelFigure label)
          Creates a new NodeFigure using the specified LabelFigure.
 
Method Summary
 diva.canvas.toolbox.BasicFigure getFigure()
          Returns the BasicFigure used for rendering this node figure.
 diva.canvas.toolbox.LabelFigure getLabelFigure()
          Returns the LabelFigure used for the label of this node.
 NodeShape getNodeShape()
          Returns the NodeShape used to determine the shape of this node.
 diva.canvas.toolbox.BasicFigure getPermanentFigure()
          Returns the permanent BasicFigure for this node.
 NodeShape getPermanentNodeShape()
          Returns the permanent NodeShape for this node.
 java.awt.Shape getShape()
          Returns the outline Shape of this node.
 void paint(java.awt.Graphics2D g)
          Paints this node figure.
 void setLabel(java.lang.String label)
          Sets the label for this node to the specified String.
 void setNodeShape(NodeShape nodeShape)
          Sets the NodeShape for this node to the specified NodeShape.
 void setPermanentNodeShape(NodeShape nodeShape)
          Sets the permanent NodeShape for this node to the specified NodeShape.
 void transform(java.awt.geom.AffineTransform affineTransform)
          Transforms this node using the specifed AffineTransform.
 void translate(double x, double y)
          Translates this node by the specified x and y distances.
 void usePermanents()
          Sets the visual attributes for this node to those stored in the permanent BasicFigure.
 
Methods inherited from class diva.canvas.AbstractFigure
contains, getBounds, getInteractor, getLayer, getParent, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setUserObject, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeFigure

public NodeFigure()

Creates a new NodeFigure using an empty label. Equivalent to calling

new NodeFigure(new LabelFigure(" "));


NodeFigure

public NodeFigure(diva.canvas.toolbox.LabelFigure label)
Creates a new NodeFigure using the specified LabelFigure.
Parameters:
label - the label to use for this NodeFigure.
Method Detail

getFigure

public diva.canvas.toolbox.BasicFigure getFigure()
Returns the BasicFigure used for rendering this node figure.
Returns:
the BasicFigure used for rendering this node figure.

getLabelFigure

public diva.canvas.toolbox.LabelFigure getLabelFigure()
Returns the LabelFigure used for the label of this node.
Returns:
the LabelFigure used for the label of this node.

getNodeShape

public NodeShape getNodeShape()
Returns the NodeShape used to determine the shape of this node.
Returns:
the NodeShape used to determine the shape of this node.

getPermanentFigure

public diva.canvas.toolbox.BasicFigure getPermanentFigure()
Returns the permanent BasicFigure for this node.
Returns:
the permanent BasicFigure for this node.

getPermanentNodeShape

public NodeShape getPermanentNodeShape()
Returns the permanent NodeShape for this node.
Returns:
the permanent NodeShape for this node.

getShape

public java.awt.Shape getShape()
Returns the outline Shape of this node.
Overrides:
getShape in class diva.canvas.AbstractFigure
Returns:
the outline Shape of this node.

paint

public void paint(java.awt.Graphics2D g)
Paints this node figure. The BasicFigure is painted first, followed by the LabelFigure.
Overrides:
paint in class diva.canvas.AbstractFigure
Parameters:
g - the graphics context to paint to.

setLabel

public void setLabel(java.lang.String label)
Sets the label for this node to the specified String.
Parameters:
label - the new label for this node.

setNodeShape

public void setNodeShape(NodeShape nodeShape)
Sets the NodeShape for this node to the specified NodeShape.
Parameters:
nodeShape - the new NodeShape for this node.

setPermanentNodeShape

public void setPermanentNodeShape(NodeShape nodeShape)
Sets the permanent NodeShape for this node to the specified NodeShape.
Parameters:
nodeShape - the new permanent NodeShape for this node.

transform

public void transform(java.awt.geom.AffineTransform affineTransform)
Transforms this node using the specifed AffineTransform.
Overrides:
transform in class diva.canvas.AbstractFigure
Parameters:
affineTransform - the transform to apply to this node.

translate

public void translate(double x,
                      double y)
Translates this node by the specified x and y distances.
Overrides:
translate in class diva.canvas.AbstractFigure
Parameters:
x - the x-distance to translate.
y - the y-distance to translate.

usePermanents

public void usePermanents()
Sets the visual attributes for this node to those stored in the permanent BasicFigure. This can be used to revert back to a permanent visual state after modifying the appearance of this node.
Specified by:
usePermanents in interface PermanentFigure