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>, 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:
  - An array of `Layer` definitions. Various types of layers are used on the right-hand side of the Gantt chart. The layer definitions returned by the model will result in the creation of instances of `TimelineObjectLayer` , which are responsible for rendering the timeline objects
  - Timeline object iterators (see `BinarySearchTimelineObjectIterator` or `LinearSearchTimelineObjectIterator`) for a given layer and time span. When the user scrolls the right-hand side of the Gantt chart only a small part needs to be repainted. If the user scrolled 10 pixels to the right, the time span covered by these 10 pixels will be used for a model query.
  - A collection of `IRelationship` objects for a given timeline object. The relationships will be visualized via connecting lines between objects.
  Listeners of type `IGanttChartModelListener` can be attached to the model. The listeners will be informed in these cases:

  - the time span of a timeline object changes
  - the relationships of a timeline object changes
  - layers are being added or removed
  - timeline objects are being added or removed
  Since:
    1.0
  Version:
    $Revision: 1.36 $
  Author:
    Dirk Lemmermann
  See Also:
    `AbstractGanttChart.setModel(IGanttChartModel)`, `DualGanttChart.setSecondaryModel(IGanttChartModel)`, `IGanttChartModelListener`, `IGanttChartNode`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addGanttChartModelListener(IGanttChartModelListener l)` Adds a listener to the model.
    `Iterator<S>` | `getChildrenTimelineObjects(S parent)` Returns an iterator over the children of the given parent timeline object.
    `Iterator<ILayer>` | `getLayers()` Returns an iterator over the layers used by the model.
    `Iterator<IRelationship<S>>` | `getRelationships()` Returns all relationships so that they can be visualized by the `RelationshipLayer`.
    `Iterator<IRelationship<S>>` | `getRelationships(S timelineObject)` Returns those relationships that have the given timeline object either as a source or as a target object.
    `Iterator<ISpreadsheet>` | `getSpreadsheets()` Returns an iterator over the spreadsheets used by the model.
    `Object` | `getSpreadsheetValue(ISpreadsheet spreadsheet, T node, ITimeSpan span)` Returns an object for the given tree node, the given spreadsheet and the given time span.
    `Class` | `getSpreadsheetValueType(ISpreadsheet spreadsheet, T node, ITimeSpan span)` Returns the type of the object shown within the specified spreadsheet cell (specification via tree node, spreadsheet, time span).
    `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

          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

          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

          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

          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

          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

    - #### getSpreadsheets

          Iterator<ISpreadsheet> getSpreadsheets()

      Returns an iterator over the spreadsheets used by the model. The layer container manages a single instance of `SpreadsheetLayer` which is capable of displaying one spreadsheet at a time.
      Returns:
        an iterator over all spreadsheets defined for the Gantt chart
      Since:
        2.1

    - #### getSpreadsheetValue

          Object getSpreadsheetValue(ISpreadsheet spreadsheet,
                                     T node,
                                     ITimeSpan span)

      Returns an object for the given tree node, the given spreadsheet and the given time span. Time spans passed to this method usually define a whole day, month, week or year.
      Parameters:
        `spreadsheet` - the spreadsheet for which to return a value for the given node and time span
        `node` - a node within the tree table on the left-hand side of the Gantt chart
        `span` - the time span for which to return a value (the span is usually a whole day, month, week ...)
      Returns:
        a value for a spreadsheet cell where the cell is defined by the given node and time span
      Since:
        2.1
      See Also:
        `getSpreadsheetValueType(ISpreadsheet, Object, ITimeSpan)`

    - #### getSpreadsheetValueType

          Class getSpreadsheetValueType(ISpreadsheet spreadsheet,
                                        T node,
                                        ITimeSpan span)

      Returns the type of the object shown within the specified spreadsheet cell (specification via tree node, spreadsheet, time span). This method is important for looking up the correct cell editor for the spreadsheet cell if the cell currently does not provide a value.
      Parameters:
        `spreadsheet` - the spreadsheet for which to return a value type
        `node` - a node within the tree table on the left-hand side of the Gantt chart
        `span` - the time span for which to return a value type (the span is usually a whole day, month, week ...)
      Returns:
        the type of object that will be shown in the given time span for the given node
      Since:
        2.1
      See Also:
        `getSpreadsheetValue(ISpreadsheet, Object, ITimeSpan)`

    - #### addGanttChartModelListener

          void addGanttChartModelListener(IGanttChartModelListener l)

      Adds a listener to the model. The listener will be informed when any of the following situations occurs:
      - the overall time span changes
      - time zone changes
      - the time span of a timeline object changes
      - the capacity of a timeline object changes
      - the percentage complete of a timeline object changes
      - the relationships of a timeline object changes
      - layers are being added or removed
      - spreadsheets are being added or removed
      - spreadsheet values change
      - timeline objects are being added or removed
      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)`

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.