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 TypeMethodDescriptionvoid
void
void
void
void
getColumn
(int jcol) Returns one of the columns in this list.int
getModelIndex
(int jcol) Returns the index in the table column model of a column at a given index in this list.int
indexOf
(TableColumn tcol) Returns the position in this list at which the given table column can be found.boolean
isActive
(int jcol) Indicates whether the column at a given index is currently active (present in the table column model).void
setActive
(int jcol, boolean actv) Marks a given column as active.int
size()
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 jcol is 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 at jcol should 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 tcol in 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 jcol int this list, or one bigger than the size of the column model if it's not in it
-
columnAdded
- Specified by:
columnAdded
in interfaceTableColumnModelListener
-
columnMoved
- Specified by:
columnMoved
in interfaceTableColumnModelListener
-
columnRemoved
- Specified by:
columnRemoved
in interfaceTableColumnModelListener
-
columnMarginChanged
- Specified by:
columnMarginChanged
in interfaceTableColumnModelListener
-
columnSelectionChanged
- Specified by:
columnSelectionChanged
in interfaceTableColumnModelListener
-