uk.ac.starlink.topcat
Class ColumnList

java.lang.Object
  extended by uk.ac.starlink.topcat.ColumnList
All Implemented Interfaces:
EventListener, TableColumnModelListener

public class ColumnList
extends Object
implements 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
ColumnList(TableColumnModel columnModel)
          Constructs a new ColumnList, which will track a given column model.
 
Method Summary
 void columnAdded(TableColumnModelEvent evt)
           
 void columnMarginChanged(ChangeEvent evt)
           
 void columnMoved(TableColumnModelEvent evt)
           
 void columnRemoved(TableColumnModelEvent evt)
           
 void columnSelectionChanged(ListSelectionEvent evt)
           
 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(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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnList

public ColumnList(TableColumnModel columnModel)
Constructs a new ColumnList, which will track a given column model.

Parameters:
columnModel - table column model to track
Method Detail

getColumn

public 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 column
actv - 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(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(TableColumnModelEvent evt)
Specified by:
columnAdded in interface TableColumnModelListener

columnMoved

public void columnMoved(TableColumnModelEvent evt)
Specified by:
columnMoved in interface TableColumnModelListener

columnRemoved

public void columnRemoved(TableColumnModelEvent evt)
Specified by:
columnRemoved in interface TableColumnModelListener

columnMarginChanged

public void columnMarginChanged(ChangeEvent evt)
Specified by:
columnMarginChanged in interface TableColumnModelListener

columnSelectionChanged

public void columnSelectionChanged(ListSelectionEvent evt)
Specified by:
columnSelectionChanged in interface TableColumnModelListener


Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.