com.dlsc.flexgantt.policy.layer
Class DefaultLinePolicy

java.lang.Object
  extended by com.dlsc.flexgantt.policy.AbstractPolicy
      extended by com.dlsc.flexgantt.policy.layer.DefaultLinePolicy
All Implemented Interfaces:
IPolicy, ILinePolicy

public class DefaultLinePolicy
extends AbstractPolicy
implements ILinePolicy

The default implementation of the line policy delegates all of its method invocations to the nodes and timeline objects that get passed to it as parameters. In order for this to work the nodes need to implement the IGanttChartNode interface and the timeline objects need to implement the ITimelineObject interface. For more general information on the purpose of this policy please refer to ILinePolicy.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
IGanttChartNode.getLineCount(), IGanttChartNode.getLineHeight(int, int), IGanttChartNode.getLineLocation(int, int), ITimelineObject.getLineIndex()

Constructor Summary
DefaultLinePolicy()
           
 
Method Summary
 int getLineCount(java.lang.Object node, ITreeTableModel model)
          Returns the number of (inner) lines shown in the row of a hierarchy node.
 int getLineHeight(java.lang.Object node, ITreeTableModel model, int lineIndex, int rowHeight)
          Returns the height of a specific (inner) line.
 int getLineIndex(java.lang.Object node, ITreeTableModel model, java.lang.Object timelineObject)
          Returns the index of the line on which the given timeline object shall be placed (the indices start with 0).
 int getLineLocation(java.lang.Object node, ITreeTableModel model, int lineIndex, int rowHeight)
          Returns the y-coordinate of a specific (inner) line.
 boolean isLineVisible(java.lang.Object node, ITreeTableModel model, int lineIndex)
          Determines whether a specific (inner) line is currently visible or not.
 
Methods inherited from class com.dlsc.flexgantt.policy.AbstractPolicy
assertClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLinePolicy

public DefaultLinePolicy()
Method Detail

getLineCount

public int getLineCount(java.lang.Object node,
                        ITreeTableModel model)
Description copied from interface: ILinePolicy
Returns the number of (inner) lines shown in the row of a hierarchy node.

Specified by:
getLineCount in interface ILinePolicy
Parameters:
node - the hierarchy node for which to return the total number of lines
model - the tree table model to which the node belongs
Returns:
the number of (inner) lines shown in the row of a hierarchy node

getLineLocation

public int getLineLocation(java.lang.Object node,
                           ITreeTableModel model,
                           int lineIndex,
                           int rowHeight)
Description copied from interface: ILinePolicy
Returns the y-coordinate of a specific (inner) line. The bounds of timeline objects belonging to that line will be constrained by this coordinate and the height of the line.

Specified by:
getLineLocation in interface ILinePolicy
Parameters:
node - the hierarchy node for which to return the total number of lines
model - the tree table model to which the node belongs
lineIndex - the index of the line for which to return the y-coordinate
rowHeight - the height of the row to which the line belongs
Returns:
the y-coordinate for the line with the given index
See Also:
ILinePolicy.getLineHeight(Object, ITreeTableModel, int, int)

getLineHeight

public int getLineHeight(java.lang.Object node,
                         ITreeTableModel model,
                         int lineIndex,
                         int rowHeight)
Description copied from interface: ILinePolicy
Returns the height of a specific (inner) line. The bounds of timeline objects belonging to that line will be constrained by this height and the y-coordinate of the line.

Specified by:
getLineHeight in interface ILinePolicy
Parameters:
node - the hierarchy node for which to return the total number of lines
model - the tree table model to which the node belongs
lineIndex - the index of the line for which to return the height
rowHeight - the height of the row to which the line belongs
Returns:
the height for the line with the given index

getLineIndex

public int getLineIndex(java.lang.Object node,
                        ITreeTableModel model,
                        java.lang.Object timelineObject)
Description copied from interface: ILinePolicy
Returns the index of the line on which the given timeline object shall be placed (the indices start with 0).

Specified by:
getLineIndex in interface ILinePolicy
Parameters:
node - the hierarchy node for which to return the total number of lines
model - the tree table model to which the node belongs
timelineObject - the timeline object for which to return the line index
Returns:
the index of the line on which the given timeline object shall be placed

isLineVisible

public boolean isLineVisible(java.lang.Object node,
                             ITreeTableModel model,
                             int lineIndex)
Description copied from interface: ILinePolicy
Determines whether a specific (inner) line is currently visible or not.

Specified by:
isLineVisible in interface ILinePolicy
Parameters:
node - the hierarchy node for which to return the total number of lines
model - the tree table model to which the node belongs
lineIndex - the index of the line for which to determine the visibility
Returns:
TRUE if the given (inner) line is currently visible