public class IlvSwimLanesRenderer extends IlvFilterSDMRenderer
Swimlanes are contiguous vertical or horizontal rectangular areas that
usually span the whole view. Swimlanes are most often used in conjunction
with a hierarchical graph layout algorithm. This algorithm has the ability
to place the nodes of the graph automatically according to swimlanes.
See IlvHierarchicalLayout
and IlvSwimLaneConstraint
for a detailed discussion of the hierarchical layout algorithm and
swimlanes.
The swimlane renderer is not responsible for configuring the
graph layout algorithm so that it creates swimlanes. This is done
by using a GraphLayout renderer (see IlvGraphLayoutRenderer
configured to use a hierarchical algorithm, and setting the
SwimLaneConstraint
property in the style sheet
for appropriate groups of nodes.
The swimlane renderer is merely responsible for displaying the swimlanes.
For this, it reads the SwimLaneConstraint
property of each node
of the graph from the style sheet to determine which nodes belong to the
same swimlane. The swimlanes are then displayed as colored rectangles in the
background of the view, with a label on top of each swimlane.
Since the SwimLaneConstraint
property is also used to
configure the hierarchical layout algorithm so that it places the nodes
automatically in swimlanes, performing a hierarchical layout on the graph
will also place the activities correctly according to their swimlanes.
Note, however, that the IlvSwimLanesRenderer
can be used without
performing a node layout. Conversely, you can perform a node layout using swim
lanes without actually displaying the swimlanes (to do this, just set the
SwimLanes
property to false
).
In other words, you can use the IlvSwimLanesRenderer
to only
display swimlanes, but then the swimlanes may overlap. Performing a node
layout will also make sure that the swimlanes do not overlap, and that the
nodes are arranged as hierarchical graphs inside each swimlane.
participant
property identifying the workflow participant that performs the activity.
Swimlanes are often used to represent the participant. Each swimlane represents
a participant, and the activities are placed in the swimlane of their
participant. This can be implemented very simply using the following rules:
SDM { SwimLanes : "true"; } node.activity { SwimLaneConstraint : "@participant"; }
The first rule tells the SDM engine to display the swimlanes using
an IlvSwimLanesRenderer
. The second rule says that a swimlane
must be displayed around all the activities that have the same participant
property.
The look of the swimlanes can be customized with the following properties:
SwimLaneLabel
: This property can be set to customize the label
of the swimlanes. For example:
node.activity[participant="rnd"] { SwimLaneLabel : "Research and Development"; } node.activity[participant="cs"] { SwimLaneLabel : "Customer Support"; }If this property is not set, the default label is the value of the
SwimLaneConstraint
property.
SwimLaneColor
: This property can be set to customize the colors
of the swimlanes. For example:
node.activity[participant="rnd"] { SwimLaneColor : "blue"; } node.activity[participant="cs"] { SwimLaneColor : "#8800ff00"; // half-transparent green }If this property is not set, a different default color is automatically allocated for each swimlane, based on the values defined by
setHue(float)
, setBrightness(float)
, setSaturation(float)
, and setAlpha(float)
.
SwimLaneGraphic
: This property can be set to customize
the graphic object representing a swimlane completely. For example:
node.activity { SwimLaneGraphic : "@#swimlane"; } Subobject#swimlane { class : "ilog.views.sdm.graphic.IlvExpandedFrame"; thickness : "10"; }If this property is not set, an
IlvGeneralNode
is used by default.
Note: IlvLaneRenderer
is a simpler implementation of this
feature.
Modifier and Type | Class and Description |
---|---|
static class |
IlvSwimLanesRenderer.DefaultSwimLaneGraphic
This class is used by the
IlvSwimLanesRenderer to display
swimlanes. |
_renderer
PSEUDOCLASS_PREFIX
Constructor and Description |
---|
IlvSwimLanesRenderer()
Creates a new swimlanes renderer with a
null
filtered renderer. |
IlvSwimLanesRenderer(IlvSDMRenderer renderer)
Creates a new swimlanes renderer for a specified
filtered renderer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addViewListeners(IlvManagerView view)
Adds the listeners that adjust the swimlanes when the view
is resized or transformed.
|
void |
adjustSpacing(double delta)
Moves the swimlanes apart so that the spacing between swimlanes
is augmented or decreased by
delta . |
IlvRect |
computeBBox(IlvSDMEngine engine,
IlvManagerView view,
IlvTransformer t)
Computes the rectangle that contains all
the graphic objects of the manager for a given view.
|
void |
createSwimLane(Object activity,
String newLabel)
Creates a new swimlane by adding the specified activity and setting its
swimlane property to the specified value.
|
void |
customize(IlvSDMEngine engine,
Object object,
IlvGraphic g,
String[] pseudoClasses)
Updates the swimlane of the node.
|
float |
getAlpha()
Returns the alpha channel of the colors allocated by this renderer.
|
float |
getBrightness()
Returns the brightness of the colors allocated by this renderer.
|
String |
getDefaultSwimLanes()
Returns the string that defines the default swimlanes.
|
float |
getHue()
Gets the "base" hue.
|
int |
getLayer()
Returns the manager layer to which the swimlane graphics will be added.
|
int |
getMargin()
Returns the width of the margin remaining around the objects of a swimlane.
|
float |
getSaturation()
Returns the saturation of the colors.
|
int |
getScrollDelay()
Returns the delay after which the swimlanes reappear
when the view has been scrolled.
|
Color |
getSwimLaneColor(int i)
Returns the color of a swimlane.
|
int |
getSwimLaneCount()
Returns the number of swimlanes.
|
String |
getSwimLaneLabel(int i)
Returns the label of the specified swimlane.
|
double |
getSwimLaneWidth(int index)
Returns the width of a swimlane.
|
boolean |
isAdjustingToView()
Returns
true if the swimlanes are dynamically adjusted according
to the size of the view or not. |
boolean |
isAutoColor(int i)
Returns
true if the color of the specified swimlane has been
set explicitly through setSwimLaneColor(int, java.awt.Color) , or false if
the color of the swimlane has been allocated automatically. |
boolean |
isDraggingEnabled()
Returns
true if the user is allowed to drag objects from one
swimlane to another. |
boolean |
isEnabled()
Returns
true if swimlanes are enabled, or
false if swimlanes are disabled. |
boolean |
isExtendingToSides()
Returns
true if the swimlanes extend to the sides
of the view. |
boolean |
isHorizontal()
Returns
true if the swimlanes are horizontal, or false
if they are vertical. |
boolean |
isLabelRotated()
Returns whether the label is rotated.
|
boolean |
isOverlapsAllowed()
Returns
true if the swimlanes are allowed to overlap,
or false otherwise. |
void |
moveSwimLane(IlvSDMEngine engine,
int index,
boolean rightOrDown)
Shifts the position of a swimlane to the left, right, bottom or up.
|
protected boolean |
needsViewListeners()
Returns
true , because this renderer needs to install
listeners on all the views. |
void |
nodeGraphicAdded(IlvSDMEngine engine,
Object object,
IlvGraphic graphic,
boolean redraw)
Adds an object to its swimlane.
|
void |
nodeGraphicBBoxChanged(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
IlvRect oldBBox,
IlvRect newBBox,
String[] pseudoClasses)
Moves the object from one swimlane to another, if
dragging is enabled.
|
void |
prepareRendering(IlvSDMEngine engine)
Initializes the swimlane data structures.
|
void |
propertiesChanged(IlvSDMEngine engine,
Object object,
Collection<String> propertyName,
IlvGraphic graphic)
Updates the swimlane of the node.
|
void |
removeAll(IlvSDMEngine engine)
Cleans up the swimlanes.
|
void |
removeNodeGraphic(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
boolean redraw)
Removes the object from its swimlane.
|
protected void |
removeViewListeners(IlvManagerView view)
Removes the listeners that adjust the swimlanes when the view
is resized or transformed.
|
void |
renderingDone(IlvSDMEngine engine)
Draws the swimlanes.
|
void |
setAdjustingToView(boolean adjusting)
Specifies whether the swimlanes are dynamically adjusted according
to the size of the view or not.
|
void |
setAlpha(float alpha)
Sets the alpha channel of the colors allocated by this renderer.
|
void |
setBrightness(float brightness)
Sets the brightness of the colors allocated by this renderer.
|
void |
setDefaultSwimLanes(String lanes)
Defines the default swimlanes to display.
|
void |
setDraggingEnabled(boolean enabled)
Allows the user to drag objects from one swimlane to another.
|
void |
setEnabled(boolean enabled)
Enables or disables swimlanes.
|
void |
setExtendingToSides(boolean extending)
Specifies whether the swimlanes extend to the sides
of the view or not.
|
void |
setHue(float hue)
Sets the "base" hue.
|
void |
setLabelRotated(boolean rotated)
Sets whether the label is rotated.
|
void |
setLayer(int layer)
Sets the manager layer in which the swimlane graphics will be added.
|
void |
setMargin(int margin)
Sets the width of the margin remaining around the objects of a swimlane.
|
void |
setOverlapsAllowed(boolean allowed)
Allows or forbids the swimlanes to overlap.
|
void |
setSaturation(float saturation)
Sets the saturation of the colors allocated by this renderer.
|
void |
setScrollDelay(int delay)
Sets the delay after which the swimlanes reappear
when the view has been scrolled.
|
void |
setSwimLaneColor(int i,
Color color)
Changes the color of a swimlane.
|
void |
setSwimLaneLabel(int i,
String label)
Sets the label of the specified swimlane.
|
void |
setSwimLaneWidth(int index,
double newWidth)
Changes the width of a swimlane.
|
addLinkGraphic, addNodeGraphic, createLinkGraphic, createNodeGraphic, getEncapsulatedGraphic, getFilteredRenderer, getGraphicProperty, getLinkConnectionRectangle, linkGraphicAdded, moveResizeNodeGraphic, processServerAction, removeLinkGraphic, setFilteredRenderer, updateObjectProperties
callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getAuxiliaryBeans, getEngine, getLinkConnectionRectangle, getLocation, getParameter, propertyChanged, setAlias, setEngine, setLayerName, setParameter
public IlvSwimLanesRenderer(IlvSDMRenderer renderer)
renderer
- The filtered renderer.public IlvSwimLanesRenderer()
null
filtered renderer.public void setLabelRotated(boolean rotated)
public boolean isLabelRotated()
public void setLayer(int layer)
layer
- The index of the layer.public int getLayer()
public void setDraggingEnabled(boolean enabled)
By default, dragging is enabled.
enabled
- If true
, when an object is dragged from one
swimlane to another, the renderer will attempt to set the property that
determines the object's swimlane.
For example, if the style sheet contains a rule such as:
node.activity { SwimLaneConstraint : "@participant"; }then the renderer will set the
participant
property
to the value corresponding to the swimlane in which the object
was dropped.
If the parameter is false
, dragging an object simply
changes the swimlane's bounding box.
public boolean isDraggingEnabled()
true
if the user is allowed to drag objects from one
swimlane to another.setDraggingEnabled(boolean)
public void setExtendingToSides(boolean extending)
By default, swimlanes do not extend to the sides of the view.
extending
- If true
, and if the layout direction is
vertical, the leftmost swimlane
will extend to the left side of the view, and the rightmost
swimlane will extend to the right side of the view, so that the swimlanes
cover the view entirely. For a horizontal
layout, the swimlanes extend to the top and bottom of the view.
If false
, all swimlanes just surround the objects that belong
to them, without extending to the sides of the view. Note that this parameter
controls only the extension of swimlanes in the direction orthogonal to
the layout direction; regardless of this parameter, the swimlanes
always extend to the sides of the view in the direction of the layout,
that is, to the top and bottom for a vertical layout and to
to the left and right for a horizontal layout.public boolean isExtendingToSides()
true
if the swimlanes extend to the sides
of the view.setExtendingToSides(boolean)
public void setAdjustingToView(boolean adjusting)
adjusting
- If true
, the size of the swimlane graphics
is always adjusted to the size of the view. This means, in particular, that
the swimlane labels are always visible, even when you scroll the view.
In this mode, the swimlanes cannot be displayed in the overview.
If false
, the swimlanes cover the whole bounding rectangle
of the manager, and the labels are always at the very top (or left) of
the manager, so they are not visible when you scroll. In this mode, the
swimlanes are visible in the overview.public boolean isAdjustingToView()
true
if the swimlanes are dynamically adjusted according
to the size of the view or not.public void setOverlapsAllowed(boolean allowed)
allowed
- If true
, the bounding rectangle of
a swimlane always contains entirely all the objects of the
swimlane, even if this causes the swimlanes to overlap graphically.
If false
, the swimlanes will not overlap graphically,
but the objects of a swimlane will sometimes be drawn partly
outside the swimlane.public boolean isOverlapsAllowed()
true
if the swimlanes are allowed to overlap,
or false
otherwise.public void setMargin(int margin)
10
.margin
- The margin, in manager coordinates.public int getMargin()
public void setHue(float hue)
hue
- A value between 0
and 1
.public float getHue()
public void setSaturation(float saturation)
saturation
- A value between 0
and 1
.public float getSaturation()
public void setBrightness(float brightness)
brightness
- A value between 0
and 1
.public float getBrightness()
public void setAlpha(float alpha)
alpha
- A value between 0
and 1
.public float getAlpha()
public void setDefaultSwimLanes(String lanes)
lanes
- A String
containing the names of the default swimlanes,
separated by commas. For example: "Lane 1,Lane 2"
.public String getDefaultSwimLanes()
setDefaultSwimLanes(java.lang.String)
public void setScrollDelay(int delay)
Swimlanes are normally hidden during scrolling interactions. You can use this method if you notice that swimlanes reappear in the middle of a scrolling interaction. The default delay is 200 milliseconds; specify a longer delay to get a smoother scroll.
delay
- The amount of delay, in milliseconds.public int getScrollDelay()
setScrollDelay(int)
public boolean isEnabled()
true
if swimlanes are enabled, or
false
if swimlanes are disabled.setEnabled(boolean)
public void setEnabled(boolean enabled)
By default, swimlanes are enabled.
enabled
- If true
, swimlanes are enabled: according to
the SwimLaneConstraint
rendering property, nodes will be dispatched
to swimlanes, and swimlanes will be displayed graphically. When a node layout
is performed, the layout algorithm will place nodes according to their swimlanes.
If false
, swimlanes are disabled: they are not displayed graphically,
and the node layout algorithm will not take swimlanes into account.isEnabled()
public void prepareRendering(IlvSDMEngine engine)
prepareRendering
in class IlvFilterSDMRenderer
engine
- The SDM engine.public void nodeGraphicAdded(IlvSDMEngine engine, Object object, IlvGraphic graphic, boolean redraw)
nodeGraphicAdded
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher to which
the graphic object has been added.object
- The object that is being translated into an IlvGraphic
.graphic
- The graphic object that has just been added to the grapher.redraw
- If true
, the region covered by the new
graphic object must be redrawn.IlvSDMRenderer.addNodeGraphic(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, boolean)
public void removeNodeGraphic(IlvSDMEngine engine, Object node, IlvGraphic graphic, boolean redraw)
removeNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher from which
the graphic object will be removed.node
- The node that has been removed from, or modified in, the data model.graphic
- The graphic object that must be removed from the grapher.redraw
- If true
, the region covered by the
graphic object must be redrawn.public void propertiesChanged(IlvSDMEngine engine, Object object, Collection<String> propertyName, IlvGraphic graphic)
propertiesChanged
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object is displayed.object
- The data object whose property has changed.propertyName
- The names of the properties that have been modified.graphic
- The graphic object associated with object
.public void customize(IlvSDMEngine engine, Object object, IlvGraphic g, String[] pseudoClasses)
customize
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object is displayed.object
- The data object whose property has changed.g
- The graphic object associated with object
.pseudoClasses
- The CSS pseudo-classes.public void renderingDone(IlvSDMEngine engine)
renderingDone
in class IlvFilterSDMRenderer
engine
- The SDM engine.public void removeAll(IlvSDMEngine engine)
removeAll
in class IlvFilterSDMRenderer
engine
- The SDM engine.protected boolean needsViewListeners()
true
, because this renderer needs to install
listeners on all the views.protected void addViewListeners(IlvManagerView view)
addViewListeners
in class IlvSDMRenderer
view
- The manager view.IlvSDMRenderer.needsViewListeners()
protected void removeViewListeners(IlvManagerView view)
removeViewListeners
in class IlvSDMRenderer
view
- The manager view.IlvSDMRenderer.needsViewListeners()
public void nodeGraphicBBoxChanged(IlvSDMEngine engine, Object node, IlvGraphic graphic, IlvRect oldBBox, IlvRect newBBox, String[] pseudoClasses)
nodeGraphicBBoxChanged
in class IlvFilterSDMRenderer
engine
- The SDM engine.node
- The data node that the graphic object represents.graphic
- The graphic object that has been moved and/or resized.oldBBox
- The bounding box of the graphic object before
the change.newBBox
- The bounding box of the graphic object after
the change.pseudoClasses
- The pseudo-classes of the object.
This parameter can be null
.setDraggingEnabled(boolean)
public IlvRect computeBBox(IlvSDMEngine engine, IlvManagerView view, IlvTransformer t)
This method is overridden to leave some space above or on the left of the graph for the swimlane labels.
computeBBox
in class IlvFilterSDMRenderer
engine
- The SDM engine.view
- The manager view for which the bounding rectangle is computed.t
- The transformer used to compute the bounding box.public boolean isHorizontal()
true
if the swimlanes are horizontal, or false
if they are vertical. The direction of the swimlanes is determined by the
direction of the graph layout algorithm.public int getSwimLaneCount()
public String getSwimLaneLabel(int i)
i
- The index of the swimlane.public void setSwimLaneLabel(int i, String label)
i
- The index of the swimlane.label
- The new label.public Color getSwimLaneColor(int i)
i
- The index of the swimlane.public void setSwimLaneColor(int i, Color color)
i
- The index of the swimlane.color
- The new color.public boolean isAutoColor(int i)
true
if the color of the specified swimlane has been
set explicitly through setSwimLaneColor(int, java.awt.Color)
, or false
if
the color of the swimlane has been allocated automatically.i
- The index of the swimlane.public void moveSwimLane(IlvSDMEngine engine, int index, boolean rightOrDown)
engine
- The SDM engine.index
- The index of the swimlane.rightOrDown
- If true
, the swimlane is shifted to the
right (if swimlanes are vertical) or to the bottom (if they are horizontal).
If false
, the swimlane is shifted to the
left (if swimlanes are vertical) or to the top (if they are horizontal).public double getSwimLaneWidth(int index)
index
- The index of the swimlane.public void setSwimLaneWidth(int index, double newWidth)
index
- The index of the swimlane.newWidth
- The new width.public void createSwimLane(Object activity, String newLabel)
activity
- The activity to add.newLabel
- The swimlane label.public void adjustSpacing(double delta)
delta
.delta
- The amount by which the spacing between swimlanes
is changed.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.