Column Model (IColumnModel)
Each Gantt chart has a reference to a column model, which provides the information that is needed to create the columns of a tree table shown on the left-hand side of the chart. Only one column model is used per Gantt chart, independent of the number of tree tables in the Gantt chart (the dual Gantt chart has two). This means that all tree tables within the same Gantt chart show the same columns.
The column model distinguishes between two different types of columns: key columns and value columns. Each model contains exactly one key column and any number of value columns. The key column represents the column that will show the object hierarchy as a tree. The value columns display the values set on the hierarchy nodes.
Any column that is a member of the model will be visible. Neither the model nor the columns use some kind of visibility flag to control whether a column is visible or not. A column needs to be removed from the model in order to become invisible. It can then be added to the list of available (but currently invisible) columns. This list is maintained by the Gantt chart.
List<TreeTableColumn) AbstractGanttChart.getAvailableColumns();
void AbstractGanttChart.addAvailableColumn(TreeTableColumn column);
void AbstractGanttChart.removeAvailableColumn(TreeTableColumn column);
A column model can be observed by attaching a column model listener to it.
IColumnModel.addColumnModelListener(IColumnModelListener l);
The listener will be informed whenever the column model changes. Possible changes are:
- a column gets added to the model
- a column gets removed from the model
- a column gets inserted into the model
- a column was moved from one location to another location within the same model
TreeTableColumn.addPropertyChangeListener(PropertyChangeListener l);
The listener will be informed when the following properties change:
- the column class (the object type of the values shown in the column)
- the header value
- the width of the column
- the maximum width of the column
- the minimum width of the column
- the model index that is used to lookup values from the tree table model
- the sortable flag
Due to the flexibile position of the key column it is not an easy task anymore to iterate of the model's columns in the order in which they need to be displayed. To make it easy again a special iterator has been implemented called ColumnModelIterator. This iterator takes two parameters. A column model and the key column position. Once created the standard iterator methodsint AbstractGanttChart.getKeyColumnPosition()
hasNext() and next() can be used.
