|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel com.jidesoft.grid.TreeTableModel com.jidesoft.grid.AbstractGroupTableModel com.jidesoft.grid.DefaultGroupTableModel
public class DefaultGroupTableModel
Nested Class Summary | |
---|---|
static interface |
DefaultGroupTableModel.ColumnComparatorContextProvider
An interface used by SortableTableModel.setColumnComparatorContextProvider(com.jidesoft.grid.SortableTableModel.ColumnComparatorContextProvider) . |
Field Summary | |
---|---|
static int |
SORT_GROUP_COLUMN_ASCENDING
Ascending order on the group column, which means the groups row will be sorted in an ascending order. |
static int |
SORT_GROUP_COLUMN_DESCENDING
Descending order on the group column, which means the groups row will be sorted in an descending order. |
static int |
SORT_GROUP_COLUMN_NO_SORT
No sort on the group column, which means the group rows will be displayed in a first-come-first-display order by the order it appears in the original table model. |
Fields inherited from class com.jidesoft.grid.TreeTableModel |
---|
_filtersApplied |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Fields inherited from interface com.jidesoft.grid.EditorStyleTableModel |
---|
EDITOR_STYLE_EDITABLE, EDITOR_STYLE_NORMAL, EDITOR_STYLE_READ_ONLY, EDITOR_STYLE_SELECT_ONLY |
Fields inherited from interface com.jidesoft.grid.MultiTableModel |
---|
FOOTER_COLUMN, HEADER_COLUMN, REGULAR_COLUMN |
Constructor Summary | |
---|---|
DefaultGroupTableModel(TableModel tableModel)
The constructor. |
Method Summary | |
---|---|
void |
addGroupColumn(int columnIndex)
Adds a group column with default ascending order. |
void |
addGroupColumn(int columnIndex,
int order)
Adds a group column with designated sort order. |
DefaultGroupRow |
addGroupRow(Expandable parentRow,
DefaultGroupRow groupRow)
Adds GroupRow to a parent row. |
protected void |
cacheComparators()
For performance, all comparators for each column should be cached first. |
void |
clearGroupColumns()
Clears all group columns. |
void |
collapseAll()
Collapse all rows which have children. |
void |
collapseFirstLevel()
Collapses all top level rows only. |
void |
collapseGroupColumn(int groupColumnIndex)
Collapse all rows that corresponding to the group column. |
protected int |
compare(int row1,
int row2)
Compares two rows. |
protected int |
compare(Object o1,
Object o2,
int column)
Compares two objects in a column. |
protected CompoundTableModelEvent |
createCompoundTableModelEvent()
Creates a CompoundTableModelEvent. |
protected DefaultGroupRow |
createGroupRow()
Creates DefaultGroupRow. |
protected ReferenceRow |
createReferenceRow(TableModel tableModel,
int row)
Creates ReferenceRow. |
protected void |
ensureGroupColumnsCreated()
Makes sure internal used fields are created. |
void |
expandAll()
Expands all rows which have children. |
protected void |
expandAll(boolean fireDataChangedEvent)
Expands all rows. |
void |
expandFirstLevel()
Expands all root level rows. |
void |
expandGroupColumn(int groupColumnIndex)
Expand all rows that corresponding to the group column. |
void |
expandRow(ExpandableRow row,
boolean expanded)
Expands or collapses the row. |
DefaultGroupRow |
findGroupRow(Expandable parent,
TableModel tableModel,
int rowIndex)
Finds a group row to hold the row in the original table model. |
DefaultGroupRow |
findGroupRow(Row row,
int columnIndex)
Finds a group row to hold the row in this group table model. |
DefaultGroupRow |
findParentGroupRow(Expandable parent,
GroupCondition condition)
Finds a group row based on the ancestor row and the group condition. |
int |
getActualColumnAt(int column)
Gets the actual column index in the underlying table that corresponds the specified column index. |
TableModel |
getActualModel()
Gets the underlying table model. |
int |
getActualRowAt(int visualRow)
Gets the actual row index in the underlying table that corresponds the specified row index. |
Class<?> |
getCellClassAt(int rowIndex,
int columnIndex)
Gets the type at cell (row, column). |
CellSpan |
getCellSpanAt(int rowIndex,
int columnIndex)
Gets the cell span at the specified row and column. |
Class<?> |
getColumnClass(int column)
|
protected ComparatorContext |
getColumnComparatorContext(int column)
Gets the column comparator context. |
DefaultGroupTableModel.ColumnComparatorContextProvider |
getColumnComparatorContextProvider()
Gets the ColumnComparatorContextProvider. |
int |
getColumnCount()
|
Object |
getColumnIdentifier(int column)
Returns the identifier of the column in the model. |
int[] |
getColumnMapping()
Gets column mapping. |
String |
getColumnName(int column)
|
int |
getColumnType(int columnIndex)
Checks if the column at the columnIndex is a header column or footer column or just regular column. |
Comparator |
getComparator(int columnIndex)
Gets the column comparator. |
ConverterContext |
getConverterContextAt(int rowIndex,
int columnIndex)
Gets the converter context at cell (row, column). |
protected String |
getCountColumnName()
Gets the column name for the count column. |
EditorContext |
getEditorContextAt(int rowIndex,
int columnIndex)
Gets the editor context at cell (row, column). |
int |
getEditorStyleAt(int rowIndex,
int columnIndex)
Gets editor style at the cell. |
Map<Object,Boolean> |
getExpansionState()
Gets the expansion state of all expansion state of tree table model. |
int |
getGroupColumnAt(int index)
Gets the group column index. |
int |
getGroupColumnCount()
Gets the total count of group columns. |
Object |
getGroupColumnIdentifier(int groupColumnIndex)
Gets the identifier of the group column index. |
int |
getGroupColumnOrder(int index)
Gets the group column order. |
ReferenceRow |
getReferenceRow(int rowIndex)
|
Row |
getRowAt(int rowIndex)
Returns the row at row specified by row . |
int |
getRowCount()
Returns the number of rows in the model. |
int |
getRowIndex(Row row)
Gets the index of the row. |
protected String |
getSeparateGroupColumnName()
Gets the column name for the separate group column. |
int |
getTableIndex(int columnIndex)
Gets the table index that this column belongs to. |
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at columnIndex and rowIndex . |
int |
getVisualColumnAt(int actualColumn)
Gets the visual column index representing the specified actual column. |
int |
getVisualRowAt(int actualRow)
Gets the visual row index representing the specified actual row. |
void |
groupAndRefresh()
Do grouping and fire table structure changed event. |
boolean |
groupColumnsFirst()
Gets the flag indicating if group columns should always be displayed at the begging when displayed. |
boolean |
hasGroupColumns()
Checks if it has grouped columns. |
boolean |
isAlwaysUseComparators()
Checks if the alwaysUseComparators flag value. |
boolean |
isAscendingGroupOrder()
Deprecated. replaced by addGroupColumn(int, int) , sorting is the second parameter. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns false if column is 0 and return the isEditable of the row if column is 1. |
boolean |
isCellSpanOn()
Checks if the span is on. |
boolean |
isColumnDraggable(int columnIndex)
Checks if the column is draggable. |
boolean |
isColumnGroupable(int columnIndex)
Checks if the specific column is groupable. |
boolean |
isColumnGrouped(int columnIndex)
Is the column grouped. |
boolean |
isDisplayCountColumn()
Gets the flag indicating if a separate count column should be created to represent the count. |
boolean |
isDisplayGroupColumns()
Gets the flag indicating if the GroupTable should display group columns. |
boolean |
isDisplayGroupRowsFirst()
Gets the flag indicating if the group rows will be put ahead of the other reference rows when isRemoveNullGrouper() returns true. |
boolean |
isDisplaySeparateGroupColumn()
Gets the flag indicating if a separate group column should be created to represent the grouped columns. |
boolean |
isGroupEnabled()
Gets if the group feature is enabled. |
boolean |
isKeepColumnOrder()
Gets the flag indicating if the original column order in original table model should be kept. |
boolean |
isKeepGroupingOnStructureChange()
Gets the flag indicating if previous grouping columns should be kept on receiving table structure changed event. |
boolean |
isKeepPreviousExpandStatus()
Gets the flag indicating if the previous expand status should be kept on data changing, adding/removing group columns. |
boolean |
isRemoveNullGrouper()
Gets the flag indicating if the row will be moved to upper level if the last grouper values are null. |
boolean |
isSingleLevelGrouping()
Gets the flag if the group rows will be created in a single level or multiple levels mode. |
void |
removeGroupColumn(int columnIndex)
Removes a group column. |
void |
setAlwaysUseComparators(boolean alwaysUseComparators)
Sets the alwaysUseComparators flag. |
void |
setAscendingGroupOrder(boolean order)
Deprecated. replaced by addGroupColumn(int, int) , sorting is the second parameter. |
void |
setColumnComparatorContextProvider(DefaultGroupTableModel.ColumnComparatorContextProvider columnComparatorContextProvider)
Sets the ColumnComparatorContextProvider . |
void |
setDisplayCountColumn(boolean displayCountColumn)
Sets the flag indicating if a separate count column should be created to represent the count. |
void |
setDisplayGroupColumns(boolean displayGroupColumns)
Sets the flag indicating if the GroupTable should display group columns. |
void |
setDisplayGroupRowsFirst(boolean groupRowsFirst)
Sets the flag indicating if the group rows will be put ahead of the other reference rows when isRemoveNullGrouper() returns true. |
void |
setDisplaySeparateGroupColumn(boolean displaySeparateGroupColumn)
Sets the flag indicating if a separate group column should be created to represent the grouped columns. |
void |
setExpansionState(Map state)
Restores the expansion state of all rows in tree table model. |
void |
setGroupColumns(int[] columnIndices)
Sets group columns in a batch mode with default order as ascending. |
void |
setGroupColumns(int[] columnIndices,
int[] columnSorting)
Sets group columns in a batch mode. |
void |
setKeepColumnOrder(boolean keepColumnOrder)
Sets the flag indicating if the original column order in original table model should be kept. |
void |
setKeepGroupingOnStructureChange(boolean keepGroupingOnStructureChange)
Sets the flag indicating if previous grouping columns should be kept on receiving table structure changed event. |
void |
setKeepPreviousExpandStatus(boolean keepPreviousExpandStatus)
Sets the flag indicating if the previous expand status should be kept on data changing, adding/removing group columns. |
void |
setRemoveNullGrouper(boolean removeNullGrouper)
Sets the flag indicating if the row will be moved to upper level if the last grouper values are null. |
void |
setSingleLevelGrouping(boolean singleLevelGrouping)
Sets the flag if the group rows will be created in a single level or multiple levels mode. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Sets the value the underlying row of that cell. |
protected void |
sort(int[] from,
int[] to,
int low,
int high)
Sorts the rows. |
protected void |
tableCellsUpdated(int column,
int firstRow,
int lastRow)
The handler to handle tableCellsUpdated event. |
protected void |
tableDataChanged()
The handler to handle tableDataChanged event. |
protected void |
tableRowsDeleted(int firstRow,
int lastRow)
The handler to handle tableRowsDeleted event. |
protected void |
tableRowsInserted(int firstRow,
int lastRow)
The handler to handle tableRowsInserted event. |
protected void |
tableRowsUpdated(int firstRow,
int lastRow)
The handler to handle tableRowsUpdated event. |
protected void |
tableStructureChanged()
The handler to handle tableStructureChanged event. |
protected void |
updateReference(int index,
int inc)
Updates the row index field of IndexReferenceRow. |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableStructureChanged, 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, removeTableModelListener |
Field Detail |
---|
public static final int SORT_GROUP_COLUMN_NO_SORT
public static final int SORT_GROUP_COLUMN_ASCENDING
public static final int SORT_GROUP_COLUMN_DESCENDING
Constructor Detail |
---|
public DefaultGroupTableModel(TableModel tableModel)
tableModel
- the original table model embedded in the DefaultGroupTableModel.Method Detail |
---|
public boolean isColumnGroupable(int columnIndex)
isColumnGroupable
in interface GroupModelProvider
columnIndex
- the column index in the wrapped table model of this DefaultGroupTableModel
protected CompoundTableModelEvent createCompoundTableModelEvent()
createCompoundTableModelEvent
in class TreeTableModel
public void groupAndRefresh()
groupAndRefresh
in interface GroupModelProvider
protected DefaultGroupRow createGroupRow()
TreeTableModel.isAutoExpand()
returns true. Otherwise collapsed.
protected ReferenceRow createReferenceRow(TableModel tableModel, int row)
tableModel
- the original table modelrow
- the row index in the original table model
public boolean isKeepColumnOrder()
setKeepColumnOrder(boolean)
public void setKeepColumnOrder(boolean keepColumnOrder)
isDisplayCountColumn()
, isDisplayGroupColumns()
and isDisplaySeparateGroupColumn()
would not be honored.
keepColumnOrder
- the flagpublic boolean isColumnDraggable(int columnIndex)
ColumnDraggableSupport
isColumnDraggable
in interface ColumnDraggableSupport
columnIndex
- the column index
public DefaultGroupRow addGroupRow(Expandable parentRow, DefaultGroupRow groupRow)
groupAndRefresh()
will invoke
it automatically.
parentRow
- the parent row, which should also be a group row or a root rowgroupRow
- the group row to be added to the parent row
public DefaultGroupRow findParentGroupRow(Expandable parent, GroupCondition condition)
parent
- the ancestor rowcondition
- the group condition
protected void ensureGroupColumnsCreated()
public boolean isGroupEnabled()
AbstractGroupTableModel
isGroupEnabled
in class AbstractGroupTableModel
public boolean isColumnGrouped(int columnIndex)
columnIndex
- the column index. It is the column index as in the original table model.
public boolean hasGroupColumns()
public int getGroupColumnCount()
getGroupColumnAt(int)
method to find out each group column index.
getGroupColumnCount
in interface GroupModelProvider
public int getGroupColumnAt(int index)
getGroupColumnAt
in interface GroupModelProvider
index
- the column index.
public int getGroupColumnOrder(int index)
SORT_GROUP_COLUMN_NO_SORT
, SORT_GROUP_COLUMN_ASCENDING
or SORT_GROUP_COLUMN_DESCENDING
getGroupColumnOrder
in interface GroupModelProvider
index
- the column index
public void addGroupColumn(int columnIndex)
groupAndRefresh()
.
columnIndex
- the column index in the original table modelpublic void addGroupColumn(int columnIndex, int order)
groupAndRefresh()
.
columnIndex
- the column index in the original table modelorder
- the sort mode, one of SORT_GROUP_COLUMN_NO_SORT
, SORT_GROUP_COLUMN_ASCENDING
or SORT_GROUP_COLUMN_DESCENDING
public void removeGroupColumn(int columnIndex)
groupAndRefresh()
.
columnIndex
- the column index in the original table modelpublic void setGroupColumns(int[] columnIndices)
groupAndRefresh()
.
columnIndices
- the new group column indices in original table modelpublic void setGroupColumns(int[] columnIndices, int[] columnSorting)
groupAndRefresh()
.
setGroupColumns
in interface GroupModelProvider
columnIndices
- the new group column indices in original table modelcolumnSorting
- the sort order of each group columnpublic void clearGroupColumns()
groupAndRefresh()
.
public String getColumnName(int column)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public Object getColumnIdentifier(int column)
ColumnIdentifierTableModel
JideTable
uses this method to get the unique
identifier of this column.
getColumnIdentifier
in interface ColumnIdentifierTableModel
column
- the index of the column
public Object getGroupColumnIdentifier(int groupColumnIndex)
getGroupColumnIdentifier
in interface GroupModelProvider
groupColumnIndex
- the group column index
public EditorContext getEditorContextAt(int rowIndex, int columnIndex)
ContextSensitiveTableModel
getEditorContextAt
in interface ContextSensitiveTableModel
getEditorContextAt
in class TreeTableModel
rowIndex
- the row indexcolumnIndex
- the column index
public ConverterContext getConverterContextAt(int rowIndex, int columnIndex)
ContextSensitiveTableModel
getConverterContextAt
in interface ContextSensitiveTableModel
getConverterContextAt
in class TreeTableModel
rowIndex
- the row indexcolumnIndex
- the column index
public Class<?> getCellClassAt(int rowIndex, int columnIndex)
ContextSensitiveTableModel
getCellClassAt
in interface ContextSensitiveTableModel
getCellClassAt
in class TreeTableModel
rowIndex
- the row indexcolumnIndex
- the column index
public Class<?> getColumnClass(int column)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
public int getRowCount()
TreeTableModel
JTable
uses this method to determine how many rows it
should display. This method should be quick, as it is called frequently during rendering.
getRowCount
in interface TableModel
getRowCount
in class TreeTableModel
TableModel.getColumnCount()
public int getColumnCount()
getColumnCount
in interface TableModel
public boolean isCellEditable(int rowIndex, int columnIndex)
TreeTableModel
isCellEditable
in interface TableModel
isCellEditable
in class TreeTableModel
rowIndex
- the row being queriedcolumnIndex
- the column being queried
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
TreeTableModel
setValueAt
in interface TableModel
setValueAt
in class TreeTableModel
aValue
- value to assign to cellrowIndex
- row of cellcolumnIndex
- column of cellpublic Object getValueAt(int rowIndex, int columnIndex)
TreeTableModel
columnIndex
and rowIndex
.
getValueAt
in interface TableModel
getValueAt
in class TreeTableModel
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queried
public boolean isSingleLevelGrouping()
setSingleLevelGrouping(boolean)
public void setSingleLevelGrouping(boolean singleLevelGrouping)
singleLevelGrouping
- the flagpublic CellSpan getCellSpanAt(int rowIndex, int columnIndex)
SpanModel
private final CellSpan span = new CellSpan(0,0,1,1);
public CellSpan getCellSpanAt(int row, int col) {
span.setRow(...);
span.setColumn(...);
span.setRowSpan(...);
span.setColumnSpan(...);
return span;
}
For performance consideration, if the cell span has 1 row span and 1 column span, it is better to return null
instead of new CellSpan(row, column, 1, 1).
getCellSpanAt
in interface SpanModel
rowIndex
- the row index.columnIndex
- the column index.
public DefaultGroupRow findGroupRow(Expandable parent, TableModel tableModel, int rowIndex)
parent
- the parent rowtableModel
- the original table modelrowIndex
- the row index
public DefaultGroupRow findGroupRow(Row row, int columnIndex)
row
- the row instance inside the group table modelcolumnIndex
- the group column to find
public Row getRowAt(int rowIndex)
TreeTableModel
row
.
getRowAt
in interface ITreeTableModel
getRowAt
in class TreeTableModel
rowIndex
- the row whose row is to be queried
public int getRowIndex(Row row)
TreeTableModel
getRowIndex
in interface ITreeTableModel
getRowIndex
in class TreeTableModel
row
- row
public ReferenceRow getReferenceRow(int rowIndex)
public boolean isCellSpanOn()
SpanModel
isCellSpanOn
in interface SpanModel
public int getColumnType(int columnIndex)
MultiTableModel
getColumnType
in interface MultiTableModel
getColumnType
in class TreeTableModel
columnIndex
- the column index
public int getTableIndex(int columnIndex)
MultiTableModel
getTableIndex
in interface MultiTableModel
getTableIndex
in class TreeTableModel
columnIndex
- the column index
protected void tableRowsInserted(int firstRow, int lastRow)
firstRow
- the first row insertedlastRow
- the last row insertedprotected void tableRowsDeleted(int firstRow, int lastRow)
firstRow
- the first row deletedlastRow
- the last row deletedprotected void updateReference(int index, int inc)
index
- the row indexinc
- the gap to be updatedprotected void tableRowsUpdated(int firstRow, int lastRow)
firstRow
- the first row updatedlastRow
- the last row updatedprotected void tableCellsUpdated(int column, int firstRow, int lastRow)
column
- the column updatedfirstRow
- the first row updatedlastRow
- the last row updatedprotected void tableStructureChanged()
protected void tableDataChanged()
public int[] getColumnMapping()
public TableModel getActualModel()
TableModelWrapper
getActualModel
in interface TableModelWrapper
public int getActualRowAt(int visualRow)
RowTableModelWrapper
getActualRowAt
in interface RowTableModelWrapper
visualRow
- the visual row index.
public int getVisualRowAt(int actualRow)
RowTableModelWrapper
getVisualRowAt
in interface RowTableModelWrapper
actualRow
- the actual row index.
public int getActualColumnAt(int column)
ColumnTableModelWrapper
getActualColumnAt
in interface ColumnTableModelWrapper
public int getVisualColumnAt(int actualColumn)
ColumnTableModelWrapper
getVisualColumnAt
in interface ColumnTableModelWrapper
public boolean isDisplayGroupColumns()
isDisplayGroupColumns
in interface GroupModelProvider
public boolean groupColumnsFirst()
GroupModelProvider
groupColumnsFirst
in interface GroupModelProvider
public void setDisplayGroupColumns(boolean displayGroupColumns)
displayGroupColumns
- the flagisDisplayGroupColumns()
public boolean isDisplaySeparateGroupColumn()
isDisplayGroupColumns()
returns false and isKeepColumnOrder()
returns false.
setDisplayGroupColumns(boolean)
,
setKeepColumnOrder(boolean)
public void setDisplaySeparateGroupColumn(boolean displaySeparateGroupColumn)
displaySeparateGroupColumn
- the flagisDisplaySeparateGroupColumn()
protected String getCountColumnName()
protected String getSeparateGroupColumnName()
public boolean isDisplayCountColumn()
isDisplayGroupColumns()
returns true.
setDisplayGroupColumns(boolean)
public void setDisplayCountColumn(boolean displayCountColumn)
displayCountColumn
- the flagisDisplayCountColumn()
public void expandRow(ExpandableRow row, boolean expanded)
TreeTableModel
expandRow
in class TreeTableModel
row
- the row to be expanded or collapsedexpanded
- true to expand, false to collapse.public void expandAll()
TreeTableModel
expandAll
in class TreeTableModel
protected void expandAll(boolean fireDataChangedEvent)
fireDataChangedEvent
- the flag to indicating if a data changed event should be fired after expanding all.public void expandFirstLevel()
TreeTableModel
expandFirstLevel
in class TreeTableModel
public void collapseAll()
TreeTableModel
collapseAll
in class TreeTableModel
public void collapseFirstLevel()
TreeTableModel
collapseFirstLevel
in class TreeTableModel
public void expandGroupColumn(int groupColumnIndex)
groupColumnIndex
- the group column indexpublic void collapseGroupColumn(int groupColumnIndex)
groupColumnIndex
- the group column indexprotected void sort(int[] from, int[] to, int low, int high)
from
- an int array of row indices to be sortedto
- an int array of row indices to store the result after sortinglow
- the start index of the row in the array to be sortedhigh
- the end index of the row in the array to be sortedprotected int compare(int row1, int row2)
row1
- the first row indexrow2
- the second row index
protected int compare(Object o1, Object o2, int column)
o1
- the first objecto2
- the second objectcolumn
- the column index
protected void cacheComparators()
public Comparator getComparator(int columnIndex)
setAlwaysUseComparators(boolean)
and set it to true.
columnIndex
- the column index in the actual table model. It's NOT the column index in the group table
model.
protected ComparatorContext getColumnComparatorContext(int column)
ObjectComparatorManager
using different comparator context in ObjectComparatorManager.registerComparator(Class,
java.util.Comparator, com.jidesoft.comparator.ComparatorContext)
method. Then return the corresponding context
when overriding this method.
We also add a setter for this. You can call setColumnComparatorContextProvider(com.jidesoft.grid.DefaultGroupTableModel.ColumnComparatorContextProvider)
to provide a ColumnComparatorContextProvider. This provider will return a ComparatorContext for each column. This
will be helpful when it's hard to override SortableTableModel.
column
- the column index in the actual table model. It's NOT the column index in the group table model.
public boolean isRemoveNullGrouper()
setRemoveNullGrouper(boolean)
public void setRemoveNullGrouper(boolean removeNullGrouper)
removeNullGrouper
- the flagpublic boolean isDisplayGroupRowsFirst()
isRemoveNullGrouper()
returns true.
setDisplayGroupRowsFirst(boolean)
public void setDisplayGroupRowsFirst(boolean groupRowsFirst)
isRemoveNullGrouper()
returns true.
The default value is false to keep backward compatibility. This method would only take effect if isRemoveNullGrouper()
returns true.
groupRowsFirst
- the flagisRemoveNullGrouper()
public DefaultGroupTableModel.ColumnComparatorContextProvider getColumnComparatorContextProvider()
public void setColumnComparatorContextProvider(DefaultGroupTableModel.ColumnComparatorContextProvider columnComparatorContextProvider)
ColumnComparatorContextProvider
. This provider will provide a
ComparatorContext
for each column. If this table model has several columns that have the same types
in getColumnClass method but you want to use different comparators to compare and sort them, you would need to
register several comparators on ObjectComparatorManager
using different
ComparatorContext
. Then you can this provider to return different contexts so that
SortableTableModel
can find the correct comparator registered on
ObjectComparatorManager
. If you call this method with a non-null provider, we will automatically
call setAlwaysUseComparators(boolean)
and set it to true.
columnComparatorContextProvider
- the columnComparatorContextProviderpublic boolean isAlwaysUseComparators()
public void setAlwaysUseComparators(boolean alwaysUseComparators)
Comparable.compareTo(Object)
to compare. This is the default preferred way because this gives
developer a finer control of the comparison result. People also sometimes forgot to implement getColumnClass and
getColumnComparatorContext. If so, a wrong comparator could be used. If this flag is set to true, we will always
use Comparators to compare which you means you must implement getColumnClass and optionally implement
getColumnComparatorContext or use setColumnComparatorContextProvider(com.jidesoft.grid.DefaultGroupTableModel.ColumnComparatorContextProvider)
so that the correct comparator will be used for each column.
alwaysUseComparators
- true or false.public Map<Object,Boolean> getExpansionState()
TreeTableModel
TreeTableModel.setExpansionState(java.util.Map)
to restore the tree table expansion state after the TreeTableModel is
recreated.
getExpansionState
in class TreeTableModel
public void setExpansionState(Map state)
TreeTableModel
setExpansionState
in class TreeTableModel
state
- a map of the expansion state.public int getEditorStyleAt(int rowIndex, int columnIndex)
EditorStyleTableModel
getEditorStyleAt
in interface EditorStyleTableModel
rowIndex
- the row indexcolumnIndex
- the column index
@Deprecated public boolean isAscendingGroupOrder()
addGroupColumn(int, int)
, sorting is the second parameter.
@Deprecated public void setAscendingGroupOrder(boolean order)
addGroupColumn(int, int)
, sorting is the second parameter.
order
- true to make later sorting ascending, false to make later sorting descending.public boolean isKeepPreviousExpandStatus()
setKeepPreviousExpandStatus(boolean)
public void setKeepPreviousExpandStatus(boolean keepPreviousExpandStatus)
TreeTableModel.setAutoExpand(boolean)
, which means if the new group row could be found
in previous status, it will take the expand status from auto expanding.
By default, the flag is true. You could set it to false to return to original behavior.
keepPreviousExpandStatus
- the flagpublic boolean isKeepGroupingOnStructureChange()
setKeepGroupingOnStructureChange(boolean)
public void setKeepGroupingOnStructureChange(boolean keepGroupingOnStructureChange)
keepGroupingOnStructureChange
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |