com.dlsc.flexgantt.policy.layer
Interface ILinePolicy

All Superinterfaces:
IPolicy
All Known Implementing Classes:
DefaultLinePolicy

public interface ILinePolicy
extends IPolicy

A policy that can be used to create lines for timeline objects within the row of a node (nested rows, inner rows). Lines can be useful if the timeline objects that are placed on a hierarchy node overlap each other. If the total number of overlapping objects is known then this policy can return a line count equivalent to that number. To then keep the timeline object separated the policy needs to return a different line number for each object. Even if a row uses lines it is still possible to place timeline objects on the row instead of a line, hence filling the entire height of the row. This is done by returning -1 for the object's line index. This policy gets used by the TimelineObjectLayer when rendering the timeline objects and when calculating the bounds of these objects.

Since:
1.0
Author:
Dirk Lemmermann

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.
 

Method Detail

getLineCount

int getLineCount(java.lang.Object node,
                 ITreeTableModel model)
Returns the number of (inner) lines shown in the row of a hierarchy node.

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
Since:
1.0

getLineIndex

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).

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
Since:
1.0

getLineLocation

int getLineLocation(java.lang.Object node,
                    ITreeTableModel model,
                    int lineIndex,
                    int rowHeight)
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.

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
Since:
1.0
See Also:
getLineHeight(Object, ITreeTableModel, int, int)

getLineHeight

int getLineHeight(java.lang.Object node,
                  ITreeTableModel model,
                  int lineIndex,
                  int rowHeight)
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.

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
Since:
1.0

isLineVisible

boolean isLineVisible(java.lang.Object node,
                      ITreeTableModel model,
                      int lineIndex)
Determines whether a specific (inner) line is currently visible or not.

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
Since:
1.0