org.eclipse.draw2d.graph
Class Node

java.lang.Object
  extended byorg.eclipse.draw2d.graph.Node
Direct Known Subclasses:
Subgraph, SubgraphBoundary, VirtualNode

public class Node
extends java.lang.Object

A node in a DirectedGraph. A node has 0 or more incoming and outgoing Edges. 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:

The following fields are calculated by a graph layout and comprise the output:

Since:
2.1

Field Summary
 java.lang.Object data
          Clients may use this field to mark the Node with an arbitrary data object.
 boolean flag
          For internal use only.
 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.
 int index
          For internal use only.
 int nestingIndex
          For internal use only.
 EdgeList outgoing
          The edges for which this node is the source.
 int outgoingOffset
          For internal use only.
 int rank
          The horizontal row to which this node belongs.
 double sortValue
          A value used to sort the node within its rank.
 int width
          The node's width.
 java.lang.Object[] workingData
          For internal use only.
 int[] workingInts
          For internal use only.
 int x
          The node's x coordinate.
 int y
          The node's y coordinate.
 
Constructor Summary
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.
 
Method Summary
 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
 boolean isNested(Node node)
          For internal use only.
 void setPadding(Insets padding)
          Sets the padding.
 void setParent(Subgraph parent)
          Sets the parent subgraph.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

workingData

public java.lang.Object[] workingData
For internal use only. workingData store various temporary data during the layout of a directed graph.


workingInts

public int[] workingInts
For internal use only. This filed stores various temporary data during the layout of a directed graph.


data

public java.lang.Object data
Clients may use this field to mark the Node with an arbitrary data object.


flag

public boolean flag
For internal use only. A flag for use during layout.


height

public int height
The height of this node. This value should be set prior to laying out the directed graph. Depending on the layout rules, a node's height may be expanded to match the height of other nodes around it.


incoming

public EdgeList incoming
The edges for which this node is the target.


incomingOffset

public int incomingOffset
The default attachment point for incoming edges. -1 indicates that the node's horizontal center should be used.


index

public int index
For internal use only. A non-decresing number given to consecutive nodes in a Rank.


nestingIndex

public int nestingIndex
For internal use only.


outgoing

public EdgeList outgoing
The edges for which this node is the source.


outgoingOffset

public int outgoingOffset
For internal use only.


rank

public int rank
The horizontal row to which this node belongs.


sortValue

public double sortValue
A value used to sort the node within its rank.


width

public int width
The node's width.


x

public int x
The node's x coordinate.


y

public int y
The node's y coordinate.

Constructor Detail

Node

public Node()
Constructs a new node.


Node

public Node(java.lang.Object data)
Constructs a node with the given data object

Parameters:
data - an arbitrary data object

Node

public Node(Subgraph parent)
Constructs a node inside the given subgraph.

Parameters:
parent - the parent subgraph

Node

public Node(java.lang.Object data,
            Subgraph parent)
Constructs a node with the given data object and parent subgraph. This node is added to the set of members for the parent subgraph

Parameters:
data - an arbitrary data object
parent - the parent subgraph or null
Method Detail

getOffsetIncoming

public int getOffsetIncoming()
Returns the incoming attachment point. This is the distance from the left edge to the default incoming attachment point for edges. Each incoming edge may have it's own attachment setting which takes priority over this default one.

Returns:
the incoming offset

getOffsetOutgoing

public int getOffsetOutgoing()
Returns the outgoing attachment point. This is the distance from the left edge to the default outgoing attachment point for edges. Each outgoing edge may have it's own attachment setting which takes priority over this default one.

Returns:
the outgoing offset

getPadding

public Insets getPadding()
Returns the padding for this node or null if the default padding for the graph should be used.

Returns:
the padding or null

getParent

public Subgraph getParent()
Returns the parent Subgraph or null

Returns:
the parent or null

isNested

public boolean isNested(Node node)
For internal use only. Returns true if the given node is equal to this node. This method is implemented for consitency with Subgraph.

Parameters:
node - the node in question
Returns:
true if nested

setPadding

public void setPadding(Insets padding)
Sets the padding.

Parameters:
padding - the padding

setParent

public void setParent(Subgraph parent)
Sets the parent subgraph. This method should not be called directly. The constructor will set the parent accordingly.

Parameters:
parent - the parent

toString

public java.lang.String toString()
See Also:
Object.toString()