ami.gui
Class AMITableSorter

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--ami.gui.AMITableModel
              |
              +--ami.gui.AMITableSorter
All Implemented Interfaces:
Serializable, TableModel

public class AMITableSorter
extends AMITableModel

This class is an adaptation for AMI of the TableSorter class given by SUN int he swing tutorial It isa decorator used by a JTable to give sorting capabilities Original autor: Philip Milne 1.5 12/17/97

See Also:
Serialized Form

Field Summary
(package private)  boolean ascending
           
(package private)  int compares
           
(package private)  int[] indexes
           
private  AMITableModel model
          Stores a AMITableModel instance, used by the sorting decorator
(package private)  Vector sortingColumns
           
 
Fields inherited from class ami.gui.AMITableModel
ARRAY, atmi, bColumnEditable, columnNames, data, HASHTABLE, RT, VECTOR
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AMITableSorter(AMITableModel model)
           
 
Method Summary
 void addMouseListenerToHeaderInTable(JTable table)
           
 void addRow()
          Add a row
 void addRow(Object o)
          Add a row with a given value
 void checkModel()
           
 int compare(int row1, int row2)
           
 int compareRowsByColumn(int row1, int row2, int column)
           
 Object getValueAt(int aRow, int aColumn)
          put your documentation comment here
 void n2sort()
           
 void reallocateIndexes()
           
 void removeRow(int[] i)
          Remove an interval of rows
 void setValueAt(Object aValue, int aRow, int aColumn)
          put your documentation comment here
 void shuttlesort(int[] from, int[] to, int low, int high)
           
 void sort(Object sender)
           
 void sortByColumn(int column)
           
 void sortByColumn(int column, boolean ascending)
           
 void swap(int i, int j)
           
 void tableChanged(TableModelEvent e)
          notify all listeners
 
Methods inherited from class ami.gui.AMITableModel
cleanRow, getColumnClass, getColumnCount, getColumnName, getImpl, getRowCount, isCellEditable, refreshStatus, setComboColumn
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

indexes

int[] indexes

sortingColumns

Vector sortingColumns

ascending

boolean ascending

compares

int compares

model

private AMITableModel model
Stores a AMITableModel instance, used by the sorting decorator
Constructor Detail

AMITableSorter

public AMITableSorter(AMITableModel model)
Method Detail

compareRowsByColumn

public int compareRowsByColumn(int row1,
                               int row2,
                               int column)

compare

public int compare(int row1,
                   int row2)

reallocateIndexes

public void reallocateIndexes()

tableChanged

public void tableChanged(TableModelEvent e)
Description copied from class: AMITableModel
notify all listeners
Overrides:
tableChanged in class AMITableModel

checkModel

public void checkModel()

sort

public void sort(Object sender)

n2sort

public void n2sort()

shuttlesort

public void shuttlesort(int[] from,
                        int[] to,
                        int low,
                        int high)

swap

public void swap(int i,
                 int j)

removeRow

public void removeRow(int[] i)
Description copied from class: AMITableModel
Remove an interval of rows
Overrides:
removeRow in class AMITableModel

addRow

public void addRow()
Add a row
Overrides:
addRow in class AMITableModel

addRow

public void addRow(Object o)
Add a row with a given value
Overrides:
addRow in class AMITableModel

getValueAt

public Object getValueAt(int aRow,
                         int aColumn)
Description copied from class: AMITableModel
put your documentation comment here
Overrides:
getValueAt in class AMITableModel
Following copied from class: ami.gui.AMITableModel
Parameters:
row -  
col -  
Returns:
 

setValueAt

public void setValueAt(Object aValue,
                       int aRow,
                       int aColumn)
Description copied from class: AMITableModel
put your documentation comment here
Overrides:
setValueAt in class AMITableModel
Following copied from class: ami.gui.AMITableModel
Parameters:
value -  
row -  
col -  

sortByColumn

public void sortByColumn(int column)

sortByColumn

public void sortByColumn(int column,
                         boolean ascending)

addMouseListenerToHeaderInTable

public void addMouseListenerToHeaderInTable(JTable table)