com.dlsc.flexgantt.model.treetable

## Class DefaultColumnModel

- java.lang.Object
- - com.dlsc.flexgantt.model.treetable.DefaultColumnModel

- All Implemented Interfaces:
    IColumnModel

      public class DefaultColumnModel
      extends Object
      implements IColumnModel

  The default column model implementation used throughout the Gantt chart framework.
  Since:
    1.0
  Version:
    $Revision: 1.17 $
  Author:
    Dirk Lemmermann
  See Also:
    `IColumnModelListener`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected KeyColumn` | `keyColumn` The key column is a specialization of the regular tree table column.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultColumnModel()` Constructs a new column model, which only has no columns except for the special key column.
    `DefaultColumnModel(Collection<TreeTableColumn> cols)` Constructs a new column model, which consists of a key column and the given list of standard tree table columns.
    `DefaultColumnModel(String[] cols)` Constructs a new column model, which consists of a key column and the given list of standard tree table columns.
    `DefaultColumnModel(TreeTableColumn[] cols)` Constructs a new column model, which consists of a key column and the given list of standard tree table columns.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addColumn(TreeTableColumn col)` Adds a column to the model.
    `void` | `addColumnModelListener(IColumnModelListener l)` Adds a column model listener to the model.
    `protected void` | `fireColumnChanged(ColumnModelEvent evt)` Forwards the given model event to all column model listeners attached to the model.
    `TreeTableColumn` | `getColumn(int index)` Returns the tree table column at the given index.
    `int` | `getColumnCount()` Returns the total number of columns added to the model.
    `int` | `getColumnIndex(TreeTableColumn column)` Returns the index of the given column if it is a member of the model ( Integer.MAX_VALUE otherwise).
    `KeyColumn` | `getKeyColumn()` Returns the special key column.
    `int` | `getTotalColumnWidth()` Returns the total width as calculated by the widths of the individual columns.
    `void` | `insertColumn(TreeTableColumn col, int index)` Inserts a new column at the given index.
    `void` | `moveColumn(int indexFrom, int indexTo)` Moves a column that is already a member of the model from one location to another.
    `void` | `removeColumn(TreeTableColumn col)` Removes the given column from the model.
    `void` | `removeColumnModelListener(IColumnModelListener l)` Removes a column model listener.
    `void` | `setColumns(Collection<TreeTableColumn> cols)` Replaces the current list of tree table columns with the given collection of columns.
    `void` | `setColumns(TreeTableColumn[] cols)` Replaces the current list of tree table columns with the given array of columns.
    `void` | `setKeyColumn(KeyColumn column)` Sets the special key column.

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

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

- - ### Field Detail

    - #### keyColumn

          protected KeyColumn keyColumn

      The key column is a specialization of the regular tree table column. It is the column that will display the key that is being returned by each tree node.
      Since:
        1.0
      See Also:
        `ITreeTableModel.getKey(Object)`, `ITreeTableNode.getKey()`

  - ### Constructor Detail

    - #### DefaultColumnModel

          public DefaultColumnModel()

      Constructs a new column model, which only has no columns except for the special key column.
      Since:
        1.0

    - #### DefaultColumnModel

          public DefaultColumnModel(TreeTableColumn[] cols)

      Constructs a new column model, which consists of a key column and the given list of standard tree table columns.
      Parameters:
        `cols` - a list of tree table columns
      Since:
        1.0

    - #### DefaultColumnModel

          public DefaultColumnModel(String[] cols)

      Constructs a new column model, which consists of a key column and the given list of standard tree table columns.
      Parameters:
        `cols` - a list of tree table column names
      Since:
        1.0

    - #### DefaultColumnModel

          public DefaultColumnModel(Collection<TreeTableColumn> cols)

      Constructs a new column model, which consists of a key column and the given list of standard tree table columns.
      Parameters:
        `cols` - a list of tree table columns
      Since:
        1.0

  - ### Method Detail

    - #### setKeyColumn

          public void setKeyColumn(KeyColumn column)

      Description copied from interface: `IColumnModel`
      Sets the special key column.
      Specified by:
        `setKeyColumn` in interface `IColumnModel`
      Parameters:
        `column` - the key column

    - #### getKeyColumn

          public KeyColumn getKeyColumn()

      Description copied from interface: `IColumnModel`
      Returns the special key column.
      Specified by:
        `getKeyColumn` in interface `IColumnModel`
      Returns:
        the key column

    - #### addColumn

          public void addColumn(TreeTableColumn col)

      Adds a column to the model.
      Specified by:
        `addColumn` in interface `IColumnModel`
      Parameters:
        `col` - the column to add
      Since:
        1.0

    - #### insertColumn

          public void insertColumn(TreeTableColumn col,
                                   int index)

      Inserts a new column at the given index. If the index is larger than the total number of columns then the new column will be added last.
      Parameters:
        `col` - the column to insert
        `index` - the position where to insert the new column
      Since:
        1.0

    - #### moveColumn

          public void moveColumn(int indexFrom,
                                 int indexTo)

      Moves a column that is already a member of the model from one location to another.
      Specified by:
        `moveColumn` in interface `IColumnModel`
      Parameters:
        `indexFrom` - the previous location of the column
        `indexTo` - the new location of the column
      Since:
        1.0

    - #### removeColumn

          public void removeColumn(TreeTableColumn col)

      Removes the given column from the model.
      Specified by:
        `removeColumn` in interface `IColumnModel`
      Parameters:
        `col` - the column to remove
      Since:
        1.0

    - #### setColumns

          public void setColumns(Collection<TreeTableColumn> cols)

      Replaces the current list of tree table columns with the given collection of columns.
      Parameters:
        `cols` - the new table columns
      Since:
        1.0
      See Also:
        `setColumns(TreeTableColumn[])`

    - #### setColumns

          public void setColumns(TreeTableColumn[] cols)

      Replaces the current list of tree table columns with the given array of columns.
      Parameters:
        `cols` - the new table columns
      Since:
        1.0
      See Also:
        `setColumns(Collection)`

    - #### getColumnCount

          public int getColumnCount()

      Description copied from interface: `IColumnModel`
      Returns the total number of columns added to the model. This count does not include the key column.
      Specified by:
        `getColumnCount` in interface `IColumnModel`
      Returns:
        the total number of columns added to the model

    - #### getColumn

          public TreeTableColumn getColumn(int index)

      Description copied from interface: `IColumnModel`
      Returns the tree table column at the given index. Note: this is not the model index of a column.
      Specified by:
        `getColumn` in interface `IColumnModel`
      Parameters:
        `index` - the index for which to return the column
      Returns:
        the tree table column at the given index

    - #### getColumnIndex

          public int getColumnIndex(TreeTableColumn column)

      Description copied from interface: `IColumnModel`
      Returns the index of the given column if it is a member of the model ( Integer.MAX_VALUE otherwise).
      Specified by:
        `getColumnIndex` in interface `IColumnModel`
      Parameters:
        `column` - the column for which to return the index
      Returns:
        the column's index

    - #### addColumnModelListener

          public void addColumnModelListener(IColumnModelListener l)

      Description copied from interface: `IColumnModel`
      Adds a column model listener to the model.
      Specified by:
        `addColumnModelListener` in interface `IColumnModel`
      Parameters:
        `l` - the new listener

    - #### removeColumnModelListener

          public void removeColumnModelListener(IColumnModelListener l)

      Description copied from interface: `IColumnModel`
      Removes a column model listener.
      Specified by:
        `removeColumnModelListener` in interface `IColumnModel`
      Parameters:
        `l` - the listener to remove

    - #### fireColumnChanged

          protected void fireColumnChanged(ColumnModelEvent evt)

      Forwards the given model event to all column model listeners attached to the model.
      Parameters:
        `evt` - the event to forward
      Since:
        1.0

    - #### getTotalColumnWidth

          public int getTotalColumnWidth()

      Description copied from interface: `IColumnModel`
      Returns the total width as calculated by the widths of the individual columns.
      Specified by:
        `getTotalColumnWidth` in interface `IColumnModel`
      Returns:
        the total column width

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