Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.search
Class TableSelector

java.lang.Object
  extended by com.citra.table.search.TableSelector
All Implemented Interfaces:
SearchModelListener, EventListener

public class TableSelector
extends Object
implements SearchModelListener

A simple SearchModelListener implementation for selecting the matching cells of a table when searching.


Field Summary
protected  TableModel searchModel
          the search model
protected  JTable table
          the associated table
 
Constructor Summary
TableSelector(JTable table)
          Constructs a TableSelector.
 
Method Summary
 TableModel getSearchModel()
          Retrieves the tabular search model to use when searching.
 void search(SearchModelEvent e)
          Called whenever searching of a table has been requested.
 void setSearchModel(TableModel searchModel)
          Assigns the tabular search model to use when searching.
 void setTable(JTable table)
          Assigns the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected JTable table
the associated table


searchModel

protected TableModel searchModel
the search model

Constructor Detail

TableSelector

public TableSelector(JTable table)
Constructs a TableSelector.

Method Detail

getSearchModel

public TableModel getSearchModel()
Retrieves the tabular search model to use when searching. see setSearchModel.

Returns:
the search model

search

public void search(SearchModelEvent e)
Called whenever searching of a table has been requested.

Specified by:
search in interface SearchModelListener
Parameters:
e - the SearchModelEvent object

setSearchModel

public void setSearchModel(TableModel searchModel)
Assigns the tabular search model to use when searching. The model is passed as parameter to a Search object that performs the task. The results thus depend on the values returned by the model (the getValueAt method).
Also significant is the model's row and column count, which can be both altered so that a smaller area is searched.

The default model is one that returns the values of the table, by calling the table's getValueAt method.

Parameters:
searchModel - the model to assign

setTable

public void setTable(JTable table)
Assigns the table.

Parameters:
table - the table to assign

Copyright © 2011 Citra Technologies. All Rights Reserved.