|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
dsto.dfc.swing.table.AbstractDfcTableModel
dsto.dfc.swing.table.ProxyTableModel
dsto.dfc.swing.table.SortedTableModel
public class SortedTableModel
Presents a DfcTableModel in sorted order.
Nested Class Summary | |
---|---|
static class |
SortedTableModel.SortingColumn
Stores information about column to be sorted by. |
Field Summary |
---|
Fields inherited from class dsto.dfc.swing.table.ProxyTableModel |
---|
model |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
SortedTableModel(DfcTableModel model)
|
Method Summary | |
---|---|
SortedTableModel.SortingColumn |
addSortingColumn(int columnIndex,
boolean ascending)
Add a column to the end of the list of columns to sort by (ie last in the sort order). |
boolean |
canCopyCells(int startRow,
int endRow,
int startColumn,
int endColumn)
Test if a copyCells () operation is permitted. |
boolean |
canCopyRows(int startRow,
int endRow)
|
boolean |
canDeleteCells(int startRow,
int endRow,
int startColumn,
int endColumn)
Test if a deleteCells () operation is permitted. |
boolean |
canDeleteRows(int rowStart,
int rowEnd)
Test if a deleteRows () operation is supported. |
boolean |
canMoveRows(int startRow,
int endRow,
int newStartRow)
NOTE: only handles case where startRow == endRow. |
boolean |
canPasteCells(Transferable transferable,
int startRow,
int endRow,
int startColumn,
int endColumn)
Should return true if rows may be pasted from a given Transferable into a block of cells. |
protected void |
checkModel()
Simple check that the enclosed model has not changed without informing us. |
protected void |
checkUpdateRowMapSize()
Check whether rowMap needs to be resized based on current table size. |
void |
clearSorting()
Remove all columns from the sort order. |
protected int |
compare(int row1,
int row2)
Compare two rows in the table using the current column sort order. |
protected int |
compareRowsByColumn(int row1,
int row2,
int column)
Compare two rows by their values in a given column. |
Transferable |
copyCells(int startRow,
int endRow,
int startColumn,
int endColumn)
Copy a rectangular block of cells into an AWT Transferable. |
Transferable |
copyRows(int startRow,
int endRow)
|
void |
deleteCells(int startRow,
int endRow,
int startColumn,
int endColumn)
Delete a rectangular block of cells. |
void |
deleteRows(int rowStart,
int rowEnd)
NOTE: only handles case where rowStart == rowEnd. |
SortedTableModel.SortingColumn |
findSortingColumn(int columnIndex)
Find a sorting column on sortingColumns with a
matching column index. |
Object |
getValueAt(int row,
int col)
|
protected void |
initRowMap()
Initialise row map with row indexes in unsorted (natural) order. |
void |
insertRows(int rowStart,
int rowEnd)
Insert empty rows. |
int |
mapRow(int row)
Map a row from this table's row space to the enclosed table's row space. |
boolean |
moveRows(int startRow,
int endRow,
int newStartRow)
|
void |
pasteCells(Transferable transferable,
int startRow,
int endRow,
int startColumn,
int endColumn)
|
void |
pasteRows(Transferable transferable,
int rowStart)
|
void |
removeSortingColumn(int columnIndex)
Remove a column from the sort order. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
|
protected void |
shuttlesort(int[] from,
int[] to,
int low,
int high)
(mpp) NOTE: this method is shamelessly ripped from Sun's TableSorter demo class - I did make it look prettier though. |
void |
sort()
(Re)Sort the model. |
void |
tableChanged(TableModelEvent e)
Called when the enclosing table changes. |
Methods inherited from class dsto.dfc.swing.table.ProxyTableModel |
---|
canDeleteColumns, canInsertColumn, canInsertRows, canPasteRows, deleteColumns, getColumnCount, getColumnName, getRowCount, getSubModel, insertColumn, isCellEditable |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, getColumnClass, removeTableModelListener |
Constructor Detail |
---|
public SortedTableModel(DfcTableModel model)
Method Detail |
---|
public SortedTableModel.SortingColumn addSortingColumn(int columnIndex, boolean ascending)
Note: this method, and all other methods that change the sort order, do
not automatically sort the table - see sort()
.
columnIndex
- The column to sort by.ascending
- True if sorting should be by ascending value,
false for descending value.removeSortingColumn(int)
public void removeSortingColumn(int columnIndex)
addSortingColumn(int, boolean)
,
clearSorting()
public void clearSorting()
addSortingColumn(int, boolean)
,
removeSortingColumn(int)
public SortedTableModel.SortingColumn findSortingColumn(int columnIndex)
sortingColumns
with a
matching column index.
public final int mapRow(int row)
protected void initRowMap()
protected void checkUpdateRowMapSize()
protected void checkModel()
public void sort()
protected void shuttlesort(int[] from, int[] to, int low, int high)
protected int compare(int row1, int row2)
protected int compareRowsByColumn(int row1, int row2, int column)
public void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
tableChanged
in class ProxyTableModel
public Object getValueAt(int row, int col)
getValueAt
in interface TableModel
getValueAt
in class ProxyTableModel
public boolean canMoveRows(int startRow, int endRow, int newStartRow)
canMoveRows
in interface DfcTableModel
canMoveRows
in class ProxyTableModel
public void deleteRows(int rowStart, int rowEnd) throws UnsupportedOperationException
deleteRows
in interface DfcTableModel
deleteRows
in class ProxyTableModel
rowStart
- The row to begin inserting.rowEnd
- The last row to delete.
UnsupportedOperationException
- if this is not supported.DfcTableModel.canDeleteRows(int, int)
public boolean canCopyRows(int startRow, int endRow)
canCopyRows
in interface DfcTableModel
canCopyRows
in class ProxyTableModel
public boolean canDeleteCells(int startRow, int endRow, int startColumn, int endColumn)
DfcTableModel
canDeleteCells
in interface DfcTableModel
canDeleteCells
in class ProxyTableModel
startRow
- The first row to delete.endRow
- The last row to delete.startColumn
- The first column to delete.endColumn
- The last column to delete.
public void pasteCells(Transferable transferable, int startRow, int endRow, int startColumn, int endColumn) throws IOException, CloneNotSupportedException, UnsupportedFlavorException, UnsupportedOperationException
pasteCells
in interface DfcTableModel
pasteCells
in class ProxyTableModel
IOException
CloneNotSupportedException
UnsupportedFlavorException
UnsupportedOperationException
public boolean canDeleteRows(int rowStart, int rowEnd)
DfcTableModel
canDeleteRows
in interface DfcTableModel
canDeleteRows
in class ProxyTableModel
rowStart
- The row to begin inserting.rowEnd
- The last row to delete.
public Transferable copyRows(int startRow, int endRow) throws CloneNotSupportedException, UnsupportedOperationException
copyRows
in interface DfcTableModel
copyRows
in class ProxyTableModel
CloneNotSupportedException
UnsupportedOperationException
public Transferable copyCells(int startRow, int endRow, int startColumn, int endColumn) throws CloneNotSupportedException, UnsupportedOperationException
DfcTableModel
copyCells
in interface DfcTableModel
copyCells
in class ProxyTableModel
startRow
- The first row to copy.endRow
- The last row to copy.startColumn
- The first column to copy.endColumn
- The last column to copy.
CloneNotSupportedException
- if a data item could not be cloned.
UnsupportedOperationException
DfcTableModel.canCopyRows(int, int)
public boolean moveRows(int startRow, int endRow, int newStartRow) throws UnsupportedOperationException
moveRows
in interface DfcTableModel
moveRows
in class ProxyTableModel
UnsupportedOperationException
public boolean canPasteCells(Transferable transferable, int startRow, int endRow, int startColumn, int endColumn)
DfcTableModel
canPasteCells
in interface DfcTableModel
canPasteCells
in class ProxyTableModel
transferable
- The transferable.startRow
- The row to insert the transferable at.
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface TableModel
setValueAt
in class ProxyTableModel
public void pasteRows(Transferable transferable, int rowStart) throws IOException, CloneNotSupportedException, UnsupportedFlavorException, UnsupportedOperationException
pasteRows
in interface DfcTableModel
pasteRows
in class ProxyTableModel
IOException
CloneNotSupportedException
UnsupportedFlavorException
UnsupportedOperationException
public boolean canCopyCells(int startRow, int endRow, int startColumn, int endColumn)
DfcTableModel
canCopyCells
in interface DfcTableModel
canCopyCells
in class ProxyTableModel
startRow
- The first row to copy.endRow
- The last row to copy.startColumn
- The first column to copy.endColumn
- The last column to copy.
public void insertRows(int rowStart, int rowEnd)
DfcTableModel
insertRows
in interface DfcTableModel
insertRows
in class ProxyTableModel
rowStart
- The row to begin inserting.rowEnd
- The number of rows to insert.DfcTableModel.canInsertRows(int, int)
public void deleteCells(int startRow, int endRow, int startColumn, int endColumn) throws UnsupportedOperationException
DfcTableModel
deleteCells
in interface DfcTableModel
deleteCells
in class ProxyTableModel
startRow
- The first row to delete.endRow
- The last row to delete.startColumn
- The first column to delete.endColumn
- The last column to delete.
UnsupportedOperationException
DfcTableModel.canDeleteCells(int, int, int, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |