|
Graphics2D Actor API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectg2d.glyph.Identifiable
g2d.glyph.Attributable
g2d.glyph.Glyphish
g2d.graph.GraphItem
g2d.graph.IOPNode
public class IOPNode
A node object for IOPGraph.
Nodes are distinguished
uniquely by their name. The name is set at construction
time and is used for testing of equality. The name must
be non-null otherwise runtime exceptions are thrown.
A node consists of a rectangular base glyph and a label (if not "") that is drawn as text above the base glyph. The label is always centered on top of the base. The base can have the shape of a rectangle/box or an ellipse. Following is a table showing which methods pertain to the base, label, and whole node.
| rectangular base | |
|---|---|
| textual label | |
| whole node |
| Field Summary |
|---|
| Fields inherited from class g2d.graph.GraphItem |
|---|
antiAliased, HIGHLIGHT, HIGHLIGHT_OFFSET |
| Fields inherited from class g2d.glyph.Glyphish |
|---|
DEBUG |
| Fields inherited from class g2d.glyph.Identifiable |
|---|
uid |
| Constructor Summary | |
|---|---|
IOPNode(IOPNode clone)
Construct a node cloning the given node. |
|
IOPNode(String name)
Construct default node with given name and no label. |
|
IOPNode(String name,
String label,
String shape,
Color borderColor,
Color fillColor)
Construct node with given name and label and use given attributes to create node base. |
|
| Method Summary | |
|---|---|
void |
dehighlight()
Remove background shapes used for highlighting. |
double |
distanceTo(Point2D p)
Calculate distance from this node to given point. |
boolean |
equals(Object o)
Two nodes are equal if their name is the same. |
Rectangle2D |
getBaseFrame()
Get rectangle of frame that defines shape of node base. |
Color |
getBorderColor()
Get the border color of the node base. |
Point2D |
getCenter()
Obtain center point of this node in double precision. |
Color |
getFillColor()
Get color used for filling the node base. |
double |
getHeight()
Get height of node (including base and label) in double precision. |
String |
getLabel()
Get text of node label. |
String |
getName()
Get the name of this node. |
String |
getNodeShape()
Get a string describing the shape of the node base. |
Point2D |
getPosition()
Get position of node as the top-left corner. |
double |
getWidth()
Get width of node (including base and label) in double precision. |
int |
hashCode()
Overriding method to comply with equals(Object). |
void |
highlight()
Highlight this node by drawing a background shape in GraphItem.HIGHLIGHT color overlapping
by GraphItem.HIGHLIGHT_OFFSET pixels. |
void |
paint(Graphics2D g2d)
|
void |
setBaseCenter(Point2D center)
Set position of node base to given center point. |
void |
setBaseDimension(double width,
double height)
Set size of node base. |
void |
setBorderColor(Color color)
Set the border color of the node base. |
void |
setCenter(Point2D center)
Move this node to given center point. |
void |
setFillColor(Color color)
Set the fill color of the node base. |
void |
setLabel(String label)
Set the text of node label. |
void |
setNodeShape(String shape)
Set the shape of the node base. |
String |
toString()
|
| Methods inherited from class g2d.graph.GraphItem |
|---|
getBounds, inside, intersects, transform |
| Methods inherited from class g2d.glyph.Glyphish |
|---|
keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paint, rotate, rotate, scale, setKeyAction, setMouseAction, shear, translate |
| Methods inherited from class g2d.glyph.Attributable |
|---|
getAttribute, getAttributeAsBoolean, getAttributeAsByte, getAttributeAsChar, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsShort, getAttributeAsString, getKeys, getStaticAttribute, getStaticKeys, isAttribute, isStaticAttribute, setAttribute, setStaticAttribute |
| Methods inherited from class g2d.glyph.Identifiable |
|---|
getObject, getUID, setUID |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IOPNode(String name)
name - String identifying node
public IOPNode(String name,
String label,
String shape,
Color borderColor,
Color fillColor)
name - String identifying nodelabel - String with label for nodeshape - String defining shape of node base
(such as "box", "rectangle", or "ellipse"
[default value])borderColor - Color of node base borderfillColor - Color used for filling node basepublic IOPNode(IOPNode clone)
clone - IOPNode to be cloned| Method Detail |
|---|
public String getName()
null.
public Point2D getCenter()
setCenter(java.awt.geom.Point2D)public void setCenter(Point2D center)
center - Point that denotes new center of this nodegetCenter()public void setNodeShape(String shape)
The change will become visible once the container of this node repaints.
shape - String describing the shape of node basegetNodeShape()public String getNodeShape()
setNodeShape(java.lang.String)public void setFillColor(Color color)
The change will become visible once the container of this node repaints.
color - Color used for filling node basegetFillColor()public Color getFillColor()
setFillColor(java.awt.Color)public void setBorderColor(Color color)
The change will become visible once the container of this node repaints.
color - Color used for border of node basegetBorderColor()public Color getBorderColor()
setBorderColor(java.awt.Color)
public void setBaseDimension(double width,
double height)
The change will become visible once the container of this node repaints.
width - Width of node base in double precisionheight - Height of node base in double precisionpublic void setBaseCenter(Point2D center)
The change will become visible once the container of this node repaints.
center - Point denoting center of node basepublic Rectangle2D getBaseFrame()
public void setLabel(String label)
null or an empty string
results in label not drawn.
The change will become visible once the container of this node repaints.
label - Text of node labelgetLabel()public String getLabel()
setLabel(java.lang.String)public double getWidth()
public double getHeight()
public Point2D getPosition()
public double distanceTo(Point2D p)
distanceTo in class GraphItemp - Point to compute distance to
public void highlight()
GraphItem.HIGHLIGHT color overlapping
by GraphItem.HIGHLIGHT_OFFSET pixels.
highlight in class GraphItempublic void dehighlight()
dehighlight in class GraphItempublic void paint(Graphics2D g2d)
paint in class GraphItempublic String toString()
toString in class Objectpublic boolean equals(Object o)
equals in class Objecto - Object to test equality with this IOPNode
true if this IOPNode is equal to
given Object, false otherwiseObject.equals(java.lang.Object)public int hashCode()
equals(Object).
hashCode in class Object
|
Graphics2D Actor API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||