|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1.1.0) E10653-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel oracle.jbo.uicli.jui.JUTableSortModel
public class JUTableSortModel
Implements a sorting filter over JUTableBinding's TableModel such that when a user clicks (or Shift_click) on a column header of the Table, the display of rows from the JUTableBinding (and hence BC4J), is sorted by that column.
This class is a customization of TableSorter in Sun's JFC example that can also be found at (JDEVELOPER_HOME)/jdk/demo/jfc/TableExample. For details on how the basic TableSorter works, please see this JFC example.
This class implements the following enhancements over the base Sun's TableSorter:
Field Summary |
---|
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
JUTableSortModel()
Default Constructor just coz, base class has it. |
|
JUTableSortModel(JUTableBinding model)
Constructor that sets up this sorting model on top of the existing Table model. |
Method Summary | |
---|---|
void |
addMouseListenerToHeaderInTable(javax.swing.JTable table)
Override to add an action by which to reset the sorting order to the fetch order If one clicks on the same column again (or the Shift+click if the current sorting order is descending), then the Table resorts to the default row order as returned by BC4J. |
protected void |
checkModel()
If no sorting is to be done or when the base model has different row count, resets the indices map so that sorting is done again. |
protected int |
compareObjectTypes(java.lang.Object obj1,
java.lang.Object obj2)
Converts unknown Object types to String and compares the Strings. |
protected int |
compareRows(int row1,
int row2)
Compares the sort-column values in two rows. |
protected int |
compareRowsByColumn(int row1,
int row2,
int column)
Compares the values in two rows at the given column. |
static javax.swing.table.TableModel |
enableColumnSorting(javax.swing.JTable table,
JUTableBinding tableBinding,
JUTableSortModel sorter)
JClient method to attach column-sorting model over a Table that's bound to a JUTableBinding. |
java.lang.Class |
getColumnClass(int aColumn)
|
int |
getColumnCount()
|
java.lang.String |
getColumnName(int aColumn)
|
int |
getRowCount()
|
JUTableBinding |
getTableBinding()
Returns the TableModel that this class is sorting. |
java.lang.Object |
getValueAt(int aRow,
int aColumn)
|
protected void |
initType()
Initializes the java type that this class is sorting on. |
boolean |
isCellEditable(int aRow,
int aColumn)
|
protected void |
reallocateIndexes()
If sort-column is greater than -1 (when no sorting should be done), sorts the data from the base model for display. |
protected void |
resetIndices()
Initializes the mapping between indices of this model versus the base model. |
protected void |
setTableBinding(JUTableBinding mdl)
Sets the TableModel on top of which this sorter works. |
void |
setValueAt(java.lang.Object aValue,
int aRow,
int aColumn)
|
protected void |
shuttlesort(int[] from,
int[] to,
int low,
int high)
|
void |
sortByColumn(int column,
boolean ascending)
Stores the mSortColIndex if it has changed. |
protected void |
swap(int i,
int j)
Swaps the index map between two given indices. |
void |
tableChanged(javax.swing.event.TableModelEvent e)
|
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 |
---|
public JUTableSortModel()
public JUTableSortModel(JUTableBinding model)
Method Detail |
---|
protected void setTableBinding(JUTableBinding mdl)
protected void checkModel()
protected int compareRows(int row1, int row2)
protected void resetIndices()
protected void reallocateIndexes()
public void tableChanged(javax.swing.event.TableModelEvent e)
tableChanged
in interface javax.swing.event.TableModelListener
protected void initType()
public void sortByColumn(int column, boolean ascending)
protected void shuttlesort(int[] from, int[] to, int low, int high)
protected void swap(int i, int j)
protected final int compareRowsByColumn(int row1, int row2, int column)
protected int compareObjectTypes(java.lang.Object obj1, java.lang.Object obj2)
public void addMouseListenerToHeaderInTable(javax.swing.JTable table)
public JUTableBinding getTableBinding()
public java.lang.Object getValueAt(int aRow, int aColumn)
getValueAt
in interface javax.swing.table.TableModel
public void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int aColumn)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
public java.lang.Class getColumnClass(int aColumn)
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
public boolean isCellEditable(int aRow, int aColumn)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
public static javax.swing.table.TableModel enableColumnSorting(javax.swing.JTable table, JUTableBinding tableBinding, JUTableSortModel sorter)
table
- to be bound to a sortable modeltableBinding
- JClient table binding for the above tablesorter
- the JUTableSortModel instance providing custom sorting capabilities.
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1.1.0) E10653-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |