public class TableSearcher
extends javax.swing.table.AbstractTableModel
This decorator works by holding a reference to a decorated ot inner TableModel. All data is stored within that table model, not this table model. Rather, this table model simply manages links to data in the inner table model according to the search. All methods on TableSearcher forward to the inner table model with subtle filtering or alteration according to the search criteria.
Using the table model: Pass the TableModel you want to decorate in at the constructor. When the TableModel initializes, it displays all search results. Call the search method with any valid Lucene search String and the data will be filtered by the search string. Users can always clear the search at any time by searching with an empty string. Additionally, you can add a button calling the clearSearch() method.
| Modifier and Type | Field and Description |
|---|---|
protected javax.swing.table.TableModel |
tableModel
The inner table model we are decorating
|
| Constructor and Description |
|---|
TableSearcher(javax.swing.table.TableModel tableModel) |
| Modifier and Type | Method and Description |
|---|---|
Analyzer |
getAnalyzer() |
java.lang.Class |
getColumnClass(int column) |
int |
getColumnCount() |
java.lang.String |
getColumnName(int column) |
int |
getRowCount() |
javax.swing.table.TableModel |
getTableModel() |
java.lang.Object |
getValueAt(int row,
int column) |
boolean |
isCellEditable(int row,
int column) |
void |
search(java.lang.String searchString)
Run a new search.
|
void |
setAnalyzer(Analyzer analyzer) |
void |
setTableModel(javax.swing.table.TableModel tableModel)
Set the table model used by this table model
|
void |
setValueAt(java.lang.Object aValue,
int row,
int column) |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListenerprotected javax.swing.table.TableModel tableModel
public TableSearcher(javax.swing.table.TableModel tableModel)
tableModel - The table model to decoratepublic javax.swing.table.TableModel getTableModel()
public void setTableModel(javax.swing.table.TableModel tableModel)
tableModel - The new table model to decoratepublic Analyzer getAnalyzer()
public void setAnalyzer(Analyzer analyzer)
analyzer - The new analyzer to usepublic void search(java.lang.String searchString)
searchString - Any valid lucene search stringpublic int getRowCount()
public int getColumnCount()
public java.lang.String getColumnName(int column)
getColumnName in interface javax.swing.table.TableModelgetColumnName in class javax.swing.table.AbstractTableModelpublic java.lang.Class getColumnClass(int column)
getColumnClass in interface javax.swing.table.TableModelgetColumnClass in class javax.swing.table.AbstractTableModelpublic boolean isCellEditable(int row,
int column)
isCellEditable in interface javax.swing.table.TableModelisCellEditable in class javax.swing.table.AbstractTableModelpublic java.lang.Object getValueAt(int row,
int column)
public void setValueAt(java.lang.Object aValue,
int row,
int column)
setValueAt in interface javax.swing.table.TableModelsetValueAt in class javax.swing.table.AbstractTableModelCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.