public class SwimlaneDescriptor extends Object implements Comparable, com.yworks.yfiles.algorithms.Comparators.IPartialOrder
HierarchicLayoutCore during the various phases and models a swimlane structure.
For layout orientation
LayoutOrientation.TOP_TO_BOTTOM, swimlanes partition the drawing area into vertical
stripes. Each node is placed within a user-specified lane. Swimlanes are, for example, often used in flow diagrams to
separate logical units.
Each node should be associated with a SwimLaneDescriptor instance; nodes in the same lane may share one instance. The results of the calculation of the swimlanes' geometry will be stored by the instances after the layout.
A SwimlaneDescriptor instance can be bound to the layout algorithm using a IDataProvider
registered with the graph using key HierarchicLayoutCore.SWIMLANE_DESCRIPTOR_DPKEY that returns a SwimlaneDescriptor
instance for each node of the graph.
PartitionGrid offers a newer implementation which supports both horizontal and
vertical swimlanes.HierarchicLayoutCore.SWIMLANE_DESCRIPTOR_DPKEY| Constructor and Description |
|---|
SwimlaneDescriptor(Comparable clientObject)
Creates a new
SwimlaneDescriptor instance with a given Comparable object. |
SwimlaneDescriptor(Object clientObject,
Comparator<Object> comparator)
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Object o)
|
Object |
getClientObject()
Gets the client
object. |
Comparator<Object> |
getComparator()
Gets the
Comparator instance used for sorting the lanes. |
int |
getComputedLaneIndex()
Gets the computed zero-based index of the swimlane after the layout has been calculated.
|
double |
getComputedLanePosition()
Gets the computed position (smaller coordinate) of the swimlane after the layout has been calculated.
|
double |
getComputedLaneWidth()
Gets the computed width of the swimlane after the layout has been calculated.
|
double |
getLaneTightness()
Gets the tightness factor of the lane.
|
double |
getLeftLaneInset()
Gets the left insets of the swimlane in which no element will lie in the resulting layout.
|
double |
getMinimumLaneWidth()
Gets the minimum width of the swimlane.
|
double |
getRightLaneInset()
Gets the right insets of the swimlane in which no element will lie in the resulting layout.
|
boolean |
isIndexFixed()
Gets whether or not an index of a swimlane is fixed (based on the result of the comparison with the other swimlanes) or
whether the index should be chosen automatically in order to minimize edge lengths.
|
void |
setClientObject(Object value)
Sets the client
object. |
void |
setComparator(Comparator<Object> value)
Sets the
Comparator instance used for sorting the lanes. |
void |
setIndexFixed(boolean value)
Sets whether or not an index of a swimlane is fixed (based on the result of the comparison with the other swimlanes) or
whether the index should be chosen automatically in order to minimize edge lengths.
|
void |
setLaneTightness(double value)
Sets the tightness factor of the lane.
|
void |
setLeftLaneInset(double value)
Sets the left insets of the swimlane in which no element will lie in the resulting layout.
|
void |
setMinimumLaneWidth(double value)
Sets the minimum width of the swimlane.
|
void |
setRightLaneInset(double value)
Sets the right insets of the swimlane in which no element will lie in the resulting layout.
|
public SwimlaneDescriptor(Comparable clientObject)
SwimlaneDescriptor instance with a given Comparable object.IllegalArgumentException - if the specified client object is null.clientObject - a Comparable used for determining the order of the lanespublic SwimlaneDescriptor(Object clientObject, Comparator<Object> comparator)
SwimlaneDescriptor instance with a given client Object and a given Comparator.
The given client Object should be an instance of Comparable if the given Comparator is
null.
IllegalArgumentException - if the specified client Object is null or the specified Comparator is null but the
specified client Object is not an instance of Comparable.clientObject - a client Object used for sorting the lanescomparator - a Comparator used for comparing the client objectspublic int compareTo(Object o)
compareTo in interface Comparablepublic Object getClientObject()
object.
The given client Object should be an instance of Comparable.
IllegalArgumentException - if there is currently no comparator and the specified object is not a Comparable instanceObjectgetComparator(),
setComparator(Comparator),
setClientObject(Object)public Comparator<Object> getComparator()
Comparator instance used for sorting the lanes.IllegalArgumentException - if the specified Comparator is null.Comparator instancesetComparator(Comparator)public int getComputedLaneIndex()
-1 if no index has been computed for this lane.public double getComputedLanePosition()
public double getComputedLaneWidth()
public double getLaneTightness()
This value should lie within [0,1] interval.
The greater the value, the more will the lane be forced to obtain its minimum possible width.
0.0d will disable compression of the lane.1.0d will try to force the lane to obtain its minimum width.IllegalArgumentException - if the tightness value is outside [0,1] interval[0,1] intervalsetLaneTightness(double)public double getLeftLaneInset()
The inset should be non-negative.
IllegalArgumentException - if the specified value is less than 0.setLeftLaneInset(double)public double getMinimumLaneWidth()
The minimum width should be non-negative.
IllegalArgumentException - if the specified value negativesetMinimumLaneWidth(double)public double getRightLaneInset()
The inset should be non-negative.
IllegalArgumentException - if the specified value is less than 0.setRightLaneInset(double)public boolean isIndexFixed()
For all swimlanes where this property is set to
true, the relative ordering given by the client objects is preserved. The remaining swimlanes may be sorted
again so that the overall edge lengths are minimized.
true. The index of the swimlane will not be determined automatically.true if the swimlane index are determined automatically, false otherwisesetIndexFixed(boolean)public void setClientObject(Object value)
object.
The given client Object should be an instance of Comparable.
IllegalArgumentException - if there is currently no comparator and the specified object is not a Comparable instancevalue - the given client ObjectgetComparator(),
setComparator(Comparator),
getClientObject()public void setComparator(Comparator<Object> value)
Comparator instance used for sorting the lanes.IllegalArgumentException - if the specified Comparator is null.value - the current Comparator instancegetComparator()public void setIndexFixed(boolean value)
For all swimlanes where this property is set to
true, the relative ordering given by the client objects is preserved. The remaining swimlanes may be sorted
again so that the overall edge lengths are minimized.
true. The index of the swimlane will not be determined automatically.value - true if the swimlane index are determined automatically, false otherwiseisIndexFixed()public void setLaneTightness(double value)
This value should lie within [0,1] interval.
The greater the value, the more will the lane be forced to obtain its minimum possible width.
0.0d will disable compression of the lane.1.0d will try to force the lane to obtain its minimum width.IllegalArgumentException - if the tightness value is outside [0,1] intervalvalue - a tightness value from [0,1] intervalgetLaneTightness()public void setLeftLaneInset(double value)
The inset should be non-negative.
IllegalArgumentException - if the specified value is less than 0.value - the current left insetsgetLeftLaneInset()public void setMinimumLaneWidth(double value)
The minimum width should be non-negative.
IllegalArgumentException - if the specified value negativevalue - the minimum widthgetMinimumLaneWidth()public void setRightLaneInset(double value)
The inset should be non-negative.
IllegalArgumentException - if the specified value is less than 0.value - the current right insetsgetRightLaneInset()