org.nuiton.web.gwt.table
Class SortableTableModel

java.lang.Object
  extended by org.nuiton.web.gwt.table.AbstractGWTTableModel
      extended by org.nuiton.web.gwt.table.SortableTableModel
All Implemented Interfaces:
Serializable, EventListener, GWTTableModel, TableModelListener

public class SortableTableModel
extends AbstractGWTTableModel
implements Serializable, TableModelListener

This class is used to provide sorting functionnalities when clicking on table columns. It is based on an underlying model that contains data.

Since:
1.1
Author:
jcouteau
See Also:
Serialized Form

Field Summary
static int ASC
           
static int DSC
           
protected  GWTTableModel model
           
static int NO_SORTING
           
protected  int[] rowsOrder
           
protected  int sortedColumn
          The sorted column, -1 means no sorting
protected  int sortingOrder
          The sorting order, -1 means no sorting
 
Fields inherited from class org.nuiton.web.gwt.table.AbstractGWTTableModel
listenerList
 
Constructor Summary
SortableTableModel(GWTTableModel model)
           
 
Method Summary
 int getColumnCount()
           
 int getRowCount()
           
 int getSortedColumn()
           
 int getSortingOrder()
           
 Object getValueAt(int col, int row)
           
protected  void initRowsOrder()
           
protected  boolean isSortable(int column)
           
 void setSortedColumn(int column)
           
 void setSortedColumn(int column, int order)
           
 void setSortingOrder(int order)
           
 void tableChanged(TableModelEvent e)
           
 
Methods inherited from class org.nuiton.web.gwt.table.AbstractGWTTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected GWTTableModel model

sortedColumn

protected int sortedColumn
The sorted column, -1 means no sorting


sortingOrder

protected int sortingOrder
The sorting order, -1 means no sorting


NO_SORTING

public static final int NO_SORTING
See Also:
Constant Field Values

ASC

public static final int ASC
See Also:
Constant Field Values

DSC

public static final int DSC
See Also:
Constant Field Values

rowsOrder

protected int[] rowsOrder
Constructor Detail

SortableTableModel

public SortableTableModel(GWTTableModel model)
Method Detail

tableChanged

public void tableChanged(TableModelEvent e)
Specified by:
tableChanged in interface TableModelListener

getRowCount

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

getColumnCount

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

getValueAt

public Object getValueAt(int col,
                         int row)
Specified by:
getValueAt in interface GWTTableModel

setSortedColumn

public void setSortedColumn(int column)

setSortedColumn

public void setSortedColumn(int column,
                            int order)

getSortedColumn

public int getSortedColumn()

setSortingOrder

public void setSortingOrder(int order)

getSortingOrder

public int getSortingOrder()

isSortable

protected boolean isSortable(int column)

initRowsOrder

protected void initRowsOrder()


Copyright © 2010-2011 CodeLutin. All Rights Reserved.