com.dlsc.flexgantt.model.treetable

## Class KeyColumn<T>

- java.lang.Object
- - com.dlsc.flexgantt.util.NamedObject
  - - com.dlsc.flexgantt.model.treetable.TreeTableColumn<T>
    - - com.dlsc.flexgantt.model.treetable.KeyColumn<T>

- Type Parameters:
    `T` - the object type of the header value
  All Implemented Interfaces:
    INamedObject, Comparable<INamedObject>

      public class KeyColumn<T>
      extends TreeTableColumn<T>

  The key column is a special type of tree table column and responsible for showing the tree structure given by a tree table model. Usually this column is the first (left-most) column in the table (except if changed via `AbstractGanttChart.setKeyColumnPosition(int)`). The key column always returns `MODEL_INDEX` as its model index.
  Since:
    1.0
  Version:
    $Revision: 1.16 $
  Author:
    Dirk Lemmermann
  See Also:
    `IColumnModel`, `AbstractGanttChart.setKeyColumnPosition(int)`, `ITreeTableModel.getKey(Object)`, `ColumnModelIterator`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `MODEL_INDEX` The model index of the key column is stored in this static class member.

    - ### Fields inherited from class com.dlsc.flexgantt.model.treetable.TreeTableColumn

      `PROPERTY_COLUMN_CLASS, PROPERTY_HEADER_VALUE, PROPERTY_MAX_WIDTH, PROPERTY_MIN_WIDTH, PROPERTY_MODEL_INDEX, PROPERTY_WIDTH`

    - ### Fields inherited from class com.dlsc.flexgantt.util.NamedObject

      `PROPERTY_NAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyColumn(String name, Class columnClass)` Constructs a new key column object with the given name.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getModelIndex()` Overriden and made final in order to ensure that the model index returned by this method is always `MODEL_INDEX` (identifying the column as the key column).
    `void` | `setModelIndex(int newIndex)` Overriden and made final in order to ensure that the model index can not be modified.

    - ### Methods inherited from class com.dlsc.flexgantt.model.treetable.TreeTableColumn

      `getCellRenderer, getColumnClass, getHeaderValue, getMaximumWidth, getMinimumWidth, getSupportedSortDirections, getWidth, isSortable, isSupported, setCellRenderer, setColumnClass, setHeaderValue, setMaximumWidth, setMinimumWidth, setSupportedSortDirections, setWidth, toString`

    - ### Methods inherited from class com.dlsc.flexgantt.util.NamedObject

      `addPropertyChangeListener, compareTo, getChangeSupport, getName, removePropertyChangeListener, setName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### MODEL_INDEX

          public static final int MODEL_INDEX

      The model index of the key column is stored in this static class member. It gets references throughout the framework to check whether a column is used as a key column or as a 'regular' value column.
      Since:
        1.0
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### KeyColumn

          public KeyColumn(String name,
                           Class columnClass)

      Constructs a new key column object with the given name. The column class specifies which kind of objects will be shown in this column. This information is required for the cell editor and renderer lookup.
      Parameters:
        `name` - the name of the column (used for sorting and in menus)
        `columnClass` - the type of objects shown in the column's cells
      Since:
        1.0
      See Also:
        `IColumnHeaderRenderer`, `TreeTable.getCellRenderer(Class)`, `TreeTable.getCellEditor(Class)`

  - ### Method Detail

    - #### setModelIndex

          public final void setModelIndex(int newIndex)

      Overriden and made final in order to ensure that the model index can not be modified. The key column has to return the index `MODEL_INDEX` to identify itself as the key column.
      Overrides:
        `setModelIndex` in class `TreeTableColumn<T>`
      Since:
        1.0
      See Also:
        `TreeTableColumn.setModelIndex(int)`

    - #### getModelIndex

          public final int getModelIndex()

      Overriden and made final in order to ensure that the model index returned by this method is always `MODEL_INDEX` (identifying the column as the key column).
      Overrides:
        `getModelIndex` in class `TreeTableColumn<T>`
      Returns:
        the column's model index that is used to lookup date from a data model
      Since:
        1.0

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