1 package org.lcsim.plugin.browser.sort; 2 3 import javax.swing.table.TableModel; 4 5 /** 6 * An interface to be implemented by table models which are sortable. 7 * @see org.freehep.swing.table.TableSorter 8 * @author Tony Johnson 9 * @version $Id: SortableTableModel.java,v 1.1 2007/06/01 23:58:58 tonyj Exp $ 10 */ 11 public interface SortableTableModel extends TableModel 12 { 13 public final static int UNSORTED = -1; 14 15 /** 16 * Sort the table model using the given column. Once this method 17 * has been called the table model should reorder its rows so that 18 * they are sorted using the given column. The table model should 19 * generate appropriate change events to reflect any changes made 20 * to the model as a result of the sort. If the table data is modified 21 * after sort has been called, the table model should continue to sort 22 * the data using the given column. 23 * @param column The index of the column to sort on, or UNSORTED if no sort is necessary. 24 * @param ascending If <CODE>true</CODE> sort in ascending order, else sort in descending order. 25 */ 26 void sort(int column, boolean ascending); 27 public boolean isSortAscending(); 28 /** 29 * Returns the sort column, or <code>UNSORTED</code> if no sort currently in effect. 30 */ 31 public int getSortOnColumn(); 32 }