com.dlsc.flexgantt.model.gantt
Interface IGanttChartModel<T,S>

Type Parameters:
T - the type of the node objects
S - the type of the timeline objects
All Superinterfaces:
ITreeTableModel<T>, javax.swing.tree.TreeModel
All Known Implementing Classes:
DefaultGanttChartModel

public interface IGanttChartModel<T,S>
extends ITreeTableModel<T>

A Gantt chart model provides various kinds of information in order to populate a Gantt chart with data. It is a specialization of a tree table model (see ITreeTableModel) where the superclass methods provide the data for the left-hand side of the chart and the subclass provides the right-hand side values.

A Gantt chart model provides the following information:

Listeners of type IGanttChartModelListener can be attached to the model. The listeners will be informed in these cases:

Since:
1.0
Author:
Dirk Lemmermann
See Also:
AbstractGanttChart.setModel(IGanttChartModel), DualGanttChart.setSecondaryModel(IGanttChartModel), IGanttChartModelListener, IGanttChartNode

Method Summary
 void addGanttChartModelListener(IGanttChartModelListener l)
          Adds a listener to the model.
 java.util.Iterator<S> getChildrenTimelineObjects(S parent)
          Returns an iterator over the children of the given parent timeline object.
 java.util.Iterator<ILayer> getLayers()
          Returns an iterator over the layers used by the model.
 java.util.Iterator<IRelationship<S>> getRelationships()
          Returns all relationships so that they can be visualized by the RelationshipLayer.
 java.util.Iterator<IRelationship<S>> getRelationships(S timelineObject)
          Returns those relationships that have the given timeline object either as a source or as a target object.
 java.util.Iterator<S> getTimelineObjectsIterator(T node, ILayer layer, ITimeSpan span)
          Returns an Iterator that can be used to iterate over all timeline objects stored on the given node and layer within the given time span.
 ITimeSpan getTimeSpan(S timelineObject)
          Returns the time span of the given timeline object.
 boolean isParentTimelineObject(S timelineObject)
          Determines whether the given timeline object is a parent timeline object.
 void removeGanttChartModelListener(IGanttChartModelListener l)
          Removes a listener from the model.
 
Methods inherited from interface com.dlsc.flexgantt.model.treetable.ITreeTableModel
addTreeTableModelListener, getColumnValue, getKey, getRowHeaderValue, removeTreeTableModelListener, setColumnValue, setKey, sort
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
 

Method Detail

getLayers

java.util.Iterator<ILayer> getLayers()
Returns an iterator over the layers used by the model. The layer container has to create one TimelineObjectLayer for each layer model definition.

Returns:
the stack of layers required by the model in order to display all of its timeline objects
Since:
1.0
See Also:
getTimelineObjectsIterator(Object, ILayer, ITimeSpan)

getTimelineObjectsIterator

java.util.Iterator<S> getTimelineObjectsIterator(T node,
                                                 ILayer layer,
                                                 ITimeSpan span)
Returns an Iterator that can be used to iterate over all timeline objects stored on the given node and layer within the given time span. This method is not allowed to return NULL.

Parameters:
node - the tree node for which to return an iterator
layer - the layer for which to return an iterator
span - the time span for which to return an iterator
Returns:
an iterator for iterating over timeline objects stored on the given node, layer and time span
Since:
1.0

getTimeSpan

ITimeSpan getTimeSpan(S timelineObject)
Returns the time span of the given timeline object. The span doesn't necessarily has to be stored directly on the object but might be retrieved by some other means. However, DefaultGanttChartModel does store the span on the internally used IGanttChartNode instances.

Parameters:
timelineObject - the object for which to return the time span
Returns:
the time span used by the given timeline object
Since:
1.0

getRelationships

java.util.Iterator<IRelationship<S>> getRelationships()
Returns all relationships so that they can be visualized by the RelationshipLayer.

Returns:
all relationships currently known to the model
Since:
1.0

getRelationships

java.util.Iterator<IRelationship<S>> getRelationships(S timelineObject)
Returns those relationships that have the given timeline object either as a source or as a target object. This method gets called when the timeline object is currently visible and the RelationshipLayer wants to figure out which lines need to be drawn.

Parameters:
timelineObject - the object for which to return relationships
Returns:
all relationships where the given object is either the source or the target
Since:
1.0

isParentTimelineObject

boolean isParentTimelineObject(S timelineObject)
Determines whether the given timeline object is a parent timeline object. A parent timeline object references children timeline objects. This concept is often used to display the union of several time spans of timeline objects (summary).

Parameters:
timelineObject - the timeline object to check
Returns:
TRUE if the given timeline object is a parent of one or more children timeline objects
Since:
1.0
See Also:
getChildrenTimelineObjects(Object)

getChildrenTimelineObjects

java.util.Iterator<S> getChildrenTimelineObjects(S parent)
Returns an iterator over the children of the given parent timeline object.

Parameters:
parent - the parent timeline object
Returns:
an iterator used for iterating over the list of children timeline objects associated with the given parent timeline object
Since:
1.0

addGanttChartModelListener

void addGanttChartModelListener(IGanttChartModelListener l)
Adds a listener to the model. The listener will be informed when any of the following situations occurs:

Parameters:
l - the new listener
Since:
1.0
See Also:
removeGanttChartModelListener(IGanttChartModelListener), GanttChartModelEvent

removeGanttChartModelListener

void removeGanttChartModelListener(IGanttChartModelListener l)
Removes a listener from the model.

Parameters:
l - the listener to remove
Since:
1.0
See Also:
addGanttChartModelListener(IGanttChartModelListener)