Package uk.ac.starlink.topcat
Class ColumnList
java.lang.Object
uk.ac.starlink.topcat.ColumnList
- All Implemented Interfaces:
EventListener,TableColumnModelListener
List reflecting the
TableColumn objects
in a TableColumnModel.
Unlike a TableColumnModel, this never throws away
any columns, it just maintains an array of flags to indicate which
columns are currently in the model and which are not.
On construction it registers itself as a listener on its ColumnModel
so that it automatically keeps up to date with its state.- Since:
- 27 Feb 2004
- Author:
- Mark Taylor (Starlink)
-
Constructor Summary
ConstructorsConstructorDescriptionColumnList(TableColumnModel columnModel) Constructs a new ColumnList, which will track a given column model. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidvoidgetColumn(int jcol) Returns one of the columns in this list.intgetModelIndex(int jcol) Returns the index in the table column model of a column at a given index in this list.intindexOf(TableColumn tcol) Returns the position in this list at which the given table column can be found.booleanisActive(int jcol) Indicates whether the column at a given index is currently active (present in the table column model).voidsetActive(int jcol, boolean actv) Marks a given column as active.intsize()Returns the number of columns in this list.
-
Constructor Details
-
ColumnList
Constructs a new ColumnList, which will track a given column model.- Parameters:
columnModel- table column model to track
-
-
Method Details
-
getColumn
Returns one of the columns in this list.- Parameters:
jcol- list index of the column- Returns:
- column at list index
jcol
-
isActive
public boolean isActive(int jcol) Indicates whether the column at a given index is currently active (present in the table column model).- Parameters:
jcol- list index of the column- Returns:
- true iff column at
jcolis active
-
setActive
public void setActive(int jcol, boolean actv) Marks a given column as active. This will remove or re-introduce it into the table column model if necessary.- Parameters:
jcol- list index of the columnactv- whether the column atjcolshould be present in the table column model
-
size
public int size()Returns the number of columns in this list.- Returns:
- number of columns
-
indexOf
Returns the position in this list at which the given table column can be found.- Parameters:
tcol- sought column- Returns:
- index of
tcolin this list, or -1 if it's not there
-
getModelIndex
public int getModelIndex(int jcol) Returns the index in the table column model of a column at a given index in this list.- Parameters:
jcol- list index- Returns:
- index into the table column model of column at
jcolint this list, or one bigger than the size of the column model if it's not in it
-
columnAdded
- Specified by:
columnAddedin interfaceTableColumnModelListener
-
columnMoved
- Specified by:
columnMovedin interfaceTableColumnModelListener
-
columnRemoved
- Specified by:
columnRemovedin interfaceTableColumnModelListener
-
columnMarginChanged
- Specified by:
columnMarginChangedin interfaceTableColumnModelListener
-
columnSelectionChanged
- Specified by:
columnSelectionChangedin interfaceTableColumnModelListener
-