com.dlsc.flexgantt.model.treetable

## Class ColumnModelIterator

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

- All Implemented Interfaces:
    Iterator<TreeTableColumn>

      public class ColumnModelIterator
      extends Object
      implements Iterator<TreeTableColumn>

  A specialized iterator implementation for iterating over the columns of a column model. The iterator takes a so-called key column position into consideration. If the key column position is 0 then the iterator will return the columns in this order: [key, col0, col1, col2] and so on. If the key column position is 1 then the column order will be [col0, key, col1, col2]. The iterator will return the key column last if the key column position is larger than the total number of columns.
  Since:
    1.0
  Version:
    $Revision: 1.10 $
  Author:
    Dirk Lemmermann
  See Also:
    `AbstractGanttChart.setKeyColumnPosition(int)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ColumnModelIterator(IColumnModel model, int keyColumnPosition)` Constructs a new column model iterator for the given column model and key column position.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `hasNext()` Returns TRUE if the iterator is capable of returning one more table column.
    `TreeTableColumn` | `next()` Returns the next tree table column.
    `void` | `remove()` This method is not supported by this class.

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

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

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining`

- - ### Constructor Detail

    - #### ColumnModelIterator

          public ColumnModelIterator(IColumnModel model,
                                     int keyColumnPosition)

      Constructs a new column model iterator for the given column model and key column position. The key column position is usually provided by the view.
      Parameters:
        `model` - is the column model that provides the key colum and the other column definitions
        `keyColumnPosition` - is the position of the key column in the view. This position can be larger than the actual number of columns in the model. In this case the key column will be returned after the last column has been returned.
      Since:
        1.0
      See Also:
        `AbstractGanttChart.getKeyColumnPosition()`

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

      Returns TRUE if the iterator is capable of returning one more table column. The iterator can return a total of 'number of columns' plus 1 (key column).
      Specified by:
        `hasNext` in interface `Iterator<TreeTableColumn>`
      Returns:
        TRUE if another column can be returned
      Since:
        1.0

    - #### next

          public TreeTableColumn next()
                               throws NoSuchElementException

      Returns the next tree table column.
      Specified by:
        `next` in interface `Iterator<TreeTableColumn>`
      Throws:
        `NoSuchElementException` - if the iterator has already returned the last column
      Since:
        1.0

    - #### remove

          public void remove()

      This method is not supported by this class. Columns can not be removed from a column model via an iterator. Instead use the appropriate methods on the column model.
      Specified by:
        `remove` in interface `Iterator<TreeTableColumn>`
      Since:
        1.0
      See Also:
        `DefaultColumnModel.removeColumn(TreeTableColumn)`

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