public class Node
extends java.lang.Object
Edge
s. A node is given a width and height by the client. When a
layout places the node in the graph, it will determine the node's x and y
location. It may also modify the node's height.
A node represents both the input and the output for a
layout algorithm. The following fields are used as input to a graph layout:
width
- the node's width.
height
- the node's height.
outgoing
- the node's outgoing edges.
incoming
- the node's incoming edges.
incomingOffset
- the default attachment point for incoming
edges.
outgoingOffset
- the default attachment point for outgoing
edges.
The following fields are calculated by a graph layout and comprise the output:
Modifier and Type | Field and Description |
---|---|
java.lang.Object |
data
Clients may use this field to mark the Node with an arbitrary data
object.
|
int |
height
The height of this node.
|
EdgeList |
incoming
The edges for which this node is the target.
|
int |
incomingOffset
The default attachment point for incoming edges.
|
EdgeList |
outgoing
The edges for which this node is the source.
|
int |
outgoingOffset
The node's outgoing offset attachment point.
|
int |
rowOrder
Deprecated.
|
double |
sortValue
Deprecated.
for internal use only
|
int |
width
The node's width.
|
int |
x
The node's x coordinate.
|
int |
y
The node's y coordinate.
|
Constructor and Description |
---|
Node()
Constructs a new node.
|
Node(java.lang.Object data)
Constructs a node with the given data object
|
Node(java.lang.Object data,
Subgraph parent)
Constructs a node with the given data object and parent subgraph.
|
Node(Subgraph parent)
Constructs a node inside the given subgraph.
|
Modifier and Type | Method and Description |
---|---|
Node |
getLeft()
Returns a reference to a node located left from this one
|
int |
getOffsetIncoming()
Returns the incoming attachment point.
|
int |
getOffsetOutgoing()
Returns the outgoing attachment point.
|
Insets |
getPadding()
Returns the padding for this node or
null if the default
padding for the graph should be used. |
Subgraph |
getParent()
Returns the parent Subgraph or
null if there is no parent. |
Node |
getRight()
Returns a reference to a node located right from this one
|
int |
getRowConstraint()
Returns the row constraint for this node.
|
void |
setPadding(Insets padding)
Sets the padding.
|
void |
setParent(Subgraph parent)
Sets the parent subgraph.
|
void |
setRowConstraint(int value)
Sets the row sorting constraint for this node.
|
void |
setSize(Dimension size)
Sets the size of this node to the given dimension.
|
java.lang.String |
toString() |
public java.lang.Object data
public int height
public int rowOrder
public EdgeList incoming
public int incomingOffset
-1
indicates that the node's horizontal center should be used.public EdgeList outgoing
public double sortValue
public int outgoingOffset
public int width
public int x
public int y
public Node()
public Node(java.lang.Object data)
data
- an arbitrary data objectpublic Node(Subgraph parent)
parent
- the parent subgraphpublic Node(java.lang.Object data, Subgraph parent)
data
- an arbitrary data objectparent
- the parent subgraph or null
public int getOffsetIncoming()
public int getOffsetOutgoing()
public Insets getPadding()
null
if the default
padding for the graph should be used.null
public Subgraph getParent()
null
if there is no parent.
Subgraphs are only for use in CompoundDirectedGraphLayout
.null
public void setPadding(Insets padding)
null
indicates that the default padding
should be used.padding
- an insets or null
public void setParent(Subgraph parent)
parent
- the parentpublic void setRowConstraint(int value)
-1
. If two nodes have different values both >=
0, the node with the smaller constraint will be placed to the left of the
other node. In all other cases no relative placement is guaranteed.value
- the row constraintpublic int getRowConstraint()
public void setSize(Dimension size)
size
- the new sizepublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public Node getLeft()
Node
on the left from this onepublic Node getRight()
Node
on the right from this oneCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.