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
Modifier and TypeFieldDescriptionstatic final String
Replacement for the comma character , that is used for persisting collection values in case of combobox filters.static final String
Replacement for an empty String value that is used for persisting collection values in case of combobox filters.static final String
The prefix String that will be used to mark that the following filter value in the persisted state is a collection.static final String
Replacement for the null value that is used for persisting collection values in case of combobox filters.static final String
Replacement 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
ConstructorDescriptionFilterRowDataProvider
(IFilterStrategy<T> filterStrategy, ILayer columnHeaderLayer, IDataProvider columnHeaderDataProvider, IConfigRegistry configRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear all filters that are currently applied.int
getDataValue
(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.int
void
loadState
(String prefix, Properties properties) Restore the state out of the given Properties identified by the specified prefix.void
saveState
(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.void
setDataValue
(int columnIndex, int rowIndex, Object newValue) Sets the value at the given column and row index.void
setFilterIndexToObjectMap
(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.void
setFilterRowComboBoxDataProvider
(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
- TheIFilterStrategy
to which the set filter value should be applied.columnHeaderLayer
- The column header layer where thisIDataProvider
is used for filtering needed for retrieval of column indexes and firing according filter events..columnHeaderDataProvider
- TheIDataProvider
of the column header needed to retrieve the real column count of the column header and not a transformed one.configRegistry
- TheIConfigRegistry
needed to retrieve theIDisplayConverter
for 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:
getColumnCount
in interfaceIDataProvider
- Returns:
- The number of columns this
IDataProvider
handles.
-
getDataValue
Description copied from interface:IDataProvider
Gets the value at the given column and row index.- Specified by:
getDataValue
in 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:
getRowCount
in interfaceIDataProvider
- Returns:
- The number of rows this
IDataProvider
handles.
-
setDataValue
Description copied from interface:IDataProvider
Sets the value at the given column and row index. Optional operation. Should throw UnsupportedOperationException if this operation is not supported.- Specified by:
setDataValue
in 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:IPersistable
Saves 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:
saveState
in 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:IPersistable
Restore 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:
loadState
in 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
IFilterStrategy
to which the set filter value should be applied. - Since:
- 2.1
-
setFilterRowComboBoxDataProvider
- Parameters:
comboBoxDataProvider
- TheFilterRowComboBoxDataProvider
that 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. Passingnull
will result in the default persistence.- Since:
- 2.1
-