public class IOPNode extends GraphItem implements java.lang.Comparable<IOPNode>
A node object for IOPGraph
.
Nodes are distinguished
uniquely by their id. The id is set at construction
time and is used for testing of equality. The id 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 |
Modifier and Type | Class and Description |
---|---|
static class |
IOPNode.NodeType |
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<IOPNode> |
COMPARATOR |
DotNodeAttributes |
dotNodeAttributes |
g2d.graph.xdotparser.visitor.xDotNode |
dotRendering |
java.lang.String |
id |
java.lang.String |
longName |
static java.util.Comparator<IOPNode> |
OCC_COMPARATOR |
protected int |
peripheries |
static int |
PERIPHERIES_DEFAULT |
static java.util.Comparator<IOPNode> |
RULE_COMPARATOR |
protected Seed |
seed |
java.lang.String |
shortName |
IOPNode.NodeType |
type |
antiAliased, gid, glyphList, HIGHLIGHT, HIGHLIGHT_OFFSET, highlighted
Constructor and Description |
---|
IOPNode(IOPNode.NodeType type,
java.lang.String id) |
IOPNode(IOPNode.NodeType type,
java.lang.String nodeId,
java.lang.String shortName,
java.lang.String longName)
Make a node with the final bits.
|
IOPNode(IOPNode.NodeType type,
java.lang.String nodeId,
java.lang.String shortName,
java.lang.String longName,
DotNodeAttributes nattrs) |
IOPNode(IOPNode.NodeType type,
java.lang.String nodeId,
java.lang.String shortName,
java.lang.String longName,
java.lang.String label,
java.lang.String shape,
java.awt.Color borderColor,
java.awt.Color fillColor,
int peripheries) |
IOPNode(IOPNode clone)
Construct a node cloning the given node.
|
IOPNode(java.lang.String id)
Construct default node with given id and no label.
|
IOPNode(java.lang.String id,
boolean interim) |
IOPNode(java.lang.String longName,
DotNodeAttributes nattrs) |
IOPNode(java.lang.String id,
int peripheries)
Construct default node with given id and no label.
|
IOPNode(java.lang.String id,
java.lang.String shape) |
IOPNode(java.lang.String nodeId,
java.lang.String longName,
DotNodeAttributes nattrs) |
IOPNode(java.lang.String id,
java.lang.String label,
java.lang.String shape,
java.awt.Color borderColor,
java.awt.Color fillColor)
Construct node with given id and label and use
given attributes to create node base.
|
IOPNode(java.lang.String id,
java.lang.String label,
java.lang.String shape,
java.awt.Color borderColor,
java.awt.Color fillColor,
boolean interim)
Construct node with given id and label and use
given attributes to create node base.
|
IOPNode(java.lang.String id,
java.lang.String label,
java.lang.String shape,
java.awt.Color borderColor,
java.awt.Color fillColor,
int peripheries)
Construct node with given id and label and use
given attributes to create node base.
|
IOPNode(java.lang.String id,
java.lang.String label,
java.lang.String shape,
java.awt.Color borderColor,
java.awt.Color fillColor,
int peripheries,
boolean interim) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
_toDotString() |
static int |
compareNodes(IOPNode n0,
IOPNode n1) |
int |
compareTo(IOPNode in) |
static int |
compareToAsOcc(IOPNode n0,
IOPNode n1) |
static int |
compareToAsRule(IOPNode n0,
IOPNode n1) |
void |
dehighlight()
Revert highlighting to previous state (if any).
|
java.lang.String |
deprecated_toDotString() |
double |
distanceTo(java.awt.geom.Point2D p)
Calculate distance from this node to given point.
|
boolean |
equals(java.lang.Object o)
Two nodes are equal if their id is the same.
|
java.awt.geom.Rectangle2D |
getBaseFrame()
Get rectangle of frame that defines shape of node base.
|
java.awt.Color |
getBorderColor()
Get the border color
|
java.awt.geom.Point2D |
getCenter()
Obtain center point of this node in double precision.
|
java.awt.Color |
getFillColor()
Get color used for filling the node base.
|
double |
getHeight()
Get height of node (including base and label)
in double precision.
|
java.lang.String |
getLabel()
Get text of node label.
|
java.lang.String |
getName()
Get the id of this node.
|
java.lang.String |
getNodeShape()
Get a string describing the shape of the node base.
|
java.awt.geom.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 or edge.
|
static IOPNode |
makeOcc(java.lang.String nodeId,
java.lang.String shortLabel,
java.lang.String longLabel,
DotNodeAttributes nattrs) |
static IOPNode |
makeOcc(java.lang.String nodeId,
java.lang.String shortLabel,
java.lang.String longLabel,
java.lang.String shape,
java.awt.Color color,
java.awt.Color fillColor) |
static IOPNode |
makeOcc(java.lang.String nodeId,
java.lang.String shortLabel,
java.lang.String longLabel,
java.lang.String shape,
java.awt.Color color,
java.awt.Color fillColor,
int peripheries) |
static IOPNode |
makeRule(java.lang.String nodeId,
java.lang.String shortLabel,
java.lang.String longLabel,
DotNodeAttributes nattrs) |
static IOPNode |
makeRule(java.lang.String nodeId,
java.lang.String shortLabel,
java.lang.String longLabel,
java.lang.String shape,
java.awt.Color color,
java.awt.Color fillColor) |
static IOPNode |
makeRule(java.lang.String nodeId,
java.lang.String shortLabel,
java.lang.String longLabel,
java.lang.String shape,
java.awt.Color color,
java.awt.Color fillColor,
int peripheries) |
protected void |
mimic(IOPNode doppel) |
void |
paint(java.awt.Graphics2D g2d) |
protected void |
revert(java.awt.geom.Point2D center) |
Glyph |
scaleBase(int thickness)
Produces a glyph that is simply the scale of the current base glyph.
|
void |
setBaseCenter(java.awt.geom.Point2D center)
Set position of node base to given center point.
|
void |
setBaseDimension(double width,
double height)
Set size of node base.
|
void |
setBorderColor(java.awt.Color color)
Set the border color of the node base.
|
void |
setCenter(java.awt.geom.Point2D center)
Move this node to given center point.
|
void |
setDotLayout(IOPGraph graph,
java.awt.geom.Point2D center,
double width,
double height,
java.lang.String _draw_,
java.lang.String _ldraw_,
double graphHeight) |
void |
setFillColor(java.awt.Color color)
Set the fill color of the node base.
|
void |
setLabel(java.lang.String label)
Set the text of node label.
|
void |
setNodeShape(java.lang.String shape)
Set the shape of the node base.
|
void |
setNodeShape(g2d.graph.xdotparser.visitor.xDotNode hints) |
protected void |
setRendering(g2d.graph.xdotparser.visitor.xDotNode info) |
java.awt.Shape |
string2Shape(java.lang.String shape,
double x,
double y,
double width,
double height) |
java.lang.String |
toDotString() |
java.lang.String |
toString() |
void |
updateFillColor() |
getBounds, gid, inside, intersects, isHighlighted, isSelected, setSelected, transform
keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, rotate, rotate, scale, setKeyAction, setMouseAction, shear, translate, unsetMouseAction
_getAttribute, _setAttribute, getAttribute, getAttributeAsBoolean, getAttributeAsByte, getAttributeAsChar, getAttributeAsClosure, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsShort, getAttributeAsString, getKeys, getStaticAttribute, getStaticKeys, isAttribute, isStaticAttribute, removeAllAttributes, removeAllStaticAttributes, removeAttribute, removeStaticAttribute, setAttribute, setStaticAttribute, showAttributes, showAttributes
public final IOPNode.NodeType type
public final java.lang.String id
public final java.lang.String longName
public final java.lang.String shortName
public static int PERIPHERIES_DEFAULT
protected int peripheries
public g2d.graph.xdotparser.visitor.xDotNode dotRendering
public DotNodeAttributes dotNodeAttributes
protected Seed seed
public static java.util.Comparator<IOPNode> COMPARATOR
public static java.util.Comparator<IOPNode> RULE_COMPARATOR
public static java.util.Comparator<IOPNode> OCC_COMPARATOR
public IOPNode(IOPNode.NodeType type, java.lang.String nodeId, java.lang.String shortName, java.lang.String longName)
type
- one of the IOPNode.NodeType
nodeId
- the nodes id, can be null, in which case we use its gid.shortName
- the short display namelongName
- the long display namepublic IOPNode(java.lang.String id)
id
- String identifying nodepublic IOPNode(IOPNode.NodeType type, java.lang.String id)
public IOPNode(java.lang.String nodeId, java.lang.String longName, DotNodeAttributes nattrs)
public IOPNode(java.lang.String longName, DotNodeAttributes nattrs)
public IOPNode(IOPNode.NodeType type, java.lang.String nodeId, java.lang.String shortName, java.lang.String longName, DotNodeAttributes nattrs)
public IOPNode(IOPNode.NodeType type, java.lang.String nodeId, java.lang.String shortName, java.lang.String longName, java.lang.String label, java.lang.String shape, java.awt.Color borderColor, java.awt.Color fillColor, int peripheries)
public IOPNode(java.lang.String id, int peripheries)
id
- String identifying nodeperipheries
- the number of peripheriespublic IOPNode(java.lang.String id, java.lang.String shape)
public IOPNode(java.lang.String id, boolean interim)
public IOPNode(java.lang.String id, java.lang.String label, java.lang.String shape, java.awt.Color borderColor, java.awt.Color fillColor)
id
- 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(java.lang.String id, java.lang.String label, java.lang.String shape, java.awt.Color borderColor, java.awt.Color fillColor, boolean interim)
id
- 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 baseinterim
- indicates that data will soon be augmented by dot layout info, so ...public IOPNode(java.lang.String id, java.lang.String label, java.lang.String shape, java.awt.Color borderColor, java.awt.Color fillColor, int peripheries, boolean interim)
public IOPNode(java.lang.String id, java.lang.String label, java.lang.String shape, java.awt.Color borderColor, java.awt.Color fillColor, int peripheries)
id
- 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 baseperipheries
- the number of borders the node exhibits.public IOPNode(IOPNode clone)
clone
- IOPNode to be clonedprotected void setRendering(g2d.graph.xdotparser.visitor.xDotNode info)
public void setDotLayout(IOPGraph graph, java.awt.geom.Point2D center, double width, double height, java.lang.String _draw_, java.lang.String _ldraw_, double graphHeight)
protected void mimic(IOPNode doppel)
protected void revert(java.awt.geom.Point2D center)
public java.lang.String getName()
null
.public java.awt.geom.Point2D getCenter()
setCenter(java.awt.geom.Point2D)
public void setCenter(java.awt.geom.Point2D center)
center
- Point that denotes new center of this nodegetCenter()
public static IOPNode makeOcc(java.lang.String nodeId, java.lang.String shortLabel, java.lang.String longLabel, DotNodeAttributes nattrs)
public static IOPNode makeOcc(java.lang.String nodeId, java.lang.String shortLabel, java.lang.String longLabel, java.lang.String shape, java.awt.Color color, java.awt.Color fillColor)
public static IOPNode makeOcc(java.lang.String nodeId, java.lang.String shortLabel, java.lang.String longLabel, java.lang.String shape, java.awt.Color color, java.awt.Color fillColor, int peripheries)
public static IOPNode makeRule(java.lang.String nodeId, java.lang.String shortLabel, java.lang.String longLabel, DotNodeAttributes nattrs)
public static IOPNode makeRule(java.lang.String nodeId, java.lang.String shortLabel, java.lang.String longLabel, java.lang.String shape, java.awt.Color color, java.awt.Color fillColor)
public static IOPNode makeRule(java.lang.String nodeId, java.lang.String shortLabel, java.lang.String longLabel, java.lang.String shape, java.awt.Color color, java.awt.Color fillColor, int peripheries)
public void updateFillColor()
public void setNodeShape(java.lang.String shape)
The change will become visible once the container of this node repaints.
shape
- String describing the shape of node basegetNodeShape()
public void setNodeShape(g2d.graph.xdotparser.visitor.xDotNode hints)
public java.awt.Shape string2Shape(java.lang.String shape, double x, double y, double width, double height)
public java.lang.String getNodeShape()
setNodeShape(java.lang.String)
public void setFillColor(java.awt.Color color)
The change will become visible once the container of this node repaints.
color
- Color used for filling node basegetFillColor()
public java.awt.Color getFillColor()
setFillColor(java.awt.Color)
public void setBorderColor(java.awt.Color color)
The change will become visible once the container of this node repaints.
color
- Color used for border of node basegetBorderColor()
public java.awt.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(java.awt.geom.Point2D center)
The change will become visible once the container of this node repaints.
center
- Point denoting center of node basepublic java.awt.geom.Rectangle2D getBaseFrame()
public void setLabel(java.lang.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 java.lang.String getLabel()
setLabel(java.lang.String)
public double getWidth()
public double getHeight()
public java.awt.geom.Point2D getPosition()
public double distanceTo(java.awt.geom.Point2D p)
distanceTo
in class GraphItem
p
- Point to compute distance topublic Glyph scaleBase(int thickness)
thickness
- of the border b/w base and scaled base; thickness is measured in pixels; positive means bigger; negative means smaller.public void highlight()
GraphItem
public void dehighlight()
GraphItem
dehighlight
in class GraphItem
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object to test equality with this IOPNodetrue
if this IOPNode is equal to
given Object, false
otherwiseObject.equals(java.lang.Object)
public int hashCode()
equals(Object)
.hashCode
in class java.lang.Object
public int compareTo(IOPNode in)
compareTo
in interface java.lang.Comparable<IOPNode>
public java.lang.String _toDotString()
public java.lang.String toDotString()
public java.lang.String deprecated_toDotString()