Package uk.ac.starlink.util.gui

# Class ArrayTableSorter<R>

java.lang.Object
uk.ac.starlink.util.gui.ArrayTableSorter<R>

public class ArrayTableSorter<R> extends Object
Handles GUI aspects of allowing the user to sort columns in a table by clicking on the column header. After construction you have to install it on a suitable table header. The table must be represented by a `ArrayTableModel`.

Since:
  14 Oct 2009
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`ArrayTableSorter(ArrayTableModel<R> model)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`install(JTableHeader header)`
Sets this object up to allow sorting its model by clicking on a given JTable header.
`void`
`setSorting(int icol, boolean descending)`
Performs a sort on a given column.
`void`
`uninstall(JTableHeader header)`
Reverses the action of a previous `install(javax.swing.table.JTableHeader)` action.

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

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

## Constructor Details

### ArrayTableSorter

public ArrayTableSorter(ArrayTableModel<R> model)
Constructor.

Parameters:
  `model` - table model

## Method Details

### install

public void install(JTableHeader header)
Sets this object up to allow sorting its model by clicking on a given JTable header.

Parameters:
  `header` - table header component

### uninstall

public void uninstall(JTableHeader header)
Reverses the action of a previous `install(javax.swing.table.JTableHeader)` action.

Parameters:
  `header` - table header component

### setSorting

public void setSorting(int icol, boolean descending)
Performs a sort on a given column. Note, the header should be repainted following a call to this method.

Parameters:
  `icol` - column index
  `descending` - true sort down, false sort up