com.dlsc.flexgantt.model.treetable

## Interface ITreeTableModel<T>

- Type Parameters:
    `T` - the type of the node objects
  All Superinterfaces:
    TreeModel
  All Known Subinterfaces:
    IGanttChartModel<T,S>
  All Known Implementing Classes:
    DefaultGanttChartModel, DefaultTreeTableModel

      public interface ITreeTableModel<T>
      extends TreeModel

  A tree table extends a tree by adding the capability to display table columns as well. This interface extends the Swing tree model with those additional methods that allow the tree table to populate these columns with data. The tree table model distinguishes between a key column and regular columns. The values for the key column are returned via the `getKey(Object)` method while standard values are returned by `getColumnValue(Object, int)`.
  Since:
    1.0
  Author:
    Dirk Lemmermann
  See Also:
    `ITreeTableNode`, `DefaultMutableTreeTableNode`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTreeTableModelListener(ITreeTableModelListener l)` Adds a listener to the model, which will be informed when key or column values get changes.
    `Object` | `getColumnValue(T node, int columnModelIndex)` Returns an object for the given node that will be displayed in a tree table column where the column's model index matches the given index.
    `Object` | `getKey(T node)` Returns an object for the given node that will be displayed in the tree table's key column.
    `Object` | `getRowHeaderValue(T node)` Returns an object that will be visualized in the row header section of the Gantt chart.
    `void` | `removeTreeTableModelListener(ITreeTableModelListener l)` Removes a listener from the model.
    `void` | `setColumnValue(T node, Object value, int columnModelIndex)` Sets a new column value for the given node and model index.
    `void` | `setKey(T node, Object key)` Sets a new object to be used as the key object for the given tree table node.
    `void` | `sort(T node, int[] modelIndices, boolean[] sortDirections)` Invokes multi-column sorting on the tree table model.

    - ### Methods inherited from interface javax.swing.tree.TreeModel

      `addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged`

- - ### Method Detail

    - #### getKey

          Object getKey(T node)

      Returns an object for the given node that will be displayed in the tree table's key column.
      Parameters:
        `node` - the tree table's node for which to return a key object
      Returns:
        the key column object
      Since:
        1.0
      See Also:
        `setKey(Object, Object)`

    - #### setKey

          void setKey(T node,
                      Object key)

      Sets a new object to be used as the key object for the given tree table node.
      Parameters:
        `node` - the node for which to specify a new key object
        `key` - the node's new key object
      Since:
        1.0
      See Also:
        `getKey(Object)`

    - #### getColumnValue

          Object getColumnValue(T node,
                                int columnModelIndex)

      Returns an object for the given node that will be displayed in a tree table column where the column's model index matches the given index.

      It is very important to note the difference between the model index and a columns index within a given column model. The model index usually never changes and is used to lookup the correct piece of information from some kind of data model. The other index is simply the columns current position within the model. This index can change if the user or the application rearranges the columns.
      Parameters:
        `node` - the node for which to return a column value object
        `columnModelIndex` - the column's model index
      Returns:
        a value for the given node and model index
      Since:
        1.0
      See Also:
        `setColumnValue(Object, Object, int)`

    - #### setColumnValue

          void setColumnValue(T node,
                              Object value,
                              int columnModelIndex)

      Sets a new column value for the given node and model index.

      It is very important to note the difference between the model index and a columns index within a given column model. The model index usually never changes and is used to lookup the correct piece of information from some kind of data model. The other index is simply the columns current position within the model. This index can change if the user or the application rearranges the columns.

      Parameters:
        `node` - the node that will receive a new column value
        `value` - the new column value
        `columnModelIndex` - the model index that will get changed
      Since:
        1.0
      See Also:
        `getColumnValue(Object, int)`, `INodeEditPolicy.isValueEditable(Object, ITreeTableModel, int)`, `INodeEditPolicy.getChangeValueCommand(Object, ITreeTableModel, Object, int)`

    - #### getRowHeaderValue

          Object getRowHeaderValue(T node)

      Returns an object that will be visualized in the row header section of the Gantt chart. This method is not allowed to return NULL. The default Gantt chart model implementation returns the node itself if no extra row header value is specified.
      Parameters:
        `node` - the node for which to return a header value
      Returns:
        an object that will be visualized in the row header
      Since:
        1.0

    - #### sort

          void sort(T node,
                    int[] modelIndices,
                    boolean[] sortDirections)

      Invokes multi-column sorting on the tree table model. Each column can be sorted in ascending or descending order. The lengths of the two parameters arrays need to be equal.
      Parameters:
        `node` - the node that is the target of the sort, the node's children will be sorted (if the node is the root then the entire table will be sorted)
        `modelIndices` - the model indices that are used to determine which column values to compare for sorting (use `KeyColumn.MODEL_INDEX` to specify a sort based on the key column
        `sortDirections` - if TRUE the sort direction will be ascending
      Since:
        1.0

    - #### addTreeTableModelListener

          void addTreeTableModelListener(ITreeTableModelListener l)

      Adds a listener to the model, which will be informed when key or column values get changes.
      Parameters:
        `l` - the listener to add
      Since:
        1.0
      See Also:
        `removeTreeTableModelListener(ITreeTableModelListener)`

    - #### removeTreeTableModelListener

          void removeTreeTableModelListener(ITreeTableModelListener l)

      Removes a listener from the model.
      Parameters:
        `l` - the listener to remove
      Since:
        1.0
      See Also:
        `addTreeTableModelListener(ITreeTableModelListener)`

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