com.jidesoft.pivot
Class SortableAggregateTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
com.jidesoft.grid.TableModelWrapperImpl
com.jidesoft.grid.DefaultTableModelWrapper
com.jidesoft.grid.SortableTableModel
com.jidesoft.pivot.SortableAggregateTableModel
- All Implemented Interfaces:
- ColumnIdentifierTableModel, ContextSensitiveTableModel, EditorStyleTableModel, IndexChangeEventGenerator, IndexedRowTableModelWrapper, ISortableTableModel, MultiTableModel, NavigableModel, RowTableModelWrapper, SpanModel, StyleModel, TableModelWrapper, Serializable, EventListener, TableModelListener, TableModel
public class SortableAggregateTableModel
- extends SortableTableModel
A sortable AggregateTableModel used by AggregateTable. If the AggregateTable is sortable, it will use this model by
default.
- See Also:
- Serialized Form
Method Summary |
int |
compare(int row1,
int row2,
int column)
Compares the two cell values at the two rows. |
protected void |
sort()
Sorts the aggregate table model. |
Methods inherited from class com.jidesoft.grid.SortableTableModel |
addSortListener, append, cacheComparators, compare, compare, fireSortEvent, fireSortingEvent, fireTableChanged, fireTableStructureChanged, getColumnComparatorContext, getColumnComparatorContextProvider, getColumnSortRank, getComparator, getMasterSortColumnIndex, getMasterSortColumns, getMaximumSortColumns, getPopupMenuItems, getSortableModel, getSortedRowAt, getSortingColumns, getSortListeners, getSortOrderHandler, getSortPriority, getSortRanges, insert, isAlwaysUseComparators, isAutoResort, isColumnAscending, isColumnSortable, isColumnSorted, isInSortRanges, isMultiColumnSortable, isOptimized, isResetOnTableStructureChangeEvent, isSortable, isSortingPaused, removeSortListener, reset, resort, reverseColumnSortOrder, search, setAlwaysUseComparators, setAutoResort, setColumnComparatorContextProvider, setColumnSortable, setIndexes, setMasterSortColumns, setMaximumSortColumns, setMultiColumnSortable, setOptimized, setResetOnTableStructureChangeEvent, setSortable, setSortingColumns, setSortingPaused, setSortOrderHandler, setSortPriority, shouldOptimize, shouldReverseIndices, sort, sortColumn, sortColumn, sortColumn, tableChanged, toggleSortOrder, unsortColumn |
Methods inherited from class com.jidesoft.grid.DefaultTableModelWrapper |
fireIndexChanged, fireIndexChanging, getActualRowAt, getCellClassAt, getCellSpanAt, getConverterContextAt, getEditorContextAt, getEditorStyleAt, getIndexes, getRowCount, getValueAt, getVisualRowAt, isCacheEnabled, isCellEditable, isRowCountChanged, reallocateIndexes, setCacheEnabled, setValueAt, tableCellsUpdated, tableDataChanged, tableDataChanged, tableRowsDeleted, tableRowsInserted, tableRowsUpdated, tableStructureChanged |
Methods inherited from class com.jidesoft.grid.TableModelWrapperImpl |
addIndexChangeListener, createCompoundTableModelEvent, fireTableCellsUpdated, getActualModel, getCellStyleAt, getColumnClass, getColumnCount, getColumnIdentifier, getColumnName, getColumnType, getIndexChangeListeners, getTableIndex, isCellSpanOn, isCellStyleOn, isNavigableAt, isNavigationOn, removeIndexChangeListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SortableAggregateTableModel
public SortableAggregateTableModel(TableModel model)
sort
protected void sort()
- Sorts the aggregate table model. Subclass can override to provide an optimized way to sort the table. You can get
the grouping column information by using getMasterSortColumns() and get all sorting column information by using
getSortingColumns().
- Overrides:
sort
in class SortableTableModel
compare
public int compare(int row1,
int row2,
int column)
- Compares the two cell values at the two rows. Since we have to keep summary value on the bottom, so the return
value has a little bit confusion here. if one of the two rows is a summary value and the column is not a grouping
column, we use Integer.MIN_VALUE or Integer.MAX_VALUE so the value will not be changed by sorting direction. With
this algorithm, we don't have to override
SortableTableModel.compare(int,int)
. if two rows are both summary values with
same prefix values, we now just keep the original order. You can choose to override this method if you want to
sort summary values as well.
- Overrides:
compare
in class SortableTableModel
- Parameters:
row1
- index of the first row to be comparedrow2
- index of the second row to be comparedcolumn
- the column index of both rows.
- Returns:
- If it returns > 0, it means the first value is greater than the second value. If it returns -1, it means
the second value is greater than the first value. If it returns 0, it means the two values are the same.
If it returns Integer.MAX_VALUE, the first value is always appear after the second value, regarding of
the order is ascending or descending. If it returns Integer.MIN_VALUE, the first value is always appear
before the second value, regarding of the order is ascending or descending.