public class IlvSwimLaneConstraint extends IlvHierarchicalConstraint
IlvSwimLaneConstraint
is a constraint that
forces a group of nodes to be placed in the same column or row.
Swimlanes are orthogonal to the levels. If the link flow direction is
towards bottom or top, the levels are horizontal rows and the
swimlanes are vertical columns. If the flow direction is towards left
or right, the levels are vertical columns and the swimlanes are
horizontal rows.
The nodes of the same swimlane are placed so that it is possible to draw a surrounding rectangle around them. Swimlanes allow to organize the graph in a table-like manner. For instance, you may have a workflow diagram where nodes represent actions, then the swimlanes could represent the departments that perform these actions. Each node can only belong to one swimlane.
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 to break the swimlanes apart. The swimlane constraint dominates the specified position indexes and the extremity constraints, i.e., if a swimlane constraint is used, you cannot specify position indexes or east/west extremity constraints for any node.
The automatic conflict resolution can handle conflicting constraints. However, to speedup the layout, it is recommended to specify constraints in a way such that there are no conflicts.
Swimlane constraints work in flat graphs. It is not possible to spread
a subgraph among multiple swimlanes. Swimlane constraints do not work
in recursive layout mode IlvHierarchicalLayout.setRecursiveLayoutMode(boolean)
.
IlvHierarchicalLayout.addConstraint(IlvHierarchicalConstraint)
,
IlvHierarchicalLayout.setIncrementalMode(boolean)
,
Serialized FormConstructor and Description |
---|
IlvSwimLaneConstraint(IlvInputStream stream)
Creates a new
IlvSwimLaneConstraint from an
IlvInputStream . |
IlvSwimLaneConstraint(IlvNodeGroup group)
Creates a new
IlvSwimLaneConstraint . |
IlvSwimLaneConstraint(IlvNodeGroup group,
double relativeSize,
int positionIndex)
Creates a new
IlvSwimLaneConstraint . |
IlvSwimLaneConstraint(IlvNodeGroup group,
double relSize,
int posIndex,
double margin)
Creates a new
IlvSwimLaneConstraint . |
IlvSwimLaneConstraint(IlvNodeGroup group,
double relSize,
int posIndex,
double westMargin,
double eastMargin)
Creates a new
IlvSwimLaneConstraint . |
IlvSwimLaneConstraint(IlvSwimLaneConstraint source)
Creates a new
IlvSwimLaneConstraint by copying an
existing one. |
Modifier and Type | Method and Description |
---|---|
IlvHierarchicalConstraint |
copy()
Copies the constraint.
|
IlvRect |
getCalcBoundingBox()
Returns the calculated bounding box of the swimlane.
|
int |
getCalcPositionIndex()
Returns the calculated position index of the swimlane.
|
double |
getEastMinMargin()
Returns the specified minimal margin of the swimlane at the east side.
|
IlvNodeGroup |
getGroup()
Returns the group of this constraint.
|
double |
getMinMargin()
Deprecated.
Since JViews 8.7, use
getEastMinMargin() and getWestMinMargin() . |
double |
getRelativeSize()
Returns the specified relative size of the swimlane.
|
int |
getSpecPositionIndex()
Returns the specified position index of the swimlane.
|
double |
getWestMinMargin()
Returns the specified minimal margin of the swimlane at the west side.
|
void |
setEastMinMargin(double margin)
Sets the minimal margin of the swimlane at the east side.
|
void |
setMinMargin(double margin)
Sets the minimal margin of the swimlane.
|
void |
setRelativeSize(double relativeSize)
Sets the relative size of the swimlane.
|
void |
setSpecPositionIndex(int positionIndex)
Sets the specified position index of the swimlane.
|
void |
setWestMinMargin(double margin)
Sets the minimal margin of the swimlane at the west side.
|
void |
write(IlvOutputStream stream)
Writes the constraint to the output stream.
|
getPriority, setPriority
public IlvSwimLaneConstraint(IlvNodeGroup group)
IlvSwimLaneConstraint
. The following
examples show how to use the constraint:
layout.addConstraint( new IlvSwimLaneConstraint(new IlvNodeGroup(nodeVector)));This forces the nodes of
nodeVector
to be placed in a
swim lane.group
- The node group.IlvHierarchicalLayout.addConstraint(IlvHierarchicalConstraint)
public IlvSwimLaneConstraint(IlvNodeGroup group, double relativeSize, int positionIndex)
IlvSwimLaneConstraint
. The following
examples show how to use the constraint:
layout.addConstraint( new IlvSwimLaneConstraint(new IlvNodeGroup(nodeVector), 1, 0));This forces the nodes of
nodeVector
to be placed in a
swim lane. The size of the swimlane is 1 unit, and it is the first
swimlane, because it has the position index 0.
Swimlanes may have a relative size. If the link flow direction is towards bottom or top, the swimlanes are columns in the layout and the relative size indicates the width of the column. If all swimlanes have the same relative size, the layout arranges the swimlanes so that they have the same width. If for instance a swimlane has relative size 3, then its width is three times larger than a swimlane with relative size 1. If you do not want to restrict the width of the columns, specify the relative size 0, which indicates that the layout calculate an appropriate width of the column that is independent from the width of the other columns.
If the flow direction is towards left or right, the swimlanes are
rows in the layout and the relative size indicates the height of the
row. The relative size of a swimlane may be ignored in incremental
mode if the node movement mode is FIXED_MODE
.
Similar 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 has the position
index -1
, the layout algorithm determines the
appropriate position automatically.
group
- The node group.relativeSize
- The relative size of the swimlane.positionIndex
- The position index of the swimlane.setRelativeSize(double)
,
setSpecPositionIndex(int)
,
IlvHierarchicalLayout.addConstraint(IlvHierarchicalConstraint)
,
IlvHierarchicalLayout.setSpecNodePositionIndex(java.lang.Object, int)
public IlvSwimLaneConstraint(IlvNodeGroup group, double relSize, int posIndex, double margin)
IlvSwimLaneConstraint
.
The following examples show how to use the constraint:
layout.addConstraint( new IlvSwimLaneConstraint(new IlvNodeGroup(nodeVector), 1, 0, 5));This forces the nodes of
nodeVector
to be placed in a
swim lane. The size of the swimlane is 1 unit, and it is the first
swimlane, because it has the position index 0. The minimal margin of
the swimlane is 5 units.
Swimlanes may have a relative size and a minimal margin. If the link flow direction is towards bottom or top, the swimlanes are columns in the layout, the relative size indicates the width of the column, and the minimal margin is at the left and right side of the swim lane. If all swimlanes have the same relative size, the layout arranges the swimlanes so that they have the same width. If for instance a swim lane has relative size 3, then its width is three times larger than a swimlane with relative size 1. If you do not want to restrict the width of the columns, specify the relative size 0, which indicates that the layout calculates an appropriate width of the column that is independent from the width of the other columns.
If the flow direction is towards left or right, the swimlanes are
rows in the layout, the relative size indicates the height of the
row, and the minimal margin is at the top and bottom side of the
swimlane. The relative size of a swimlane may be ignored in
incremental mode if the node movement mode is
FIXED_MODE
.
Similar 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 has the position
index -1
, the layout algorithm determines the
appropriate position automatically.
group
- The node group.relSize
- The relative size of the swimlane.posIndex
- The position index of the swimlane.margin
- The minimal margin of the swimlane.setRelativeSize(double)
,
setSpecPositionIndex(int)
,
IlvHierarchicalLayout.addConstraint(IlvHierarchicalConstraint)
,
IlvHierarchicalLayout.setSpecNodePositionIndex(java.lang.Object, int)
public IlvSwimLaneConstraint(IlvNodeGroup group, double relSize, int posIndex, double westMargin, double eastMargin)
IlvSwimLaneConstraint
.
The following examples show how to use the constraint:
layout.addConstraint( new IlvSwimLaneConstraint( new IlvNodeGroup(nodeVector), 1, 0, 5, 5));This forces the nodes of
nodeVector
to be placed in a
swim lane. The size of the swimlane is 1 unit, and it is the first
swimlane, because it has the position index 0. The minimal margin of
the swimlane is 5 units at the east and west side.
Swimlanes may have a relative size and a minimal margin. If the link flow direction is towards bottom or top, the swimlanes are columns in the layout, the relative size indicates the width of the column, and the minimal margin is at the left and right side of the swim lane. If the flow direction is towards bottom, the west margin is at the left side and the east margin is at the right side. If the flow direction is towards top, the west margin is at the right side and the east margin is at the left side. If all swimlanes have the same relative size, the layout arranges the swimlanes so that they have the same width. If for instance a swimlane has relative size 3, then its width is three times larger than a swimlane with relative size 1. If you do not want to restrict the width of the columns, specify the relative size 0, which indicates that the layout calculates an appropriate width of the column that is independent from the width of the other columns.
If the flow direction is towards left or right, the swimlanes are
rows in the layout, the relative size indicates the height of the
row, and the minimal margin is at the top and bottom side of the
swimlane. If the flow direction is towards right, the west margin is
at the bottom side and the east margin is at the top side. If the
flow direction is towards left, the west margin is at the top side
and the east margin is at the bottom side. The relative size of a
swimlane may be ignored in incremental mode if the node movement mode
is FIXED_MODE
.
Similar 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 has the position
index -1
, the layout algorithm determines the
appropriate position automatically.
group
- The node group.relSize
- The relative size of the swimlane.posIndex
- The position index of the swimlane.westMargin
- The minimal margin of the swimlane at the west side.eastMargin
- The minimal margin of the swimlane at the east side.setRelativeSize(double)
,
setSpecPositionIndex(int)
,
IlvHierarchicalLayout.addConstraint(IlvHierarchicalConstraint)
,
IlvHierarchicalLayout.setSpecNodePositionIndex(java.lang.Object, int)
public IlvSwimLaneConstraint(IlvSwimLaneConstraint source)
IlvSwimLaneConstraint
by copying an
existing one.source
- The origin of the copy.public IlvSwimLaneConstraint(IlvInputStream stream) throws IOException, IlvReadFileException
IlvSwimLaneConstraint
from an
IlvInputStream
.stream
- The input stream from which the property must be read.IlvReadFileException
- if an error occurs while reading.IOException
public IlvHierarchicalConstraint copy()
copy
in class IlvHierarchicalConstraint
public void write(IlvOutputStream stream) throws IOException
write
in interface IlvPersistentObject
write
in class IlvHierarchicalConstraint
stream
- The output stream.IOException
- standard IO error.public final IlvNodeGroup getGroup()
public final void setRelativeSize(double relativeSize)
If the flow direction is towards left or right, the swimlanes are rows in the layout and the relative size indicates the height of the row.
The relative size of a swimlane may be ignored in incremental mode if
the node movement mode is FIXED_MODE
.
public final double getRelativeSize()
setRelativeSize(double)
,
getCalcBoundingBox()
public final void setMinMargin(double margin)
The default margin is 0
.
getMinMargin()
public final double getMinMargin()
getEastMinMargin()
and getWestMinMargin()
.setMinMargin(double)
,
getCalcBoundingBox()
public final void setWestMinMargin(double margin)
The default margin is 0
.
getWestMinMargin()
public final double getWestMinMargin()
setWestMinMargin(double)
,
getCalcBoundingBox()
public final void setEastMinMargin(double margin)
The default margin is 0
.
getEastMinMargin()
public final double getEastMinMargin()
setEastMinMargin(double)
,
getCalcBoundingBox()
public final IlvRect getCalcBoundingBox()
getRelativeSize()
,
IlvGraphLayout.setCoordinatesMode(int)
public final void setSpecPositionIndex(int positionIndex)
Similar 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 has the position
index -1
, the layout algorithm determines the
appropriate position automatically.
getSpecPositionIndex()
,
getCalcPositionIndex()
public final int getSpecPositionIndex()
setSpecPositionIndex(int)
,
getCalcPositionIndex()
public final int getCalcPositionIndex()
This index is available after layout. The calculated position index
is the same as the specified position index unless -1
was specified.
setSpecPositionIndex(int)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.