Class ColumnList

java.lang.Object
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 Details

    • ColumnList

      public ColumnList(TableColumnModel columnModel)
      Constructs a new ColumnList, which will track a given column model.
      Parameters:
      columnModel - table column model to track
  • Method Details

    • 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