package com.onaro.util.jfc.tables.filter; import javax.swing.table.TableModel; /** * Common interface for filter models that can be used with FilterTable. * @author jmyers */ public interface IFilterModel { /** * Check whether any filtering is active on the model. * @return true if there is a filter in effect, false otherwise */ boolean isAnyFilterActive(); /** * Check whether the column at the given index can be filtered. * @param columnIndex the column index * @return true if the column can be filtered, false otherwise */ boolean isFilterable(int columnIndex); /** * Check to see if the column at the given index is currently filtered. * @param columnIndex the column index * @return true if the column's filter is active, false otherwise */ boolean isFilterActive(int columnIndex); /** * Check to see if the column at the given index has a valid filter pattern set. * @param columnIndex the column index * @return true if the column's filter pattern is valid, false otherwise */ boolean isFilterValid(int columnIndex); /** * Retrieve the filter in use for the column at the given index. * @param columnIndex the column index * @return the filter that is used for the column, null if no filter associated with the column */ Filter getFilter(int columnIndex); /** * Retrieve the tooltip to display for the filter for the column at the given index. * @param columnIndex the column index * @return the tooltip to display for the filter, null if no filter tooltip is relevant */ String getFilterTooltip(int columnIndex); /** * Retrieve the pattern used for the filter for the column at the given index. * @param columnIndex the column index * @return the filter pattern object, null if there is no pattern set for the filter */ Object getFilterPattern(int columnIndex); /** * Set the pattern used for the filter for the column at the given index. * @param columnIndex the column index * @param pattern the filter pattern to set */ void setFilterPattern(int columnIndex, Object pattern); /** * Clear the filter patterns for all filters present in the filter model. */ void resetAllFilters(); /** * Retrieve the number of rows from the encapsulated model that are accepted with the current * filtering configuration. * @return the number of accepted rows */ int getFilteredRowCount(); /** * Retrieve the number of rows in the encapsulated model, pre-filtering. * @return the unfiltered row count */ int getUnfilteredRowCount(); /** * Translate the given filter row index to the corresponding index in the encapsulated model. * @param row the filter row index * @return the row index in the encapsulated model */ int getRowInEncapsulatedModel(int row); /** * Retrieve the encapsulated model that is filtered by this filter model. * @return the encapsulated model */ TableModel getEncapsulatedTableModel(); /** * Add a listener to listen for changes to filter patterns used by this model. * @param listener the filter pattern listener */ void addFilterPatternEventListener(FilterPatternEventListener listener); /** * Remove a listener to listen for changes to filter patterns used by this model. * @param listener the filter pattern listener */ void removeFilterPatternEventListener(FilterPatternEventListener listener); }