public class DefaultColumnModel extends Object implements IColumnModel
IColumnModelListener
Modifier and Type | Field and Description |
---|---|
protected KeyColumn |
keyColumn
The key column is a specialization of the regular tree table column.
|
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.
|
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.
|
protected KeyColumn keyColumn
ITreeTableModel.getKey(Object)
,
ITreeTableNode.getKey()
public DefaultColumnModel()
public DefaultColumnModel(TreeTableColumn[] cols)
cols
- a list of tree table columnspublic DefaultColumnModel(String[] cols)
cols
- a list of tree table column namespublic DefaultColumnModel(Collection<TreeTableColumn> cols)
cols
- a list of tree table columnspublic void setKeyColumn(KeyColumn column)
IColumnModel
setKeyColumn
in interface IColumnModel
column
- the key columnpublic KeyColumn getKeyColumn()
IColumnModel
getKeyColumn
in interface IColumnModel
public void addColumn(TreeTableColumn col)
addColumn
in interface IColumnModel
col
- the column to addpublic void insertColumn(TreeTableColumn col, int index)
col
- the column to insertindex
- the position where to insert the new columnpublic void moveColumn(int indexFrom, int indexTo)
moveColumn
in interface IColumnModel
indexFrom
- the previous location of the columnindexTo
- the new location of the columnpublic void removeColumn(TreeTableColumn col)
removeColumn
in interface IColumnModel
col
- the column to removepublic void setColumns(Collection<TreeTableColumn> cols)
cols
- the new table columnssetColumns(TreeTableColumn[])
public void setColumns(TreeTableColumn[] cols)
cols
- the new table columnssetColumns(Collection)
public int getColumnCount()
IColumnModel
getColumnCount
in interface IColumnModel
public TreeTableColumn getColumn(int index)
IColumnModel
getColumn
in interface IColumnModel
index
- the index for which to return the columnpublic int getColumnIndex(TreeTableColumn column)
IColumnModel
getColumnIndex
in interface IColumnModel
column
- the column for which to return the indexpublic void addColumnModelListener(IColumnModelListener l)
IColumnModel
addColumnModelListener
in interface IColumnModel
l
- the new listenerpublic void removeColumnModelListener(IColumnModelListener l)
IColumnModel
removeColumnModelListener
in interface IColumnModel
l
- the listener to removeprotected void fireColumnChanged(ColumnModelEvent evt)
evt
- the event to forwardpublic int getTotalColumnWidth()
IColumnModel
getTotalColumnWidth
in interface IColumnModel
Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.