|
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.TableModelWrapperImpl com.jidesoft.grid.DefaultTableModelWrapper com.jidesoft.grid.FilterableTableModel com.jidesoft.grid.FilterableTreeTableModel<T>
public class FilterableTreeTableModel<T extends Row>
A filterable TreeTableModel used by TreeTable. This is a subclass of FilterableTableModel
.
FilterableTreeTableModel
has only one default settings changed. In
plain FilterableTableModel, FilterableTableModel.getFilterAlgorithm()
by default returns FilterableTableModel.FILTER_ALGORITHM_BY_ROW
, which
means that the filtering is performed row by row. In FilterableTreeTableModel, FilterableTableModel.getFilterAlgorithm()
by
default returns FilterableTableModel.FILTER_ALGORITHM_BY_FILTER
, which means that it will consider the relationship between rows
on performing filter. If you want to change the filter algorithm of filtering, it requires you override shouldNotBeFiltered(ValueProvider, java.util.List, com.jidesoft.filter.Filter, int)
instead of shouldBeFiltered(ValueProvider, int, java.util.List, java.util.List, java.util.List[])
in FilterableTableModel.
FilterableTreeTableModel
adds two options, isKeepAllChildren()
and isKeepParentNode()
,
which makes the behavior a little bit different with plain FilterableTableModel. By default, both options returns
true. Please check out the javadoc of those two methods for details.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.jidesoft.grid.IFilterableTableModel |
---|
IFilterableTableModel.FilterItem |
Nested classes/interfaces inherited from interface com.jidesoft.grid.AutoFilterTableHeaderAdapter |
---|
AutoFilterTableHeaderAdapter.FilterTitleFormatter |
Field Summary | |
---|---|
static int |
POSSIBLE_VALUES_ALL_ROWS
|
static int |
POSSIBLE_VALUES_COLLAPSED_ROWS
|
static int |
POSSIBLE_VALUES_FIRST_LEVEL
|
static int |
POSSIBLE_VALUES_LEAF_LEVEL
|
static int |
POSSIBLE_VALUES_NON_FIRST_NON_LEAF_LEVEL
|
Fields inherited from class com.jidesoft.grid.FilterableTableModel |
---|
_allColumnFilters, _anyColumnFilters, _columnIncluded, _eachColumnFilters, _filterItemSupport, _valueProvider, FILTER_ALGORITHM_BY_FILTER, FILTER_ALGORITHM_BY_ROW |
Fields inherited from class com.jidesoft.grid.DefaultTableModelWrapper |
---|
_indexes |
Fields inherited from class com.jidesoft.grid.TableModelWrapperImpl |
---|
_model |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Fields inherited from interface com.jidesoft.grid.IFilterableTableModel |
---|
ALL_COLUMNS, ANY_COLUMNS, IDENTIFIER_ALL_COLUMNS, IDENTIFIER_ANY_COLUMNS |
Fields inherited from interface com.jidesoft.grid.MultiTableModel |
---|
FOOTER_COLUMN, HEADER_COLUMN, REGULAR_COLUMN |
Fields inherited from interface com.jidesoft.grid.EditorStyleTableModel |
---|
EDITOR_STYLE_EDITABLE, EDITOR_STYLE_NORMAL, EDITOR_STYLE_READ_ONLY, EDITOR_STYLE_SELECT_ONLY |
Constructor Summary | |
---|---|
FilterableTreeTableModel(TableModel model)
|
Method Summary | |
---|---|
protected void |
filter(boolean filterAllData)
Applies filters and generates a new array of indices. |
protected boolean |
filtering(ValueProvider valueProvider,
int rowIndex,
List<Filter> allColumnFilters,
List<Filter> anyColumnFilters,
List<Filter>[] eachColumnFilters)
|
int |
getDefaultPossibleValuesType()
Gets the default possible values retrieval option. |
Object[] |
getPossibleValues(int columnIndex,
Comparator comparator)
Gets all possible values of the table model. |
int |
getPossibleValuesType(int column)
Gets the sortable option for the specified column. |
Object |
getRoot()
Gets the root expandable row which has the original rows as children. |
Row |
getRowAt(int rowIndex)
Returns the row at row specified by row . |
int |
getRowIndex(T row)
Gets the index of the row. |
protected Object |
getValueAt(Row row,
int column)
Gets the value at the column in the Row. |
protected void |
invalidateFilterCache()
|
protected void |
invalidateFilterCache(Object parent)
Deprecated. |
protected void |
invalidateFilterCache(Object parent,
boolean recursive)
Deprecated. |
boolean |
isKeepAllChildren()
This is an option to keep all children rows if their parent row is not filtered away. |
boolean |
isKeepParentNode()
This is an option to keep the row is one of its children rows is not filtered away. |
void |
setDefaultPossibleValuesType(int defaultPossibleValuesType)
Sets the default possible values retrieval option. |
void |
setKeepAllChildren(boolean keepAllChildren)
This is an option to keep all children rows if their parent row is not filtered away. |
void |
setKeepParentNode(boolean keepParentNode)
This is an option to keep the row is one of its children rows is not filtered away. |
void |
setPossibleValuesType(int column,
int possibleValuesType)
Sets the possible values retrieval option for the specified column. |
protected boolean |
shouldBeFiltered(ValueProvider valueProvider,
int row,
List<Filter> allColumnFilters,
List<Filter> anyColumnFilters,
List<Filter>[] eachColumnFilters)
The method contains the algorithm to filter the specified row. |
protected boolean |
shouldBeFilteredCached(ValueProvider valueProvider,
int rowIndex,
List<Filter> allColumnFilters,
List<Filter> anyColumnFilters,
List<Filter>[] eachColumnFilters)
This method will store the result of filtering in cache. |
protected List<Integer> |
shouldNotBeFiltered(ValueProvider valueProvider,
List<Integer> filteringRowList,
Filter filter,
int filteringColumn)
The method contains the algorithm to filter the specified row list with specified filter. |
protected boolean |
shouldRowBeIncluded(int columnIndex,
Row row)
Checks if the row be included into the possible values list. |
protected void |
tableCellsUpdated(int column,
int firstRow,
int lastRow)
Called each time the cells in column in the range [firstRow , lastRow ] are
updated. |
protected void |
tableRowsUpdated(int firstRow,
int lastRow)
Called each time one or more contiguous rows are updated in the underlying TableModel . |
Methods inherited from class com.jidesoft.grid.DefaultTableModelWrapper |
---|
getActualRowAt, getCellClassAt, getCellSpanAt, getConverterContextAt, getEditorContextAt, getEditorStyleAt, getIndexes, getRowCount, getValueAt, getVisualRowAt, isCacheEnabled, isCellEditable, isRowCountChanged, reallocateIndexes, setCacheEnabled, setIndexes, setValueAt |
Methods inherited from class com.jidesoft.grid.TableModelWrapperImpl |
---|
addIndexChangeListener, createCompoundTableModelEvent, fireTableCellsUpdated, fireTableChanged, getActualModel, getCellStyleAt, getColumnClass, getColumnCount, getColumnIdentifier, getColumnName, getColumnType, getIndexChangeListeners, getTableIndex, isCellSpanOn, isCellStyleOn, isNavigableAt, isNavigationOn, removeIndexChangeListener, tableChanged |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, 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 |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt |
Methods inherited from interface com.jidesoft.grid.TableModelWrapper |
---|
getActualModel |
Field Detail |
---|
public static final int POSSIBLE_VALUES_FIRST_LEVEL
public static final int POSSIBLE_VALUES_LEAF_LEVEL
public static final int POSSIBLE_VALUES_NON_FIRST_NON_LEAF_LEVEL
public static final int POSSIBLE_VALUES_COLLAPSED_ROWS
public static final int POSSIBLE_VALUES_ALL_ROWS
Constructor Detail |
---|
public FilterableTreeTableModel(TableModel model)
Method Detail |
---|
public boolean isKeepAllChildren()
public void setKeepAllChildren(boolean keepAllChildren)
keepAllChildren
- true or false.public boolean isKeepParentNode()
public void setKeepParentNode(boolean keepParentNode)
keepParentNode
- true or false.protected void filter(boolean filterAllData)
FilterableTableModel
filter
in class FilterableTableModel
filterAllData
- the flag that if we have to filter on all data or we could just filter the current dataprotected void invalidateFilterCache()
invalidateFilterCache
in class FilterableTableModel
@Deprecated protected void invalidateFilterCache(Object parent)
parent
- the parent node@Deprecated protected void invalidateFilterCache(Object parent, boolean recursive)
parent
- the parent noderecursive
- recursively removal or notprotected void tableRowsUpdated(int firstRow, int lastRow)
DefaultTableModelWrapper
TableModel
. simply fires
a corresponding TableModelEvent
to the listeners on this model.
tableRowsUpdated
in class FilterableTableModel
firstRow
- the index of the first row that was updatedlastRow
- the index of the last row that was updatedprotected void tableCellsUpdated(int column, int firstRow, int lastRow)
DefaultTableModelWrapper
column
in the range [firstRow
, lastRow
] are
updated. This default implementation simply fires a corresponding TableModelEvent
to the listeners
on this model.
tableCellsUpdated
in class FilterableTableModel
column
- the index of the column that was updatedfirstRow
- the index of the first row in the above column
that was updatedlastRow
- the index of the last row in the above column
that was updatedpublic Row getRowAt(int rowIndex)
row
.
getRowAt
in interface ITreeTableModel<T extends Row>
rowIndex
- the row whose row is to be queried
public int getRowIndex(T row)
getRowIndex
in interface ITreeTableModel<T extends Row>
row
- row
public Object getRoot()
ITreeTableModel
getRoot
in interface ITreeTableModel<T extends Row>
protected List<Integer> shouldNotBeFiltered(ValueProvider valueProvider, List<Integer> filteringRowList, Filter filter, int filteringColumn)
FilterableTableModel
FilterableTableModel.shrinkRowsBeforeFilter(ValueProvider, java.util.List)
.
Please be noted that this method will take effect only if FilterableTableModel.getFilterAlgorithm()
returns FilterableTableModel.FILTER_ALGORITHM_BY_FILTER
. So if you try to override this method, please make sure your filter algorithm is
FilterableTableModel.FILTER_ALGORITHM_BY_FILTER
shouldNotBeFiltered
in class FilterableTableModel
valueProvider
- An interface where we can retrieve valuefilteringRowList
- The row index list to be checkedfilter
- Current filterfilteringColumn
- Current filtering column, its value could be either a real column index or IFilterableTableModel.ANY_COLUMNS
protected boolean shouldBeFiltered(ValueProvider valueProvider, int row, List<Filter> allColumnFilters, List<Filter> anyColumnFilters, List<Filter>[] eachColumnFilters)
shouldNotBeFiltered(ValueProvider, java.util.List, com.jidesoft.filter.Filter, int)
is the method you may want
to override instead.
shouldBeFiltered
in class FilterableTableModel
valueProvider
- an interface where we can retrieve value.row
- the row indexallColumnFilters
- The list of filters on ALL_COLUMNanyColumnFilters
- The list of filters on ANY_COLUMNeachColumnFilters
- The array of list of filters on each column
protected boolean shouldBeFilteredCached(ValueProvider valueProvider, int rowIndex, List<Filter> allColumnFilters, List<Filter> anyColumnFilters, List<Filter>[] eachColumnFilters)
valueProvider
- the ValueProviderrowIndex
- the row index.allColumnFilters
- The list of filters on ALL_COLUMNanyColumnFilters
- The list of filters on ANY_COLUMNeachColumnFilters
- The array of list of filters on each column
protected boolean filtering(ValueProvider valueProvider, int rowIndex, List<Filter> allColumnFilters, List<Filter> anyColumnFilters, List<Filter>[] eachColumnFilters)
protected boolean shouldRowBeIncluded(int columnIndex, Row row)
columnIndex
- the column indexrow
- the row
public Object[] getPossibleValues(int columnIndex, Comparator comparator)
FilterableTableModel
FilterableTableModel.shouldPossibleValueBeIncluded(Object, int)
method to decide if you want a particular value
appears in the possible value array.
The possible values are used by AutoFilterTableHeader
to populate the drop down filter list.
getPossibleValues
in interface IFilterableTableModel
getPossibleValues
in class FilterableTableModel
columnIndex
- the column index.comparator
- the comparator. It is used to sort the values.
FilterableTableModel.shouldPossibleValueBeIncluded(Object, int)
protected Object getValueAt(Row row, int column)
row
- the row instancecolumn
- the column index
public int getDefaultPossibleValuesType()
setDefaultPossibleValuesType(int)
public void setDefaultPossibleValuesType(int defaultPossibleValuesType)
POSSIBLE_VALUES_LEAF_LEVEL
, POSSIBLE_VALUES_FIRST_LEVEL
, POSSIBLE_VALUES_ALL_ROWS
, POSSIBLE_VALUES_COLLAPSED_ROWS
.
By default, the default possible values types is ~POSSIBLE_VALUES_COLLAPSED_ROWS to exclude collapsed rows.
defaultPossibleValuesType
- retrieval optionpublic int getPossibleValuesType(int column)
column
- the column index in table model. It's not the visual index but the model index.
setPossibleValuesType(int, int)
public void setPossibleValuesType(int column, int possibleValuesType)
column
- the column index in table model. It's not the visual index but the model index.possibleValuesType
- The valid retrieval options are POSSIBLE_VALUES_LEAF_LEVEL
, POSSIBLE_VALUES_FIRST_LEVEL
, POSSIBLE_VALUES_ALL_ROWS
, POSSIBLE_VALUES_COLLAPSED_ROWS
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |