Class FilterRowDataProvider<T>
java.lang.Object
org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataProvider<T>
- All Implemented Interfaces:
IDataProvider,IPersistable
Data provider for the filter row
- Stores filter strings
- Applies them to the ca.odell.glazedlists.matchers.MatcherEditor on the ca.odell.glazedlists.FilterList
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReplacement for the comma character , that is used for persisting collection values in case of combobox filters.static final StringReplacement for an empty String value that is used for persisting collection values in case of combobox filters.static final StringThe prefix String that will be used to mark that the following filter value in the persisted state is a collection.static final StringReplacement for the null value that is used for persisting collection values in case of combobox filters.static final StringReplacement for the pipe character | that is used for persistence.Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionFilterRowDataProvider(IFilterStrategy<T> filterStrategy, ILayer columnHeaderLayer, IDataProvider columnHeaderDataProvider, IConfigRegistry configRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all filters that are currently applied.intgetDataValue(int columnIndex, int rowIndex) Gets the value at the given column and row index.Returns the map that contains the filter objects mapped to the column index.intvoidloadState(String prefix, Properties properties) Restore the state out of the given Properties identified by the specified prefix.voidsaveState(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.voidsetDataValue(int columnIndex, int rowIndex, Object newValue) Sets the value at the given column and row index.voidsetFilterIndexToObjectMap(Map<Integer, Object> filterIndexToObjectMap) Set the map that contains the filter objects mapped to the column index to be the data storage for the inserted filters into the filter row by the user.voidsetFilterRowComboBoxDataProvider(FilterRowComboBoxDataProvider<T> comboBoxDataProvider)
-
Field Details
-
PIPE_REPLACEMENT
Replacement for the pipe character | that is used for persistence. If regular expressions are used for filtering, the pipe character can be used in the regular expression to specify alternations. As the persistence mechanism in NatTable uses the pipe character for separation of values, the persistence breaks for such cases. By replacing the pipe in the regular expression with some silly uncommon value specified here, we ensure to be able to also persist pipes in the regular expressions, as well as being backwards compatible with already saved filter row states.- See Also:
-
COMMA_REPLACEMENT
Replacement for the comma character , that is used for persisting collection values in case of combobox filters.- Since:
- 2.1
- See Also:
-
NULL_REPLACEMENT
Replacement for the null value that is used for persisting collection values in case of combobox filters. Needed for the inverted persistence in case there are null values in the collection that need to be persisted.- Since:
- 2.1
- See Also:
-
EMPTY_REPLACEMENT
Replacement for an empty String value that is used for persisting collection values in case of combobox filters. Needed for the inverted persistence in case there are empty String values in the collection that need to be persisted.- Since:
- 2.1
- See Also:
-
FILTER_COLLECTION_PREFIX
The prefix String that will be used to mark that the following filter value in the persisted state is a collection.- See Also:
-
-
Constructor Details
-
FilterRowDataProvider
public FilterRowDataProvider(IFilterStrategy<T> filterStrategy, ILayer columnHeaderLayer, IDataProvider columnHeaderDataProvider, IConfigRegistry configRegistry) - Parameters:
filterStrategy- TheIFilterStrategyto which the set filter value should be applied.columnHeaderLayer- The column header layer where thisIDataProvideris used for filtering needed for retrieval of column indexes and firing according filter events..columnHeaderDataProvider- TheIDataProviderof the column header needed to retrieve the real column count of the column header and not a transformed one.configRegistry- TheIConfigRegistryneeded to retrieve theIDisplayConverterfor converting the values on state save/load operations.
-
-
Method Details
-
getFilterIndexToObjectMap
Returns the map that contains the filter objects mapped to the column index. It is the data storage for the inserted filters into the filter row by the user.Note: Usually it is not intended to modify this Map directly. You should rather call
setDataValue(int, int, Object)orclearAllFilters()to modify this Map to ensure consistency in other framework code. It is made visible because there might be code that needs to modify the Map without index transformations or firing events.- Returns:
- Map that contains the filter objects mapped to the column index.
-
setFilterIndexToObjectMap
Set the map that contains the filter objects mapped to the column index to be the data storage for the inserted filters into the filter row by the user.Note: Usually it is not intended to set this Map from the outside as it is created in the constructor. But there might be use cases where you e.g. need to connect filter rows to each other. In this case it might be useful to override the local Map with the one form another FilterRowDataProvider. This is not a typical use case, therefore you should use this method carefully!
- Parameters:
filterIndexToObjectMap- Map that contains the filter objects mapped to the column index.
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCountin interfaceIDataProvider- Returns:
- The number of columns this
IDataProviderhandles.
-
getDataValue
Description copied from interface:IDataProviderGets the value at the given column and row index.- Specified by:
getDataValuein interfaceIDataProvider- Parameters:
columnIndex- The column index of the cell whose value is requested.rowIndex- The row index of the cell whose value is requested.- Returns:
- The data value associated with the specified cell coordintates.
-
getRowCount
public int getRowCount()- Specified by:
getRowCountin interfaceIDataProvider- Returns:
- The number of rows this
IDataProviderhandles.
-
setDataValue
Description copied from interface:IDataProviderSets the value at the given column and row index. Optional operation. Should throw UnsupportedOperationException if this operation is not supported.- Specified by:
setDataValuein interfaceIDataProvider- Parameters:
columnIndex- The column index of the cell whose value should be changed.rowIndex- The row index of the cell whose value should be changed.newValue- The new value that should be set.
-
saveState
Description copied from interface:IPersistableSaves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.- Specified by:
saveStatein interfaceIPersistable- Parameters:
prefix- The prefix to use for the state keys. Is also used as the state configuration name.properties- The Properties instance to save the state to.
-
loadState
Description copied from interface:IPersistableRestore the state out of the given Properties identified by the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.- Specified by:
loadStatein interfaceIPersistable- Parameters:
prefix- The prefix to use for the state keys. Is also used as the state configuration name.properties- The Properties instance to load the state from.
-
clearAllFilters
public void clearAllFilters()Clear all filters that are currently applied. -
getFilterStrategy
- Returns:
- The
IFilterStrategyto which the set filter value should be applied. - Since:
- 2.1
-
setFilterRowComboBoxDataProvider
- Parameters:
comboBoxDataProvider- TheFilterRowComboBoxDataProviderthat should be used to support inverted persistence of filter collections. By default the values in the collection are persisted as is. In case of Excel like filters, it can be more feasible to store which values are NOT selected, to be able to load the filter even for different values in the filter list. Passingnullwill result in the default persistence.- Since:
- 2.1
-