com.dlsc.flexgantt.model.gantt

## Interface IGanttChartNode<T>

- Type Parameters:
    `T` - the type of the timeline objects returned by the node
  All Superinterfaces:
    ITreeTableNode, 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

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTimelineObjects(ILayer layer, 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.
    `Object` | `getSpreadsheetValue(ISpreadsheet spreadsheet, ITimeSpan span)` Returns a value for the given time span.
    `List<T>` | `getTimelineObjects()` Returns a list of all timeline objects on all layers.
    `List<T>` | `getTimelineObjects(ILayer layer)` Returns a list of all timeline objects that are associated with the given layer.
    `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.
    `boolean` | `isTimelineObjectCreatableAt(ITimeSpan span, ILayer layer)` Determines whether a new timeline object can be created for the given time span.
    `void` | `removeTimelineObjects(ILayer layer, Collection<T> timelineObjects)` Removes a collection of objects from the node.
    `void` | `setSpreadsheetValue(ISpreadsheet spreadsheet, Object value, ITimeSpan span)` Specifies a new value for the given time span.

    - ### Methods inherited from interface com.dlsc.flexgantt.model.treetable.ITreeTableNode

      `getColumnValue, getDragActions, getDropActions, getKey, getPopupObject, getPopupTitleObject, getRowHeaderValue, getRowHeight, getRowHeightMaximum, getRowHeightMinimum, getToolTipText, isDeletable, isKeyEditable, isReassignable, 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

          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

          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

          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,
                                  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,
                                     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:
      - `DnDConstants.ACTION_COPY`
      - `DnDConstants.ACTION_MOVE`
      - `DnDConstants.ACTION_COPY_OR_MOVE`
      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(TimelineObjectPath, IGanttChartModel)`

    - #### isTimelineObjectCreatableAt

          boolean isTimelineObjectCreatableAt(ITimeSpan span,
                                              ILayer layer)

      Determines whether a new timeline object can be created for the given time span. This method comes in handy when trying to control where the user can create new timeline objects. The method could for example be used to forbid the creation of new objects in the past.
      Parameters:
        `span` - the time span where the new timeline object will be created
        `layer` - the layer to which the timeline object will be added
      Returns:
        TRUE if the creation of a new timeline object for the given time span is allowed
      Since:
        1.1
      See Also:
        `IEditTimelineObjectPolicy.isCreatable(Object, IGanttChartModel, ILayer, ITimeSpan)`, `DefaultCreateTimelineObjectCommand`

    - #### getSpreadsheetValue

          Object getSpreadsheetValue(ISpreadsheet spreadsheet,
                                     ITimeSpan span)

      Returns a value for the given time span.
      Parameters:
        `spreadsheet` - the spreadsheet from where to lookup the value
        `span` - the time span for which to return a value
      Returns:
        a value for the given sheet and time span
      Since:
        2.1
      See Also:
        `setSpreadsheetValue(ISpreadsheet, Object, ITimeSpan)`

    - #### setSpreadsheetValue

          void setSpreadsheetValue(ISpreadsheet spreadsheet,
                                   Object value,
                                   ITimeSpan span)

      Specifies a new value for the given time span.
      Parameters:
        `spreadsheet` - the spreadsheet where the value gets changed
        `value` - the new spreadsheet cell value
        `span` - the time span for which the new value is valid
      Since:
        2.1
      See Also:
        `getSpreadsheetValue(ISpreadsheet, ITimeSpan)`

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