If the flow direction is towards the bottom, level 0
is topmost in the drawing. In this layout, you can specify by relative
level constraints that a node is above or below another node. If the
flow direction is towards the right, level 0 is leftmost in the drawing.
Here you can specify by relative level constraints that a node is
left or right of another node.
Call:
layout.addConstraint( new ibm_ilog.graphlayout.hierarchical.HierarchicalRelativeLevelConstraint(nodeA, nodeB, priority));
This forces
nodeA
to be placed
at a level with a smaller index than nodeB
.
Since relative level constraints compete with each other, you must
specify the priority of the constraint. In fact, links also impose
constraints on the system, and the link priority has the same impact
as the constraint priority. A link with priority 10 forces its (usually)
source node (unless ports are specified) into a lower level than its
target node. To force the source node into a higher level than the
target node, you need to create a constraint with a higher priority
than the link. For instance, to ensure that the constraints are satisfied
even if there are many links, you can use link priorities 0 - 10 and
constraint priorities 1000 - 10,000. You can also create a relative level constraint between
groups of nodes.
Call:
layout.addConstraint(new ibm_ilog.graphlayout.hierarchical.HierarchicalRelativeLevelConstraint(nodeGroup1, nodeGroup2, priority));