|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
com.jidesoft.grid.TableModelWrapperImpl
com.jidesoft.grid.DefaultTableModelWrapper
com.jidesoft.grid.FilterableTableModel
com.jidesoft.lucene.LuceneFilterableTableModel
public class LuceneFilterableTableModel
LuceneFilterableTableModel is a table model which wraps another table model, not including tree table
model, so that user can apply filters on it, the filter is working on Lucene mode, which means we will use Lucene Jar
to create indexing for the entire table data once you pass the table model in as a parameter or it receives table
data change event.
FilterableTableModel, LuceneFilterableTableModel has higher performance at
filtering part and has more text search options based on Lucene syntax. So if you have a large table and you don't
expect your customer to refresh the data of the table very frequently, you can consider using
LuceneFilterableTableModel instead of FilterableTableModel. However, if you are expecting
your customer refresh the data very frequently or you have a lot of columns with Number class, you probably better
use FilterableTableModel.
Please be noted that LuceneFilterableTableModel does not support TreeTableModel.
It's not recommended to wrap two LuceneFilterableTableModel in one model wrapper chain. Because it will consumes
twice memory than necessary.
There are two ways to add a filter. One is to add a filter to apply to all the values in the table model using FilterableTableModel.addFilter(com.jidesoft.filter.Filter). Or you can add filter to a particular column using FilterableTableModel.addFilter(int,
com.jidesoft.filter.Filter).
By default, filters won't take effect immediately. You need to call setFiltersApplied(true) to apply
those filters. If filtersApplied flag is true already, you just need to call refresh(). We don't refresh
automatically because you might have several filters to add. You can add all of them, then only call refresh once.
setFiltersApplied(int) will control all the filters. Each filter has its own enabled flag which will
control each individual filter.
| 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 |
|---|
| 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 | |
|---|---|
LuceneFilterableTableModel(TableModel model)
Creates a LuceneFilterableTableModel from any table model. |
|
| Method Summary | |
|---|---|
protected String |
convertFilterToLuceneQueryText(int columnIndex,
Filter filter)
Convert Filter to Query text. |
protected void |
filter(boolean filterAllData)
Applies filters and generates a new array of indices. |
void |
fireFilterChanged(FilterableTableModelEvent e)
Forwards the given notification event to all FilterableTableModelListeners that registered
themselves as listeners for this table model. |
int |
getBooleanQueryMaxClauseCount()
Get the max clause count configuration for BooleanQuery |
Document |
getDocument(int rowIndex)
Get the document for the row. |
int |
getDocumentCount()
Get the total number of available documents. |
protected String |
getFieldNameForColumn(int column)
Convert the column name in the table to field in Lucene so that Lucene can handle the field better. |
protected Query |
getLuceneQuery()
Get the Query instance used for Lucene filter. |
com.jidesoft.lucene.LuceneSupport |
getLuceneSupport()
|
protected List<Integer> |
getReservedRows(int firstRow,
int lastRow)
Get reserved rows after applying filters on rows from firstRow to lastRow. |
boolean |
isAllowLeadingWildcard()
Get if allow the customer input leading wildcard |
boolean |
isRangeQueryInclusive()
Get if the boundary value should be included in RangeQuery |
void |
notifyIndexCreated()
Notify indexing is finished in LuceneSupport so that it is able to do filtering. |
void |
setAllowLeadingWildcard(boolean allowLeadingWildcard)
Set if allow the customer input leading wildcard |
void |
setBooleanQueryMaxClauseCount(int booleanQueryMaxClauseCount)
Set the max clause count configuration for BooleanQuery |
void |
setLuceneSupport(com.jidesoft.lucene.LuceneSupport luceneSupport)
|
void |
setRangeQueryInclusive(boolean rangeQueryInclusive)
Set if the boundary value should be included in RangeQuery |
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 |
tableDataChanged()
Called each time all of the data (i.e. |
protected void |
tableRowsDeleted(int firstRow,
int lastRow)
Called each time one or more contiguous rows are deleted from the underlying TableModel. |
protected void |
tableRowsInserted(int firstRow,
int lastRow)
Called each time one or more contiguous rows are inserted into the underlying TableModel. |
protected void |
tableRowsUpdated(int firstRow,
int lastRow)
Called each time one or more contiguous rows are updated in the underlying TableModel. |
protected void |
tableStructureChanged()
Called each time the structure ( TableColumns, etc) of the underlying TableModel
changes. |
| 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 |
| Constructor Detail |
|---|
public LuceneFilterableTableModel(TableModel model)
model - the table model that has the data before filtering.| Method Detail |
|---|
protected String getFieldNameForColumn(int column)
column - the column index
public Document getDocument(int rowIndex)
rowIndex - the row index (record number)
public int getDocumentCount()
public void notifyIndexCreated()
protected void tableDataChanged()
DefaultTableModelWrapperTableModel. This
default implementation simply fires a corresponding TableModelEvent to the listeners on this model.
tableDataChanged in class FilterableTableModelprotected void tableStructureChanged()
DefaultTableModelWrapperTableColumns, etc) of the underlying TableModel
changes. This default implementation simply fires a corresponding TableModelEvent to the listeners
on this model.
tableStructureChanged in class FilterableTableModel
protected void tableRowsInserted(int firstRow,
int lastRow)
DefaultTableModelWrapperTableModel. This
default implementation simply fires a corresponding TableModelEvent to the listeners on this model.
tableRowsInserted in class FilterableTableModelfirstRow - the index of the first row that was insertedlastRow - the index of the last row that was inserted
protected void tableRowsDeleted(int firstRow,
int lastRow)
DefaultTableModelWrapperTableModel. This
default implementation simply fires a corresponding TableModelEvent to the listeners on this model.
tableRowsDeleted in class FilterableTableModelfirstRow - the index of the first row that was deletedlastRow - the index of the last row that was deleted
protected void tableRowsUpdated(int firstRow,
int lastRow)
DefaultTableModelWrapperTableModel. simply fires
a corresponding TableModelEvent to the listeners on this model.
tableRowsUpdated in class FilterableTableModelfirstRow - the index of the first row that was updatedlastRow - the index of the last row that was updated
protected void tableCellsUpdated(int column,
int firstRow,
int lastRow)
DefaultTableModelWrappercolumn in the range [firstRow, lastRow] are
updated. This default implementation simply fires a corresponding TableModelEvent to the listeners
on this model.
tableCellsUpdated in class FilterableTableModelcolumn - 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 updated
protected List<Integer> getReservedRows(int firstRow,
int lastRow)
FilterableTableModel
getReservedRows in class FilterableTableModelfirstRow - the first rowlastRow - the last row
protected void filter(boolean filterAllData)
filter in class FilterableTableModelfilterAllData - if this run of filter have to go through all the rowsprotected Query getLuceneQuery()
protected String convertFilterToLuceneQueryText(int columnIndex,
Filter filter)
columnIndex - the index of the column the filter is going to applyfilter - the filter
public void fireFilterChanged(FilterableTableModelEvent e)
FilterableTableModelFilterableTableModelListeners that registered
themselves as listeners for this table model.
fireFilterChanged in class FilterableTableModele - the event to be forwardedFilterableTableModel.addFilterableTableModelListener(com.jidesoft.grid.FilterableTableModelListener),
FilterableTableModelEvent,
EventListenerListpublic com.jidesoft.lucene.LuceneSupport getLuceneSupport()
public void setLuceneSupport(com.jidesoft.lucene.LuceneSupport luceneSupport)
public int getBooleanQueryMaxClauseCount()
public void setBooleanQueryMaxClauseCount(int booleanQueryMaxClauseCount)
booleanQueryMaxClauseCount - the valuepublic boolean isRangeQueryInclusive()
public void setRangeQueryInclusive(boolean rangeQueryInclusive)
rangeQueryInclusive - true if inclusive. Otherwise false.public boolean isAllowLeadingWildcard()
public void setAllowLeadingWildcard(boolean allowLeadingWildcard)
allowLeadingWildcard - true if allow. Otherwise false.
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||