com.dlsc.flexgantt.model.gantt
Interface IGanttChartNode<T>

Type Parameters:
T - the type of the timeline objects returned by the node
All Superinterfaces:
ITreeTableNode, javax.swing.tree.TreeNode
All Known Subinterfaces:
IResourceNode<T>
All Known Implementing Classes:
DefaultGanttChartNode, DefaultResourceNode

public interface IGanttChartNode<T>
extends ITreeTableNode

An extension of the ITreeTableNode interface, which carries additional information that can be used to populate the right-hand side of a Gantt chart. Objects that implement this interface are capable of returning objects for a given time span, values for rendering custom row headers, values for spreadsheet cells, etc.

Since:
1.0
Author:
Dirk Lemmermann

Method Summary
 void addTimelineObjects(ILayer layer, java.util.Collection<T> timelineObjects)
          Adds a collection of timeline objects to the node.
 void clearTimelineObjects(ILayer layer)
          Removes all timeline objects (currently shown on the given layer) from the node.
 int getDropActions(T timelineObject, long timePoint)
          Returns the drop actions that can be performed on the node related to timeline objects.
 int getLineCount()
          Returns how many lines will be shown within the row that is occuupied by the Gantt chart node.
 int getLineHeight(int lineIndex, int rowHeight)
          Returns the height of the line with the given index based on the given row height.
 int getLineLocation(int lineIndex, int rowHeight)
          Returns the location of the line with the given index based on the given row height.
 java.util.List<T> getTimelineObjects()
          Returns a list of all timeline objects on all layers.
 java.util.List<T> getTimelineObjects(ILayer layer)
          Returns a list of all timeline objects that are associated with the given layer.
 java.util.Iterator<T> getTimelineObjectsIterator(ILayer layer, ITimeSpan span)
          Returns an iterator for all timeline objects on the given layer for the given time span.
 boolean isSelectable(ITimeSpan span)
          Determines whether the given time span can be selected for the node.
 void removeTimelineObjects(ILayer layer, java.util.Collection<T> timelineObjects)
          Removes a collection of objects from the node.
 
Methods inherited from interface com.dlsc.flexgantt.model.treetable.ITreeTableNode
getColumnValue, getDragActions, getDropActions, getKey, getRowHeaderValue, getRowHeight, getRowHeightMaximum, getRowHeightMinimum, getToolTipText, isDeletable, isKeyEditable, isResizable, isRowLineVisible, isSelectable, isValueEditable, setColumnValue, setKey, setRowHeaderValue, setRowHeight, sort
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
 

Method Detail

getTimelineObjectsIterator

java.util.Iterator<T> getTimelineObjectsIterator(ILayer layer,
                                                 ITimeSpan span)
Returns an iterator for all timeline objects on the given layer for the given time span.

Parameters:
layer - the layer for which to return the timeline objects
span - the time span for which to return the timeline objects
Returns:
an iterator for the given layer and time span
Since:
1.0
See Also:
getTimelineObjects(ILayer), getTimelineObjects()

getTimelineObjects

java.util.List<T> getTimelineObjects()
Returns a list of all timeline objects on all layers.

Returns:
all timeline objects
Since:
1.0
See Also:
getTimelineObjects(ILayer)

getTimelineObjects

java.util.List<T> getTimelineObjects(ILayer layer)
Returns a list of all timeline objects that are associated with the given layer.

Parameters:
layer - the layer for which to return the timeline objects
Returns:
all timeline objects for the given layer
Since:
1.0
See Also:
getTimelineObjectsIterator(ILayer, ITimeSpan), addTimelineObjects(ILayer, Collection), removeTimelineObjects(ILayer, Collection)

clearTimelineObjects

void clearTimelineObjects(ILayer layer)
Removes all timeline objects (currently shown on the given layer) from the node.

Parameters:
layer - the layer from which to remove all timeline objects
Since:
1.0

addTimelineObjects

void addTimelineObjects(ILayer layer,
                        java.util.Collection<T> timelineObjects)
Adds a collection of timeline objects to the node. The objects have to be stored in a data structure that is mapped to the given layer.

Parameters:
layer - the layer to which the objects will be added
timelineObjects - the objects that will be added
Since:
1.0
See Also:
removeTimelineObjects(ILayer, Collection)

removeTimelineObjects

void removeTimelineObjects(ILayer layer,
                           java.util.Collection<T> timelineObjects)
Removes a collection of objects from the node. The objects have to be stored inside a data structure that is mapped to the given layer.

Parameters:
layer - the layer in which the timeline objects are currently shown
timelineObjects - the objects to remove
Since:
1.0
See Also:
addTimelineObjects(ILayer, Collection)

getLineCount

int getLineCount()
Returns how many lines will be shown within the row that is occuupied by the Gantt chart node. Timeline objects can be placed on these lines so that they do not overlap each other even when their time spans do intersect.

Returns:
the number of 'inner' lines within the Gantt chart row
Since:
1.0

getLineLocation

int getLineLocation(int lineIndex,
                    int rowHeight)
Returns the location of the line with the given index based on the given row height. In most cases this method will simply divide the row height by the total number of lines (see getLineCount()) and multiply it with the line index. This way all lines will be distributed equally across the total height of the row.

Parameters:
lineIndex - the index of the line for which to return a location (if the total line count is 4 then the indices will be 0, 1, 2, 3)
rowHeight - the total height of the Gantt chart row (this value can vary depending on whether the user or the application resized the row)
Returns:
the y-coordinate of the line (within the interval [0, rowHeight])
Since:
1.0

getLineHeight

int getLineHeight(int lineIndex,
                  int rowHeight)
Returns the height of the line with the given index based on the given row height. In most cases this method will simply divide the row height by the total number of lines (see getLineCount()) but applications are free to let lines overlap if so desired.

Parameters:
lineIndex - the index of the line for which to return the height (if the total line count is 4 then the indices will be 0, 1, 2, 3)
rowHeight - the total height of the Gantt chart row (this value can vary depending on whether the user or the application resized the row)
Returns:
the height of the line (within the interval [0, rowHeight])
Since:
1.0

isSelectable

boolean isSelectable(ITimeSpan span)
Determines whether the given time span can be selected for the node.

Parameters:
span - the time span to check for selectability
Returns:
TRUE if the given time span can be selected
Since:
1.0

getDropActions

int getDropActions(T timelineObject,
                   long timePoint)
Returns the drop actions that can be performed on the node related to timeline objects. Timeline objects can be allowed to be moved onto the node or copied to the node or both. The supported drop actions can be specified by using the constants defined in DnDConstants. Possible values are: Declaring the drop actions is only half of the work needed for correct drag and drop behaviour. A timeline object might be droppable onto the node but it also needs to be draggable.This behaviour is defined by calling ITimelineObject.getDragActions().

Parameters:
timelineObject - the timeline object that might get dropped onto this node
timePoint - the time point where the timeline object might get dropped
Returns:
the supported drop actions (move, copy, or both)
Since:
1.0
See Also:
DefaultDragAndDropCommand, IDragAndDropPolicy.getDragActions(Object, Object, IGanttChartModel)