Package uk.ac.starlink.topcat
Class ColumnList
- java.lang.Object
-
- uk.ac.starlink.topcat.ColumnList
-
- All Implemented Interfaces:
java.util.EventListener
,javax.swing.event.TableColumnModelListener
public class ColumnList extends java.lang.Object implements javax.swing.event.TableColumnModelListener
List reflecting theTableColumn
objects in aTableColumnModel
. 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
Constructors Constructor Description ColumnList(javax.swing.table.TableColumnModel columnModel)
Constructs a new ColumnList, which will track a given column model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
columnAdded(javax.swing.event.TableColumnModelEvent evt)
void
columnMarginChanged(javax.swing.event.ChangeEvent evt)
void
columnMoved(javax.swing.event.TableColumnModelEvent evt)
void
columnRemoved(javax.swing.event.TableColumnModelEvent evt)
void
columnSelectionChanged(javax.swing.event.ListSelectionEvent evt)
javax.swing.table.TableColumn
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(javax.swing.table.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.
-
-
-
Method Detail
-
getColumn
public javax.swing.table.TableColumn getColumn(int jcol)
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
public int indexOf(javax.swing.table.TableColumn tcol)
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
public void columnAdded(javax.swing.event.TableColumnModelEvent evt)
- Specified by:
columnAdded
in interfacejavax.swing.event.TableColumnModelListener
-
columnMoved
public void columnMoved(javax.swing.event.TableColumnModelEvent evt)
- Specified by:
columnMoved
in interfacejavax.swing.event.TableColumnModelListener
-
columnRemoved
public void columnRemoved(javax.swing.event.TableColumnModelEvent evt)
- Specified by:
columnRemoved
in interfacejavax.swing.event.TableColumnModelListener
-
columnMarginChanged
public void columnMarginChanged(javax.swing.event.ChangeEvent evt)
- Specified by:
columnMarginChanged
in interfacejavax.swing.event.TableColumnModelListener
-
columnSelectionChanged
public void columnSelectionChanged(javax.swing.event.ListSelectionEvent evt)
- Specified by:
columnSelectionChanged
in interfacejavax.swing.event.TableColumnModelListener
-
-