com.dlsc.flexgantt.model.treetable
Class ColumnModelIterator

java.lang.Object
  extended by com.dlsc.flexgantt.model.treetable.ColumnModelIterator
All Implemented Interfaces:
java.util.Iterator<TreeTableColumn>

public class ColumnModelIterator
extends java.lang.Object
implements java.util.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
Author:
Dirk Lemmermann
See Also:
AbstractGanttChart.setKeyColumnPosition(int)

Constructor Summary
ColumnModelIterator(IColumnModel model, int keyColumnPosition)
          Constructs a new column model iterator for the given column model and key column position.
 
Method Summary
 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
 

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 java.util.Iterator<TreeTableColumn>
Returns:
TRUE if another column can be returned
Since:
1.0

next

public TreeTableColumn next()
                     throws java.util.NoSuchElementException
Returns the next tree table column.

Specified by:
next in interface java.util.Iterator<TreeTableColumn>
Throws:
java.util.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 java.util.Iterator<TreeTableColumn>
Since:
1.0
See Also:
DefaultColumnModel.removeColumn(TreeTableColumn)