com.sun.data.provider
Interface TableDataFilter

All Known Implementing Classes:
BasicTableDataFilter

public interface TableDataFilter

The TableDataFilter interface performs a filtering operation on a TableDataProvider. If a component is using an TableDataFilter, it will invoke the filter(...) method to determine which rows should be displayed in the visual (or non-visual) component.

NOTE: If a component is bound to a TableDataProvider and a TableDataFilter which are the *same* instance, the filter(...) method is never called. The filter is assumed to be intrinsic in the row data of the TableDataProvider, based on the currently set filter criteria.

Typically, an TableDataFilter implementation will iterate the contained set of FilterCriteria objects and call the match(...) method on each for each row of data in the TableDataProvider. The combination of include and/or exclude match criteria then determines wether a row is included or excluded from the filter.

Author:
Joe Nuxoll
See Also:
TableDataProvider, FilterCriteria

Method Summary
 RowKey[] filter(TableDataProvider provider, RowKey[] rows)
          Performs a filter operation on the passed set of RowKey objects.
 FilterCriteria[] getFilterCriteria()
          Returns the current filter criteria on this data filterer.
 void setFilterCriteria(FilterCriteria[] filterCriteria)
          Sets the filter criteria on this data filter.
 

Method Detail

setFilterCriteria

public void setFilterCriteria(FilterCriteria[] filterCriteria)

Sets the filter criteria on this data filter.

Parameters:
filterCriteria - An array of FilterCriteria objects defining the filter order on this TableDataFilter

getFilterCriteria

public FilterCriteria[] getFilterCriteria()

Returns the current filter criteria on this data filterer.

Returns:
FilterCriteria[] defining the filter order on this TableDataFilter

filter

public RowKey[] filter(TableDataProvider provider,
                       RowKey[] rows)
                throws DataProviderException

Performs a filter operation on the passed set of RowKey objects. Typically, the contained FilterCriteria objects will be iterated for each row and their match(...) method will be called in conjunction with their isInclude() method to determine if a row should be displayed or not.

NOTE: If a component is bound to an TableDataProvider and an TableDataFilter, which are the *same* instance, this method is never called. The filter is assumed to be intrinsic in the row data of the TableDataProvider, based on the currently set filter criteria.

Parameters:
provider - TableDataProvider containing the data on display
rows - An array of RowKey to be filtered. If this is null, then the return value should be null or an empty array of RowKeys.
Returns:
An array of RowKey representing the result of the filter operation
Throws:
DataProviderException - Implementations may wish to surface internal exceptions (nested in DataProviderException) rather than simply returning null. A DPE may also indicate that the passed TableDataProvider or RowKeys are not valid. Consult the documentation of the specific TableDataFilter implementation for details on what exceptions might be wrapped by a DPE.