Bean Builder

com.adventnet.beans.table
Class SortTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--javax.swing.table.DefaultTableModel
              |
              +--com.adventnet.beans.table.SortTableModel

public class SortTableModel
extends javax.swing.table.DefaultTableModel
implements SortInterface

This class extends DefaultTableModel and SortInterface This model can be populated with data which needs to sorted

Version:
1.0
Author:
See Also:
DefaultTableModel, SortInterface, Serialized Form

Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
SortTableModel()
          Constructs a default TableModel which is a table of zero columns and zero rows.
SortTableModel(int numRows, int numColumns)
          Constructs a DefaultTableModel with numRows and numColumns of null object values.
SortTableModel(java.lang.Object[][] columnNames, int numRows)
          Constructs a DefaultTableModel with as many columns as there are elements in columnNames and numRows of null object values.
SortTableModel(java.lang.Object[][] data, java.lang.Object[][] columnNames)
          Constructs a DefaultTableModel and initializes the table by passing data and columnNames to the setDataVector() method.
SortTableModel(java.util.Vector columnNames, int numRows)
          Constructs a DefaultTableModel with as many columns as there are elements in columnNames and numRows of null object values.
SortTableModel(java.util.Vector data, java.util.Vector columnNames)
          Constructs a DefaultTableModel and initializes the table by passing data and columnNames to the setDataVector() method.
 
Method Summary
 boolean compare(java.lang.Object first, java.lang.Object second)
           
 java.lang.Object elementAt(int index)
          Returns the object at index.
 boolean lt(java.lang.Object first, java.lang.Object second)
          Returns true if first < second.
 void sort(int sortColumn, boolean ascending)
          Sort the column in ascending or descending order
 void swap(int i, int j)
          Exchanges the data at indeces i and j.
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, isCellEditable, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortTableModel

public SortTableModel()
Constructs a default TableModel which is a table of zero columns and zero rows.

SortTableModel

public SortTableModel(int numRows,
                      int numColumns)
Constructs a DefaultTableModel with numRows and numColumns of null object values.
Parameters:
numRows - :
numColumns - :

SortTableModel

public SortTableModel(java.lang.Object[][] data,
                      java.lang.Object[][] columnNames)
Constructs a DefaultTableModel and initializes the table by passing data and columnNames to the setDataVector() method.
Parameters:
data - :

SortTableModel

public SortTableModel(java.lang.Object[][] columnNames,
                      int numRows)
Constructs a DefaultTableModel with as many columns as there are elements in columnNames and numRows of null object values.
Parameters:
columnNames - :
numRows - :

SortTableModel

public SortTableModel(java.util.Vector columnNames,
                      int numRows)
Constructs a DefaultTableModel with as many columns as there are elements in columnNames and numRows of null object values.
Parameters:
columnNames - :
numRows - :

SortTableModel

public SortTableModel(java.util.Vector data,
                      java.util.Vector columnNames)
Constructs a DefaultTableModel and initializes the table by passing data and columnNames to the setDataVector() method.
Parameters:
data - :
columnNames - :
Method Detail

sort

public void sort(int sortColumn,
                 boolean ascending)
Sort the column in ascending or descending order
Specified by:
sort in interface SortInterface
Parameters:
sortColumn - :
ascending - :

elementAt

public final java.lang.Object elementAt(int index)
Description copied from interface: SortInterface
Returns the object at index.
Specified by:
elementAt in interface SortInterface
Parameters:
index - :
Returns:
'Object'

swap

public void swap(int i,
                 int j)
Description copied from interface: SortInterface
Exchanges the data at indeces i and j.
Specified by:
swap in interface SortInterface
Parameters:
i - :
j - :

lt

public boolean lt(java.lang.Object first,
                  java.lang.Object second)
Description copied from interface: SortInterface
Returns true if first < second.
Specified by:
lt in interface SortInterface
Parameters:
first - :
second - :
Returns:
'boolean'

compare

public boolean compare(java.lang.Object first,
                       java.lang.Object second)
Parameters:
first - :
second - :
Returns:
'boolean'

Bean Builder

© 2001 - 2002 AdventNet Inc. Visit us at: http://www.adventnet.com