Swimlanes are rectangular areas orthogonal
to the levels.
- If the link flow direction is towards the bottom or top, the levels are horizontal rows and the swimlanes are vertical columns.
- If the flow direction is towards the left or right, the levels are vertical columns and the swimlanes are horizontal rows.
You can use swimlanes if the nodes are
partitioned into groups, to indicate which nodes belong to a
certain group. The nodes in the same swimlane are placed so that it
is possible to draw a surrounding rectangle around them. Swimlanes
allow you to organize the graph in a table-like manner. For
example, you can have a workflow diagram where nodes represent
actions; the swimlanes could then represent the departments that
perform these actions. Each node can belong to only one swimlane.
To assign a group of nodes to a swimlane:
In CSS
In the constraint file, specify:
SwimLaneConstraint { group: { node1, node2, node3 } relativeSize: -1.0 positionIndex: -1 eastMinMargin: 0.0 westMinMargin: 0.0 }
In Java
In Java™ , call:
layout.addConstraint(new IlvSwimLaneConstraint(new IlvNodeGroup(nodeVector)));
All nodes of the node vector are placed
in the same swimlane rectangle. If a graph has many swimlane
rectangles, the relative order of these swimlanes is determined
automatically. The size of the swimlane rectangle depends on the
nodes that belong to the swimlane. However, you can specify the
relative order, relative size, and the margins of the swimlane
as well by using the constructor:
public IlvSwimLaneConstraint(IlvNodeGroup group, float relativeSize, int positionIndex, float westMinMargin, float eastMinMargin)
The relative size indicates how large this
swimlane is compared to the other swimlanes. Assume that the flow
direction is towards the bottom. In this case, the relative size
indicates the width of the swimlane. All swimlanes with the same
relative size have the same width. A swimlane with a relative size
that is twice the value of another swimlane will have twice the
width of the other swimlane. The actual number of this parameter
does not matter, only how large the value is compared to the other
swimlanes. If you do not want to restrict the size of the swimlane,
set the value to 0. In this case, the width of the swimlane is
independent of the other swimlanes.
The minimum margin is the margin of the
swimlane in absolute coordinates. If the flow direction is towards
the bottom, then the west minimum margin is the minimum horizontal
distance between the leftmost node of the swimlane and the left
swimlane border, and the east minimum margin is the minimum
horizontal distance between the rightmost node of the swimlane and
the right swimlane border.
The position index indicates the order of
the swimlanes. Just as nodes have position indexes, the swimlanes
are placed sequentially at relative positions numbered from 0 to n.
In a top-down layout, the swimlane with position 0 is the leftmost
swimlane, and the swimlanes with higher position indexes are placed
farther to the right. If the swimlanes have the position index -1,
the layout algorithm determines the appropriate position
automatically.
A swimlane constraint is always evaluated,
even if the incremental mode is enabled. The constraint has a
higher priority than the relative position constraint and the
side-by-side constraint. You can specify side-by-side constraints
for a group of nodes that belong to the same swimlane, but
side-by-side constraints of nodes of different swimlanes are
ignored. You can specify relative position constraints between
nodes of the same swimlane. You can also specify relative position
constraints between one entire swimlane group and another swimlane
group, which effectively orders the swimlanes. But relative
position constraints are ignored if they would require breaking the
swimlanes apart. The swimlane constraint dominates the specified
position indexes and the extremity constraints, that is, if a
swimlane constraint is used, you cannot specify position indexes or
east/west extremity constraints for any node.
Tip
The automatic conflict resolution can
handle conflicting constraints. However, to speed up the layout,
it is recommended that you specify constraints in such a way that
there are no conflicts.