Class FilterRowDataProvider<T>

  • All Implemented Interfaces:
    IDataProvider, IPersistable

    public class FilterRowDataProvider<T>
    extends Object
    implements 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 Detail

      • PIPE_REPLACEMENT

        public static final String 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:
        Constant Field Values
      • FILTER_COLLECTION_PREFIX

        public static final String 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:
        Constant Field Values
    • Constructor Detail

      • FilterRowDataProvider

        public FilterRowDataProvider​(IFilterStrategy<T> filterStrategy,
                                     ILayer columnHeaderLayer,
                                     IDataProvider columnHeaderDataProvider,
                                     IConfigRegistry configRegistry)
        Parameters:
        filterStrategy - The IFilterStrategy to which the set filter value should be applied.
        columnHeaderLayer - The column header layer where this IDataProvider is used for filtering needed for retrieval of column indexes and firing according filter events..
        columnHeaderDataProvider - The IDataProvider of the column header needed to retrieve the real column count of the column header and not a transformed one.
        configRegistry - The IConfigRegistry needed to retrieve the IDisplayConverter for converting the values on state save/load operations.
    • Method Detail

      • getFilterIndexToObjectMap

        public Map<Integer,​Object> 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) or clearAllFilters() 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

        public 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.

        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.
      • getDataValue

        public Object getDataValue​(int columnIndex,
                                   int rowIndex)
        Description copied from interface: IDataProvider
        Gets the value at the given column and row index.
        Specified by:
        getDataValue in interface IDataProvider
        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.
      • setDataValue

        public void setDataValue​(int columnIndex,
                                 int rowIndex,
                                 Object newValue)
        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 interface IDataProvider
        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

        public void saveState​(String prefix,
                              Properties properties)
        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 interface IPersistable
        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

        public void loadState​(String prefix,
                              Properties properties)
        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 interface IPersistable
        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.