JComponentPack 1.5.0

com.zfqjava.swing.model
Class DefaultColumnSorter

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.zfqjava.swing.model.DefaultColumnSorter
All Implemented Interfaces:
ColumnSorter, Serializable, TableModel

public class DefaultColumnSorter
extends AbstractTableModel
implements ColumnSorter

DefaultColumnSorter provides a default column sorter.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DefaultColumnSorter(TableModel model)
           
 
Method Summary
 Class getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int columnIndex)
           
 int getRowCount()
           
 List getSortColumnList()
          Returns a list contains all sort columns index.
 Boolean getSortOrderObject(int column)
          Returns the sort order for the specified column.
 TableModel getTableModel()
          Returns the TableModel that be sorted.
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 int modelToSorterRow(int modelRow)
          Converts the model row index to the ColumnSorter row index.
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
           
 void sortColumn(int column, boolean ascending)
          Sorts the specified column.
 void sortColumn(int column, Boolean sortOrder)
          Sorts the specified column by the specified sort order.
 void sortColumn(int column, Boolean sortOrder, boolean extend)
          Sorts the specified column by the specified sort order.
 int sorterToModelRow(int sorterRow)
          Converts the ColumnSorter row index to the model row index.
 
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
 

Constructor Detail

DefaultColumnSorter

public DefaultColumnSorter(TableModel model)
Method Detail

getSortColumnList

public List getSortColumnList()
Returns a list contains all sort columns index.

Returns:
a list contains all sort columns index
Since:
JDataGrid 2.1.3

sortColumn

public void sortColumn(int column,
                       Boolean sortOrder)
Sorts the specified column by the specified sort order.

Parameters:
column - the column to sort
sortOrder - the sort order
Since:
JDataGrid 1.6.0

sortColumn

public void sortColumn(int column,
                       Boolean sortOrder,
                       boolean extend)
Sorts the specified column by the specified sort order.

Parameters:
column - the column to sort
sortOrder - the sort order
extend - true for new sort column, false for single sort column
Since:
JDataGrid 1.6.0

getSortOrderObject

public Boolean getSortOrderObject(int column)
Returns the sort order for the specified column.

Parameters:
column - the column index
Returns:
the sort order
Since:
JDataGrid 1.6.0

getTableModel

public TableModel getTableModel()
Returns the TableModel that be sorted.

Returns:
the TableModel that be sorted

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 columnIndex)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getColumnClass

public Class getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

sorterToModelRow

public int sorterToModelRow(int sorterRow)
Converts the ColumnSorter row index to the model row index.

Parameters:
sorterRow - the sorter row index
Returns:
the model index for the specified ColumnSorter row index

modelToSorterRow

public int modelToSorterRow(int modelRow)
Converts the model row index to the ColumnSorter row index.

Parameters:
modelRow - the mode row index
Returns:
the ColumnSorter row index for the specified model row index

sortColumn

public void sortColumn(int column,
                       boolean ascending)
Description copied from interface: ColumnSorter
Sorts the specified column.

Specified by:
sortColumn in interface ColumnSorter
Parameters:
column - the column to sort
ascending - the sort order

JComponentPack 1.5.0

Send your Feedback
JComponentPack 1.5.0
Copyright © 2001-2007 Extreme Component, Inc. All rights reserved.