|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.table.AbstractTableModel | +--com.klg.jclass.util.swing.DefaultRowSortTableModel
Wrap a table model with a sorted table model
JCRowSortTableModel
,
TableModelListener
,
Serialized FormField Summary | |
protected boolean |
autoSort
|
static int |
FORWARD
Valid value for SortOrder |
protected int[] |
indices
|
protected int[][] |
keyColumnsArray
|
protected boolean |
needsReordering
|
protected boolean |
needsResorting
|
protected int |
order
|
static int |
REVERSE
Valid value for SortOrder |
protected int[] |
reverseIndices
|
protected com.klg.jclass.util.swing.JCRowComparator |
rowComparator
|
protected com.klg.jclass.util.swing.DefaultRowSortTableModel.RowIntComparator |
rowIntComparator
|
protected int |
sortColumn
|
protected TableModel |
tableModel
|
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary | |
DefaultRowSortTableModel(TableModel tableModel)
Constructs a JCRowSortModel that wraps a given instance of
a TableModel and provides a sorted mapping of the
TableModel to the view. |
|
DefaultRowSortTableModel(TableModel tableModel,
com.klg.jclass.util.swing.JCRowComparator comparator)
Constructs a JCRowSortModel that wraps a given instance of a
TableModel and provides a sorted mapping of the
TableModel to the view. |
Method Summary | |
protected void |
doReverseMapping()
Do the reverse mapping so we can get a sorted row from an unsorted row. |
boolean |
getAutoSort()
Returns whether the data is automatically sorted when it changes according the current comparator. |
Class |
getColumnClass(int columnIndex)
Returns the lowest common denominator Class for the
TableModel column. |
int |
getColumnCount()
Returns the number of columns in the TableModel . |
String |
getColumnName(int column)
Returns a TableModel default column name. |
com.klg.jclass.util.swing.JCRowComparator |
getComparator()
Returns the current comparator. |
int[] |
getKeyColumns(int column)
Returns the key columns used to sort the table model when clicking on the specified column. |
TableModel |
getModel()
Returns the table model this model wraps. |
int |
getRowCount()
Returns the number of rows in the TableModel . |
int |
getSortColumn()
Gets the sorting column. |
int |
getSortedRow(int row)
Returns the sorted row index of the specified unsorted row |
int |
getSortOrder()
Gets the sorting order. |
int |
getUnsortedRow(int sortedRow)
Returns the unsorted row index of specified sorted row. |
Object |
getValueAt(int rowIndex,
int columnIndex)
Gets a value for the record in the TableModel cell at
columnIndex and rowIndex . |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the TableModel cell at rowIndex
and columnIndex is editable. |
boolean |
isDataSorted()
Returns whether or not the data set is currently sorted. |
void |
setAutoSort(boolean autoSort)
Sets whether the data should be automatically sorted when it changes. |
void |
setComparator(com.klg.jclass.util.swing.JCRowComparator comparator)
Sets the Comparator property defining the sort order to provide
a sorted mapping of the given TableModel to the view. |
void |
setDataSorted(boolean sorted)
Sorts the indices of rows using the quicksort algorithm. |
void |
setKeyColumns(int column,
int[] keyColumns)
Sets the key columns used to sort the table model when clicking on a specified column. |
void |
setModel(TableModel newModel)
Sets the table model wrapped by this model. |
void |
setSortColumn(int column)
Sets the sort column. |
void |
setSortOrder(int order)
Sets the sorting order. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Sets a value for the record in the TableModel cell at
columnIndex and rowIndex . |
void |
tableChanged(TableModelEvent e)
The table model has changed. |
void |
toggleSortOrder()
Toggles the sorting order. |
void |
unsort()
Restores the unsorted order. |
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 |
Field Detail |
public static final int FORWARD
public static final int REVERSE
protected int order
protected TableModel tableModel
protected int sortColumn
protected int[] indices
protected int[] reverseIndices
protected com.klg.jclass.util.swing.JCRowComparator rowComparator
protected int[][] keyColumnsArray
protected com.klg.jclass.util.swing.DefaultRowSortTableModel.RowIntComparator rowIntComparator
protected boolean autoSort
protected boolean needsResorting
protected boolean needsReordering
Constructor Detail |
public DefaultRowSortTableModel(TableModel tableModel, com.klg.jclass.util.swing.JCRowComparator comparator)
JCRowSortModel
that wraps a given instance of a
TableModel
and provides a sorted mapping of the
TableModel
to the view. The sort order is defined by the
configurable Comparator
property.
tableModel
- The TableModel to wrapcomparator
- The comparator to do the sortingpublic DefaultRowSortTableModel(TableModel tableModel)
JCRowSortModel
that wraps a given instance of
a TableModel
and provides a sorted mapping of the
TableModel
to the view.
tableModel
- The TableModel to wrapMethod Detail |
public TableModel getModel()
public void setModel(TableModel newModel)
newModel
- The new TableModel to wrappublic void setKeyColumns(int column, int[] keyColumns)
setKeyColumns
in interface JCRowSortModel
column
- index of column in TableModel
.keyColumns
- columns to use as keys to sort when sorting
on the specified column.public int[] getKeyColumns(int column)
getKeyColumns
in interface JCRowSortModel
column
- index of column in TableModel
.
public boolean isDataSorted()
isDataSorted
in interface JCRowSortModel
public boolean getAutoSort()
getAutoSort
in interface JCRowSortModel
public void setAutoSort(boolean autoSort)
setAutoSort
in interface JCRowSortModel
autoSort
- The new value of autoSortpublic int getSortColumn()
getSortColumn
in interface JCRowSortModel
public void setSortColumn(int column)
setSortColumn
in interface JCRowSortModel
column
- The new sort columnpublic int getSortOrder()
getSortOrder
in interface JCRowSortModel
public void setSortOrder(int order)
setSortOrder
in interface JCRowSortModel
order
- The new sorting orderpublic void toggleSortOrder()
toggleSortOrder
in interface JCRowSortModel
public int getUnsortedRow(int sortedRow)
getUnsortedRow
in interface JCRowSortTableModel
sortedRow
- The sorted row index
public int getSortedRow(int row)
getSortedRow
in interface JCRowSortTableModel
row
- The unsorted row index
public void setComparator(com.klg.jclass.util.swing.JCRowComparator comparator)
Comparator
property defining the sort order to provide
a sorted mapping of the given TableModel
to the view.
comparator
- The new comparator for sortingpublic com.klg.jclass.util.swing.JCRowComparator getComparator()
public void setDataSorted(boolean sorted)
setDataSorted
in interface JCRowSortModel
sorted
- If true and the data is not sorted, sorts the data. If false,
unsorts the data.public void unsort()
protected void doReverseMapping()
public int getColumnCount()
TableModel
.
getColumnCount
in interface TableModel
public int getRowCount()
TableModel
.
getRowCount
in interface TableModel
public String getColumnName(int column)
TableModel
default column name.
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
column
- The column number whose name is required
public Class getColumnClass(int columnIndex)
Class
for the
TableModel
column.
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
columnIndex
- The index of the column whose class is required
public boolean isCellEditable(int rowIndex, int columnIndex)
TableModel
cell at rowIndex
and columnIndex
is editable.
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
rowIndex
- The row index of the cellcolumnIndex
- The column index of the cell
public Object getValueAt(int rowIndex, int columnIndex)
TableModel
cell at
columnIndex
and rowIndex
.
getValueAt
in interface TableModel
rowIndex
- The row index of the cellcolumnIndex
- The column index of the cell
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
TableModel
cell at
columnIndex
and rowIndex
.
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
aValue
- The new value for the cell with the given row and cell indexrowIndex
- The row index of the cellcolumnIndex
- The column index of the cellpublic void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
e
- The event that generated this call
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |