Draw2d
3.9.0.201305060205

org.eclipse.draw2d.graph
Class Node

java.lang.Object
  extended by org.eclipse.draw2d.graph.Node
Direct Known Subclasses:
Subgraph, 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.2

Field Summary
 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. use setRowConstraint(int) and getRowConstraint()
 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 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
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

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


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.


rowOrder

public int rowOrder
Deprecated. use setRowConstraint(int) and getRowConstraint()

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.


outgoing

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


sortValue

public double sortValue
Deprecated. for internal use only

outgoingOffset

public int outgoingOffset
The node's outgoing offset attachment point.


width

public int width
The node's width. The default value is 50.


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 if there is no parent. Subgraphs are only for use in CompoundDirectedGraphLayout.

Returns:
the parent or null

setPadding

public void setPadding(Insets padding)
Sets the padding. null indicates that the default padding should be used.

Parameters:
padding - an insets or null

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

setRowConstraint

public void setRowConstraint(int value)
Sets the row sorting constraint for this node. By default, a node's constraint is -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.

Parameters:
value - the row constraint
Since:
3.2

getRowConstraint

public int getRowConstraint()
Returns the row constraint for this node.

Returns:
the row constraint
Since:
3.2

setSize

public void setSize(Dimension size)
Sets the size of this node to the given dimension.

Parameters:
size - the new size
Since:
3.2

toString

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

getLeft

public Node getLeft()
Returns a reference to a node located left from this one

Returns:
Node on the left from this one
Since:
3.4

getRight

public Node getRight()
Returns a reference to a node located right from this one

Returns:
Node on the right from this one
Since:
3.4

Draw2d
3.9.0.201305060205

Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.