net.mlw.vlh.swing.support
Class TableSorter

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bynet.mlw.vlh.swing.support.TableSorter
All Implemented Interfaces:
ActionListener, EventListener, Serializable, TableModel, ValueListTableModel

public class TableSorter
extends AbstractTableModel
implements ValueListTableModel, ActionListener

See Also:
Serialized Form

Nested Class Summary
static class TableSorter.Directive
           
 
Field Summary
static int ASCENDING
           
static Comparator COMPARABLE_COMAPRATOR
           
static int DESCENDING
           
static Comparator LEXICAL_COMPARATOR
           
static int NOT_SORTED
           
protected  TableModel tableModel
           
protected  ValueListTableModel valueListTableModel
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableSorter()
           
TableSorter(TableModel tableModel)
           
TableSorter(TableModel tableModel, JTableHeader tableHeader)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void addActionListener(ActionListener actionListener)
           
 int addBean(Object bean)
           
 boolean contains(Object bean)
           
 Object getBean(int row)
           
 Class getColumnClass(int column)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
protected  Comparator getComparator(int column)
           
protected  Icon getHeaderRendererIcon(int column, int size)
           
 int getRowCount()
           
 List getSortingColumns()
           
 int getSortingStatus(int column)
           
 String getSortPropertyName(int column)
           
 JTableHeader getTableHeader()
           
 TableModel getTableModel()
           
 Object getValueAt(int row, int column)
           
 boolean isCellEditable(int row, int column)
           
 boolean isSorting()
           
 int modelIndex(int viewIndex)
           
 int removeBean(Object bean)
           
 void setColumnComparator(Class type, Comparator comparator)
           
 void setSortingStatus(int column, int status, boolean fireChange)
           
 void setTableHeader(JTableHeader tableHeader)
           
 void setTableModel(TableModel tableModel)
           
 void setValueAt(Object aValue, int row, int column)
           
 void setValueList(ValueList valueList)
           
 int trimFromList(int maxSize)
           
 int viewIndex(int modelIndex)
           
 
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
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
 

Field Detail

valueListTableModel

protected ValueListTableModel valueListTableModel

tableModel

protected TableModel tableModel

DESCENDING

public static final int DESCENDING
See Also:
Constant Field Values

NOT_SORTED

public static final int NOT_SORTED
See Also:
Constant Field Values

ASCENDING

public static final int ASCENDING
See Also:
Constant Field Values

COMPARABLE_COMAPRATOR

public static final Comparator COMPARABLE_COMAPRATOR

LEXICAL_COMPARATOR

public static final Comparator LEXICAL_COMPARATOR
Constructor Detail

TableSorter

public TableSorter()

TableSorter

public TableSorter(TableModel tableModel)

TableSorter

public TableSorter(TableModel tableModel,
                   JTableHeader tableHeader)
Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

addActionListener

public void addActionListener(ActionListener actionListener)

getTableModel

public TableModel getTableModel()

setTableModel

public void setTableModel(TableModel tableModel)

getTableHeader

public JTableHeader getTableHeader()

setTableHeader

public void setTableHeader(JTableHeader tableHeader)

isSorting

public boolean isSorting()

getSortingStatus

public int getSortingStatus(int column)

getSortPropertyName

public String getSortPropertyName(int column)
Specified by:
getSortPropertyName in interface ValueListTableModel

setSortingStatus

public void setSortingStatus(int column,
                             int status,
                             boolean fireChange)

getHeaderRendererIcon

protected Icon getHeaderRendererIcon(int column,
                                     int size)

setColumnComparator

public void setColumnComparator(Class type,
                                Comparator comparator)

getComparator

protected Comparator getComparator(int column)

modelIndex

public int modelIndex(int viewIndex)

viewIndex

public int viewIndex(int modelIndex)

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel

getColumnClass

public Class getColumnClass(int column)
Specified by:
getColumnClass in interface TableModel

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface TableModel

getValueAt

public Object getValueAt(int row,
                         int column)
Specified by:
getValueAt in interface TableModel

setValueAt

public void setValueAt(Object aValue,
                       int row,
                       int column)
Specified by:
setValueAt in interface TableModel

getSortingColumns

public List getSortingColumns()
Returns:
Returns the sortingColumns.

trimFromList

public int trimFromList(int maxSize)
Specified by:
trimFromList in interface ValueListTableModel
See Also:
net.mlw.vlh.swing.ValueListTableModel#trimFromBottomOfList()

addBean

public int addBean(Object bean)
Specified by:
addBean in interface ValueListTableModel

removeBean

public int removeBean(Object bean)
Specified by:
removeBean in interface ValueListTableModel

getBean

public Object getBean(int row)
Specified by:
getBean in interface ValueListTableModel

setValueList

public void setValueList(ValueList valueList)
Specified by:
setValueList in interface ValueListTableModel

contains

public boolean contains(Object bean)
Specified by:
contains in interface ValueListTableModel


Copyright © 2003-2006 mlavilson. All Rights Reserved.