Package org.eclipse.draw2d.graph
Class Node
java.lang.Object
org.eclipse.draw2d.graph.Node
- Direct Known Subclasses:
- Subgraph,- VirtualNode
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:
 - width- the node's width.
- height- the node's height.
- outgoing- the node's outgoing edges.
- incoming- the node's incoming edges.
- padding - the amount of space to be left around the outside of the node.
- incomingOffset- the default attachment point for incoming edges.
- outgoingOffset- the default attachment point for outgoing edges.
- parent - the parent subgraph containing this node.
The following fields are calculated by a graph layout and comprise the output:
- Since:
- 2.1.2
- 
Field SummaryFieldsModifier and TypeFieldDescriptionClients may use this field to mark the Node with an arbitrary data object.intThe height of this node.The edges for which this node is the target.intThe default attachment point for incoming edges.The edges for which this node is the source.intThe node's outgoing offset attachment point.intDeprecated.doubleDeprecated.for internal use onlyintThe node's width.intThe node's x coordinate.intThe node's y coordinate.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetLeft()Returns a reference to a node located left from this oneintReturns the incoming attachment point.intReturns the outgoing attachment point.Returns the padding for this node ornullif the default padding for the graph should be used.Returns the parent Subgraph ornullif there is no parent.getRight()Returns a reference to a node located right from this oneintReturns the row constraint for this node.voidsetPadding(Insets padding) Sets the padding.voidSets the parent subgraph.voidsetRowConstraint(int value) Sets the row sorting constraint for this node.voidSets the size of this node to the given dimension.toString()
- 
Field Details- 
dataClients may use this field to mark the Node with an arbitrary data object.
- 
heightpublic int heightThe 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.
- 
rowOrderDeprecated.
- 
incomingThe edges for which this node is the target.
- 
incomingOffsetpublic int incomingOffsetThe default attachment point for incoming edges.-1indicates that the node's horizontal center should be used.
- 
outgoingThe edges for which this node is the source.
- 
sortValueDeprecated.for internal use only
- 
outgoingOffsetpublic int outgoingOffsetThe node's outgoing offset attachment point.
- 
widthpublic int widthThe node's width. The default value is 50.
- 
xpublic int xThe node's x coordinate.
- 
ypublic int yThe node's y coordinate.
 
- 
- 
Constructor Details- 
Nodepublic Node()Constructs a new node.
- 
NodeConstructs a node with the given data object- Parameters:
- data- an arbitrary data object
 
- 
NodeConstructs a node inside the given subgraph.- Parameters:
- parent- the parent subgraph
 
- 
NodeConstructs 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 Details- 
getOffsetIncomingpublic 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
 
- 
getOffsetOutgoingpublic 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
 
- 
getPaddingReturns the padding for this node ornullif the default padding for the graph should be used.- Returns:
- the padding or null
 
- 
getParentReturns the parent Subgraph ornullif there is no parent. Subgraphs are only for use inCompoundDirectedGraphLayout.- Returns:
- the parent or null
 
- 
setPaddingSets the padding.nullindicates that the default padding should be used.- Parameters:
- padding- an insets or- null
 
- 
setParentSets the parent subgraph. This method should not be called directly. The constructor will set the parent accordingly.- Parameters:
- parent- the parent
 
- 
setRowConstraintpublic 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
 
- 
getRowConstraintpublic int getRowConstraint()Returns the row constraint for this node.- Returns:
- the row constraint
- Since:
- 3.2
 
- 
setSizeSets the size of this node to the given dimension.- Parameters:
- size- the new size
- Since:
- 3.2
 
- 
toString
- 
getLeftReturns a reference to a node located left from this one- Returns:
- Nodeon the left from this one
- Since:
- 3.4
 
- 
getRightReturns a reference to a node located right from this one- Returns:
- Nodeon the right from this one
- Since:
- 3.4
 
 
- 
setRowConstraint(int)andgetRowConstraint()