Package uk.ac.starlink.topcat

# Class MetaColumnTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
uk.ac.starlink.topcat.MetaColumnTableModel

All Implemented Interfaces:
  `Serializable`, `TableModel`

public abstract class MetaColumnTableModel extends AbstractTableModel
Makes a TableModel out of a list of MetaColumn objects.

See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class javax.swing.table.AbstractTableModel

`listenerList`

## Constructor Summary

Constructors
Constructor
Description
`MetaColumnTableModel(List<MetaColumn> metaList)`
Constructs a new MetaColumnTableModel.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canSort(MetaColumn sortCol)`
Indicates whether the supplied column has a defined sort order.
`Class<?>`
`getColumnClass(int icol)`
`int`
`getColumnCount()`
`List<MetaColumn>`
`getColumnList()`
Returns the list of columns which provide the data for this model.
`String`
`getColumnName(int icol)`
`int`
`getListIndex(int irow)`
Returns the index in the natural row sequence for a row index in the table model.
`abstract int`
`getRowCount()`
`Object`
`getValueAt(int irow, int icol)`
`boolean`
`isCellEditable(int irow, int icol)`
`void`
`setValueAt(Object value, int irow, int icol)`
`boolean`
`sortRows(MetaColumn sortCol, boolean isDescending)`
Reorders the rows of this table model based on the contents of one of its columns.

### Methods inherited from class javax.swing.table.AbstractTableModel

`addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MetaColumnTableModel

public MetaColumnTableModel(List<MetaColumn> metaList)
Constructs a new MetaColumnTableModel.

Parameters:
  `metaList` - a list of `MetaColumn` objects

## Method Details

### getColumnCount

public int getColumnCount()

### getRowCount

public abstract int getRowCount()

### getValueAt

public Object getValueAt(int irow, int icol)

### setValueAt

public void setValueAt(Object value, int irow, int icol)

Specified by:
  `setValueAt` in interface `TableModel`
Overrides:
  `setValueAt` in class `AbstractTableModel`

### getColumnClass

public Class<?> getColumnClass(int icol)

Specified by:
  `getColumnClass` in interface `TableModel`
Overrides:
  `getColumnClass` in class `AbstractTableModel`

### getColumnName

public String getColumnName(int icol)

Specified by:
  `getColumnName` in interface `TableModel`
Overrides:
  `getColumnName` in class `AbstractTableModel`

### isCellEditable

public boolean isCellEditable(int irow, int icol)

Specified by:
  `isCellEditable` in interface `TableModel`
Overrides:
  `isCellEditable` in class `AbstractTableModel`

### getColumnList

public List<MetaColumn> getColumnList()
Returns the list of columns which provide the data for this model. The list may be altered (but fire appropriate events if you do it on a live instance).

Returns:
  column list

### canSort

public boolean canSort(MetaColumn sortCol)
Indicates whether the supplied column has a defined sort order.

Parameters:
  `sortCol` - column, not null
Returns:
  true iff sortCol can be sorted on

### sortRows

public boolean sortRows(MetaColumn sortCol, boolean isDescending)
Reorders the rows of this table model based on the contents of one of its columns. This method does not inform listeners that the table data may have changed, so calling code should do that where appropriate. It only needs to do so if the return value of this method is true.

Parameters:
  `sortCol` - column to sort on, or null for natural ordering
  `isDescending` - false to sort up, true to sort down
Returns:
  true if changes may have been made to the rows, false if no changes were made

### getListIndex

public int getListIndex(int irow)
Returns the index in the natural row sequence for a row index in the table model.

Parameters:
  `irow` - table row index
Returns:
  list row index