|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.sdm.renderer.IlvSDMRenderer
ilog.views.sdm.renderer.IlvFilterSDMRenderer
ilog.views.sdm.renderer.graphlayout.IlvSwimLanesRenderer
public class IlvSwimLanesRenderer
The SwimLanes renderer is responsible for displaying "swim lanes."
Swim lanes are contiguous vertical or horizontal rectangular areas that
usually span the whole view. Swim lanes 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 swim lanes.
See IlvHierarchicalLayout
and IlvSwimLaneConstraint
for a detailed discussion of the hierarchical layout algorithm and
swim lanes.
The swim lane renderer is not responsible for configuring the
graph layout algorithm so that it creates swim lanes. 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 swim lane renderer is merely responsible for displaying the swim lanes.
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 swim lane. The swim lanes are then displayed as colored rectangles in the
background of the view, with a label on top of each swim lane.
Since the SwimLaneConstraint property is also used to
configure the hierarchical layout algorithm so that it places the nodes
automatically in swim lanes, performing a hierarchical layout on the graph
will also place the activities correctly according to their swim lanes.
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 swim lanes (to do this, just set the
SwimLanes property to false).
In other words, you can use the IlvSwimLanesRenderer to only
display swim lanes, but then the swim lanes may overlap. Performing a node
layout will also make sure that the swim lanes do not overlap, and that the
nodes are arranged as hierarchical graphs inside each swim lane.
participant
property identifying the workflow participant that performs the activity.
Swim lanes are often used to represent the participant. Each swim lane represents
a participant, and the activities are placed in the swim lane 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 swim lanes using
an IlvSwimLanesRenderer. The second rule says that a swim lane
must be displayed around all the activities that have the same participant
property.
The look of the swim lanes can be customized with the following properties:
SwimLaneLabel: This property can be set to customize the label
of the swim lanes. 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 swim lanes. 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 swim lane, 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 swim lane 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.
| Nested Class Summary | |
|---|---|
static class |
IlvSwimLanesRenderer.DefaultSwimLaneGraphic
This class is used by the IlvSwimLanesRenderer to display
swim lanes. |
| Field Summary |
|---|
| Fields inherited from class ilog.views.sdm.renderer.IlvFilterSDMRenderer |
|---|
_renderer |
| Constructor Summary | |
|---|---|
IlvSwimLanesRenderer()
Creates a new swim lanes renderer with a null
filtered renderer. |
|
IlvSwimLanesRenderer(IlvSDMRenderer renderer)
Creates a new swim lanes renderer for a specified filtered renderer. |
|
| Method Summary | |
|---|---|
protected void |
addViewListeners(IlvManagerView view)
Adds the listeners that adjust the swim lanes when the view is resized or transformed. |
void |
adjustSpacing(float delta)
Moves the swim lanes apart so that the spacing between swim lanes 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 swim lane by adding the specified activity and setting its swim lane property to the specified value. |
void |
customize(IlvSDMEngine engine,
Object object,
IlvGraphic g,
String[] pseudoClasses)
Updates the swim lane 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 swim lanes. |
float |
getHue()
Gets the "base" hue. |
int |
getLayer()
Returns the manager layer to which the swim lane graphics will be added. |
int |
getMargin()
Returns the width of the margin remaining around the objects of a swim lane. |
float |
getSaturation()
Returns the saturation of the colors. |
int |
getScrollDelay()
Returns the delay after which the swim lanes reappear when the view has been scrolled. |
Color |
getSwimLaneColor(int i)
Returns the color of a swim lane. |
int |
getSwimLaneCount()
Returns the number of swim lanes. |
String |
getSwimLaneLabel(int i)
Returns the label of the specified swim lane. |
float |
getSwimLaneWidth(int index)
Returns the width of a swim lane. |
boolean |
isAdjustingToView()
Returns true if the swim lanes are dynamically adjusted according
to the size of the view or not. |
boolean |
isAutoColor(int i)
Returns true if the color of the specified swim lane has been
set explicitly through setSwimLaneColor(int, java.awt.Color), or false if
the color of the swim lane has been allocated automatically. |
boolean |
isDraggingEnabled()
Returns true if the user is allowed to drag objects from one
swim lane to another. |
boolean |
isEnabled()
Returns true if swim lanes are enabled, or
false if swim lanes are disabled. |
boolean |
isExtendingToSides()
Returns true if the swim lanes extend to the sides
of the view. |
boolean |
isHorizontal()
Returns true if the swim lanes are horizontal, or false
if they are vertical. |
boolean |
isOverlapsAllowed()
Returns true if the swim lanes are allowed to overlap,
or false otherwise. |
void |
moveSwimLane(IlvSDMEngine engine,
int index,
boolean rightOrDown)
Shifts the position of a swim lane 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 swim lane. |
void |
nodeGraphicBBoxChanged(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
IlvRect oldBBox,
IlvRect newBBox,
String[] pseudoClasses)
Moves the object from one swim lane to another, if dragging is enabled. |
void |
prepareRendering(IlvSDMEngine engine)
Initializes the swim lane data structures. |
void |
propertyChanged(IlvSDMEngine engine,
Object object,
String propertyName,
Object oldValue,
Object newValue,
IlvGraphic graphic)
Updates the swim lane of the node. |
void |
removeAll(IlvSDMEngine engine)
Cleans up the swim lanes. |
void |
removeNodeGraphic(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
boolean redraw)
Removes the object from its swim lane. |
protected void |
removeViewListeners(IlvManagerView view)
Removes the listeners that adjust the swim lanes when the view is resized or transformed. |
void |
renderingDone(IlvSDMEngine engine)
Draws the swim lanes. |
void |
setAdjustingToView(boolean adjusting)
Specifies whether the swim lanes 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 swim lanes to display. |
void |
setDraggingEnabled(boolean enabled)
Allows the user to drag objects from one swim lane to another. |
void |
setEnabled(boolean enabled)
Enables or disables swim lanes. |
void |
setExtendingToSides(boolean extending)
Specifies whether the swim lanes extend to the sides of the view or not. |
void |
setHue(float hue)
Sets the "base" hue. |
void |
setLayer(int layer)
Sets the manager layer in which the swim lane graphics will be added. |
void |
setMargin(int margin)
Sets the width of the margin remaining around the objects of a swim lane. |
void |
setOverlapsAllowed(boolean allowed)
Allows or forbids the swim lanes 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 swim lanes reappear when the view has been scrolled. |
void |
setSwimLaneColor(int i,
Color color)
Changes the color of a swim lane. |
void |
setSwimLaneLabel(int i,
String label)
Sets the label of the specified swim lane. |
void |
setSwimLaneWidth(int index,
float newWidth)
Changes the width of a swim lane. |
| Methods inherited from class ilog.views.sdm.renderer.IlvFilterSDMRenderer |
|---|
addLinkGraphic, addNodeGraphic, createLinkGraphic, createNodeGraphic, getEncapsulatedGraphic, getFilteredRenderer, getGraphicProperty, getLinkConnectionRectangle, linkGraphicAdded, moveResizeNodeGraphic, processServerAction, removeLinkGraphic, setFilteredRenderer, updateObjectProperties |
| Methods inherited from class ilog.views.sdm.renderer.IlvSDMRenderer |
|---|
callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getAuxiliaryBeans, getEngine, getLocation, getParameter, setAlias, setEngine, setLayerName, setParameter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IlvSwimLanesRenderer(IlvSDMRenderer renderer)
renderer - The filtered renderer.public IlvSwimLanesRenderer()
null
filtered renderer.
| Method Detail |
|---|
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
swim lane to another, the renderer will attempt to set the property that
determines the object's swim lane.
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 swim lane in which the object
was dropped.
If the parameter is false, dragging an object simply
changes the swim lane's bounding box.
public boolean isDraggingEnabled()
true if the user is allowed to drag objects from one
swim lane to another.
setDraggingEnabled(boolean)public void setExtendingToSides(boolean extending)
By default, swim lanes do not extend to the sides of the view.
extending - If true, and if the layout direction is
vertical, the leftmost swim lane
will extend to the left side of the view, and the rightmost
swim lane will extend to the right side of the view, so that the swim lanes
cover the view entirely. For a horizontal
layout, the swim lanes extend to the top and bottom of the view.
If false, all swim lanes 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 swim lanes in the direction orthogonal to
the layout direction; regardless of this parameter, the swim lanes
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 swim lanes extend to the sides
of the view.
setExtendingToSides(boolean)public void setAdjustingToView(boolean adjusting)
adjusting - If true, the size of the swim lane graphics
is always adjusted to the size of the view. This means, in particular, that
the swim lane labels are always visible, even when you scroll the view.
In this mode, the swim lanes cannot be displayed in the overview.
If false, the swim lanes 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
swim lanes are visible in the overview.public boolean isAdjustingToView()
true if the swim lanes 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 swim lane always contains entirely all the objects of the
swim lane, even if this causes the swim lanes to overlap graphically.
If false, the swim lanes will not overlap graphically,
but the objects of a swim lane will sometimes be drawn partly
outside the swim lane.public boolean isOverlapsAllowed()
true if the swim lanes 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 swim lanes,
separated by commas. For example: "Lane 1,Lane 2".public String getDefaultSwimLanes()
setDefaultSwimLanes(java.lang.String)public void setScrollDelay(int delay)
Swim lanes are normally hidden during scrolling interactions. You can use this method if you notice that swim lanes 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 swim lanes are enabled, or
false if swim lanes are disabled.
setEnabled(boolean)public void setEnabled(boolean enabled)
By default, swim lanes are enabled.
enabled - If true, swim lanes are enabled: according to
the SwimLaneConstraint rendering property, nodes will be dispatched
to swim lanes, and swim lanes will be displayed graphically. When a node layout
is performed, the layout algorithm will place nodes according to their swim lanes.
If false, swim lanes are disabled: they are not displayed graphically,
and the node layout algorithm will not take swim lanes into account.isEnabled()public void prepareRendering(IlvSDMEngine engine)
prepareRendering in class IlvFilterSDMRendererengine - The SDM engine.
public void nodeGraphicAdded(IlvSDMEngine engine,
Object object,
IlvGraphic graphic,
boolean redraw)
nodeGraphicAdded in class IlvFilterSDMRendererengine - 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 IlvFilterSDMRendererengine - 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 propertyChanged(IlvSDMEngine engine,
Object object,
String propertyName,
Object oldValue,
Object newValue,
IlvGraphic graphic)
propertyChanged in class IlvFilterSDMRendererengine - The SDM engine associated with the grapher in
which the graphic object is displayed.object - The data object whose property has changed.propertyName - The name of the property that has been modified.oldValue - The old value of the property.newValue - The new value of the property.graphic - The graphic object associated with object.
public void customize(IlvSDMEngine engine,
Object object,
IlvGraphic g,
String[] pseudoClasses)
customize in class IlvFilterSDMRendererengine - 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 IlvFilterSDMRendererengine - The SDM engine.public void removeAll(IlvSDMEngine engine)
removeAll in class IlvFilterSDMRendererengine - The SDM engine.protected boolean needsViewListeners()
true, because this renderer needs to install
listeners on all the views.
needsViewListeners in class IlvSDMRendererIlvSDMRenderer.addViewListeners(ilog.views.IlvManagerView),
IlvSDMRenderer.removeViewListeners(ilog.views.IlvManagerView)protected void addViewListeners(IlvManagerView view)
addViewListeners in class IlvSDMRendererview - The manager view.IlvSDMRenderer.needsViewListeners()protected void removeViewListeners(IlvManagerView view)
removeViewListeners in class IlvSDMRendererview - The manager view.IlvSDMRenderer.needsViewListeners()
public void nodeGraphicBBoxChanged(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
IlvRect oldBBox,
IlvRect newBBox,
String[] pseudoClasses)
nodeGraphicBBoxChanged in class IlvFilterSDMRendererengine - 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 swim lane labels.
computeBBox in class IlvFilterSDMRendererengine - 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 swim lanes are horizontal, or false
if they are vertical. The direction of the swim lanes is determined by the
direction of the graph layout algorithm.
public int getSwimLaneCount()
public String getSwimLaneLabel(int i)
i - The index of the swim lane.
public void setSwimLaneLabel(int i,
String label)
i - The index of the swim lane.label - The new label.public Color getSwimLaneColor(int i)
i - The index of the swim lane.
public void setSwimLaneColor(int i,
Color color)
i - The index of the swim lane.color - The new color.public boolean isAutoColor(int i)
true if the color of the specified swim lane has been
set explicitly through setSwimLaneColor(int, java.awt.Color), or false if
the color of the swim lane has been allocated automatically.
i - The index of the swim lane.
public void moveSwimLane(IlvSDMEngine engine,
int index,
boolean rightOrDown)
engine - The SDM engine.index - The index of the swim lane.rightOrDown - If true, the swim lane is shifted to the
right (if swim lanes are vertical) or to the bottom (if they are horizontal).
If false, the swim lane is shifted to the
left (if swim lanes are vertical) or to the top (if they are horizontal).public float getSwimLaneWidth(int index)
index - The index of the swim lane.
public void setSwimLaneWidth(int index,
float newWidth)
index - The index of the swim lane.newWidth - The new width.
public void createSwimLane(Object activity,
String newLabel)
activity - newLabel - public void adjustSpacing(float delta)
delta.
delta - The amount by which the spacing between swim lanes
is changed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||