y.layout.hierarchic.incremental
Class SwimLaneDescriptor

java.lang.Object
  extended by y.layout.hierarchic.incremental.SwimLaneDescriptor
All Implemented Interfaces:
Comparable

public class SwimLaneDescriptor
extends Object
implements Comparable

This class is used by HierarchicLayouter during the various phases to associate swim lanes with each node. 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 geometry of the swim lanes will be placed into the instances of this class after the layout.
It can be bound to the layout algorithm using the HierarchicLayouter.SWIMLANE_DESCRIPTOR_DPKEY DataProvider key.
This class is designed as a class to allow for future additions of new getter methods.

See Also:
HierarchicLayouter.SWIMLANE_DESCRIPTOR_DPKEY
 

Constructor Summary
SwimLaneDescriptor(Comparable clientObject)
          Creates a new swim lane descriptor with an associated client object.
SwimLaneDescriptor(Object clientObject, Comparator cmp)
          Creates a new swim lane descriptor using the given client object and comparator.
 
Method Summary
 int compareTo(Object o)
          Implements the Comparable interface using the getComparator() and getClientObject() fields.
 Object getClientObject()
          Returns the client object.
 Comparator getComparator()
          Returns the comparator that is used for sorting the lanes.
 int getComputedLaneIndex()
          Returns the computed zero-based index of the lane after the layout has been calculated.
 double getComputedLanePosition()
          Returns the computed position (smaller coordinate) of the lane after the layout has been calculated.
 double getComputedLaneWidth()
          Returns the computed width of the lane after the layout has been calculated.
 double getLaneTightness()
          Returns the tightness factor of the lane.
 double getLeftLaneInset()
          Returns the left lane inset where no element will lie in the resulting drawing.
 double getMinimumLaneWidth()
          Returns the minimum lane width.
 double getRightLaneInset()
          Returns the right lane inset where no element will lie in the resulting drawing.
 void setClientObject(Object o)
          Sets the client object.
 void setComparator(Comparator c)
          Sets the comparator used for sorting the lanes.
 void setLaneTightness(double tightness)
          Sets the tightness factor of the lane.
 void setLeftLaneInset(double inset)
          Sets the left lane inset where no element will lie in the resulting drawing.
 void setMinimumLaneWidth(double laneWidth)
          Sets the minimum width of the lane.
 void setRightLaneInset(double inset)
          Sets the right lane inset where no element will lie in the resulting drawing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwimLaneDescriptor

public SwimLaneDescriptor(Comparable clientObject)
Creates a new swim lane descriptor with an associated client object.

Parameters:
clientObject - an object provided by the client that will be used for determining the order of the lanes.

SwimLaneDescriptor

public SwimLaneDescriptor(Object clientObject,
                          Comparator cmp)
Creates a new swim lane descriptor using the given client object and comparator.

Parameters:
clientObject - a client object used for sorting the lanes
cmp - a Comparator used for comparing the client objects.
Method Detail

setClientObject

public void setClientObject(Object o)
Sets the client object.

Parameters:
o - the new object

getClientObject

public Object getClientObject()
Returns the client object.

Returns:
the client object

setLaneTightness

public void setLaneTightness(double tightness)
Sets the tightness factor of the lane. The greater the value the more will the lane to be forced to be of its minimal possible width. A value of 0.0d will disable compression of the lane. A value of 1.0d will try to force the lane to be of its minimum width.

Throws:
IllegalArgumentException - if tightness is out of the valid range
Parameters:
tightness - the tightness of the lane [0.0d .. 1.0d]

getLaneTightness

public double getLaneTightness()
Returns the tightness factor of the lane. The default is 0.0d.

Returns:
the tightness of the lane [0.0d .. 1.0d]
See Also:
setLaneTightness(double)

setComparator

public void setComparator(Comparator c)
Sets the comparator used for sorting the lanes.

Parameters:
c - the comparator

getComparator

public Comparator getComparator()
Returns the comparator that is used for sorting the lanes.


getMinimumLaneWidth

public double getMinimumLaneWidth()
Returns the minimum lane width. The default is 0.0d.

Returns:
the minimum width of a swim lane

setMinimumLaneWidth

public void setMinimumLaneWidth(double laneWidth)
Sets the minimum width of the lane.

Parameters:
laneWidth - the new width

getLeftLaneInset

public double getLeftLaneInset()
Returns the left lane inset where no element will lie in the resulting drawing. The default is 0.0d.

Returns:
the left inset

getRightLaneInset

public double getRightLaneInset()
Returns the right lane inset where no element will lie in the resulting drawing. The default is 0.0d.

Returns:
the right inset

setLeftLaneInset

public void setLeftLaneInset(double inset)
Sets the left lane inset where no element will lie in the resulting drawing.

Parameters:
inset - the new inset

setRightLaneInset

public void setRightLaneInset(double inset)
Sets the right lane inset where no element will lie in the resulting drawing.

Parameters:
inset - the new inset

getComputedLanePosition

public double getComputedLanePosition()
Returns the computed position (smaller coordinate) of the lane after the layout has been calculated.

Returns:
the smaller coordiante of the lane

getComputedLaneWidth

public double getComputedLaneWidth()
Returns the computed width of the lane after the layout has been calculated.

Returns:
the computed width of the lane

getComputedLaneIndex

public int getComputedLaneIndex()
Returns the computed zero-based index of the lane after the layout has been calculated.

Returns:
the computed lane index

compareTo

public int compareTo(Object o)
Implements the Comparable interface using the getComparator() and getClientObject() fields.

Specified by:
compareTo in interface Comparable

© Copyright 2000-2008,
yWorks GmbH.
All rights reserved.