The
SwimLanes
renderer displays vertical or horizontal stripes in the background
of the diagram. Swimlanes are used to represent logical groups of
nodes. For example, in a workflow process, each swimlane could
represent a department of a company, and the activities executed
within each department would be placed in the corresponding
swimlane.
Swimlanes are represented graphically by
vertical or horizontal rectangles that cover the whole view. Each
swimlane rectangle contains (geometrically) all the nodes that
belong to the swimlane. Each swimlane has a different color which
can be automatically generated or customized through the style
sheet. Each swimlane also has a title.
The
SwimLanes
renderer can be used alone, but it is most often used in
conjunction with a
GraphLayout
renderer configured to use a hierarchical layout algorithm, because
the hierarchical layout has the ability to automatically arrange
the nodes of the hierarchy according to the swimlanes to which they
belong.
The hierarchical layout ensures that the
swimlanes do not overlap, but if no hierarchical layout is applied,
or if the nodes are moved after the layout is applied, the
swimlanes may overlap.
There are two versions of the
SwimLanes
renderer, corresponding to two different implementations. The first
one,
IlvSwimLaneRenderer
, is a basic implementation of swimlanes, internally managed by the
renderer. The second one,
IlvLaneRenderer
, differs from the first one in several ways:
- Each lane is the graphical representation of a dedicated object in the data model. The advantage of this new implementation is that the properties of the lanes (position, size, label...) can be stored in the data model.
- IlvLaneRenderer supports hierarchical swimlanes, that is, lanes containing sub-lanes. Lane containers are sometimes called “pools”.
- Interactions are different (see IlvLaneRenderer below).
To select one version of the renderer or the
other, specify the following in the SDM rule:
SDM { SwimLanes : true; }
or
SDM { Lanes : true; }
IlvLaneRenderer
is used in the BPMN modeler.
IlvSwimLanesRenderer
Swimlanes are computed according to the value of the
SwimLaneConstraints
property in the style sheet. The value of this property is
examined for each node, and a swimlane is created for each
different value. Note that this is the same property as the one
used by the
GraphLayout
renderer, which makes sure that the
GraphLayout
and
SwimLanes
renderers group nodes into swimlanes in the same way.
For example, the following code example
defines two swimlanes: one representing the R&D department of
a company, and another one representing the Sales department.
node.activity[department=”R&D”] { SwimLaneConstraint : “R&D Department”; } node.activity[department=”Sales”] { SwimLaneConstraint : “Sales Department”; }
With these rules, the diagram will be divided into two swimlanes
with different colors, and these will have the titles
“R&D Department”
and
“Sales Department”
.
The following table lists the properties of the
SwimLanes
renderer.
Global properties of the SwimLanes
renderer
Property
|
Type
|
Default
|
Description
|
---|---|---|---|
alpha
|
float
|
0.5
|
The alpha value (that is to say the
transparency) of the allocated colors.
|
brightness
|
float
|
0.8
|
The brightness of the allocated
colors.
|
defaultSwimLanes
|
String
|
null
|
Can be used to create default
swimlanes in an empty diagram. The string is a
comma-separated list containing the titles of the default
swimlanes.
|
draggingEnabled
|
boolean
|
true
|
Allows you to drag a node from one
swimlane to another.
|
hue
|
float
|
0.2
|
The hue with which the color
allocation algorithm will start.
|
layer
|
int
|
0
|
The index of the manager layer in
which the swimlane graphics will be added.
|
margin
|
int
|
5
|
The margin between two adjacent
swimlanes.
|
saturation
|
float
|
0.5
|
The saturation of the allocated
colors.
|
The following table lists the per-object rendering properties of
the
SwimLanes
renderer.
Per-object properties of the SwimLanes
renderer
Property
|
Type
|
Default
|
Description
|
---|---|---|---|
SwimLaneConstraint
|
Object
|
null
|
Defines the swimlane to which the node
belongs.
|
SwimLaneGraphic
|
IlvGraphic
|
null
|
Lets you customize the graphic object used to represent the
swimlane. By default, an
IlvGeneralNode
is used.
|
SwimLaneLabel
|
String
|
null
|
Lets you customize the title of the swimlane. By default, the
title is the value of the
SwimLaneConstraint
property.
|
SwimLaneColor
|
Color
|
null
|
Lets you customize the color of the
swimlane. By default, the colors are allocated automatically,
based on the hue, saturation, brightness, and alpha
properties of the renderer.
|
You should set the
SwimLaneGraphic
,
SwimLaneColor
, and
SwimLaneLabel
properties on all nodes. Although the SwimLane Renderer makes use
of only the first node in a swimlane to set these properties, you
may not find it easy to keep track of which node is the first
node.
See the class IlvSwimLanesRenderer for more details.
IlvLaneRenderer
The Lane Renderer defines properties to
customize the created lanes.
The following table lists the properties
of a lane.
Lane properties
Property
|
Type
|
Default
|
Description
|
---|---|---|---|
defaultLength
|
float
|
500
|
Default length of the lanes, that is,
the width if the lanes are horizontal, or the height if they
are vertical.
|
defaultSize
|
float
|
100
|
Default size of the lanes, that is,
the height if the lanes are horizontal, or the width if they
are vertical.
|
horizontal
|
boolean
|
true
|
Lane orientation.
|
margin
|
float
|
5
|
Margin between the objects inside the
lane and the edges of the lane.
|
spacing
|
float
|
10
|
Minimum spacing between adjacent
lanes.
|
sublaneOffset
|
float
|
0
|
If the lanes are horizontal, this
property changes the offset between the left side of a
sublane and the left side of the parent lane. This offset is
used to leave room for a label.
|
To create a lane, the style sheet rule that matches the lane
object must contain the declaration
LaneName:<name>
, where
<name>
is the name of the lane. If this rule also creates an
IlvGraphic
that implements
ilog.views.IlvLabelInterface
, then this graphic will be the label of the lane and will appear
in front of the lane. In general, the class of the lane graphic
representation is
ilog.views.sdm.graphic.IlvDefaultLaneGraphic
, which displays vertical labels for horizontal lanes. In
addition to
LaneName
, two more properties are then interpreted:
Lane additional properties
Property
|
Type
|
Default
|
Description
|
---|---|---|---|
LaneName
|
string
|
""
|
Sets the matching node as a lane (or a
pool) and defines its name.
|
LaneLength
|
float
|
defaultLength
|
Overrides the lane default length.
|
LaneSize
|
float
|
defaultSize
|
Overrides the lane default size.
|
Following is an example of a lane
specification in the style sheet:
node.Pool, node.Lane { // These properties define the look of pools and lanes. // The IlvDefaultLaneGraphic is a subclass of IlvGeneralNode // that can display its label vertically (when the lane is horizontal). // class : "ilog.views.sdm.graphic.IlvDefaultLaneGraphic"; shapeType : "Rectangle"; fillStyle : "SOLID_COLOR"; strokeWidth : "1"; horizontal : "true"; label : "@Name"; toolTipText : "@Name"; labelPosition : "Center"; labelSpacing : "5"; minLabelZoom : "0"; // This property identifies the object as a Pool or a Lane, // and tells the Lane renderer that it must handle it. // LaneName : "@Name"; Anchor : "TopLeft"; // Tell the link layout to preserve pools/lanes. LayoutFixed : "true"; }
The following property can be set on any
node to state that it belongs to a lane.
Property
|
Type
|
Default
|
Description
|
---|---|---|---|
Lane
|
string
|
""
|
Sets the matching object in the named
lane.
|
Example:
node[lane] { Lane : "@lane"; }
This rule states that all nodes that define an attribute
"lane"
are assigned to the lane with the
"lane"
attribute value.
Lane Behavior
When editing is allowed, a lane has the
following behaviors:
- Nodes inside the lane can be moved anywhere. The pools and lanes resize automatically to adjust to the new node positions. Note that, to remove an object from a lane, all you need to do is remove the Lane property from the node.
- The lane can be manually resized: When the mouse is close to a lane edge, a resize cursor appears, which indicates that the lane can be resized if the mouse is pressed down.
See the class IlvLaneRenderer for more details.