Class DynamicTableFilterProvider

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void afterFiltering()
      Called once after filtering.
      void beforeFiltering​(java.lang.String filterExpression, java.util.List<java.lang.Object> allRecords)
      Invoked once before filtering begins, allowing for up front work to be performed that might then be leveraged in subsequent calls to keepRecord(int, boolean, String, Object, Map).
      abstract boolean handlesExpression​(java.lang.String filterExpression)
      Whether this filter provider handles the given filter expression.
      abstract boolean keepRecord​(int sourceIndex, boolean isChecked, java.lang.String filterExpression, java.lang.Object record, java.util.Map<java.lang.String,​java.lang.Object> rowValues)
      If handlesExpression(String) returns true, this method will be invoked for each record.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DynamicTableFilterProvider

        public DynamicTableFilterProvider()
    • Method Detail

      • handlesExpression

        public abstract boolean handlesExpression​(java.lang.String filterExpression)
        Whether this filter provider handles the given filter expression. If true is returned, keepRecord(int, boolean, String, Object, Map) will be called for each record to determine whether the given record is filtered out or not. If false is returned then the dynamic table model will continue looking for a filter handler. Filter expression should never be null or an all whitespace or empty string since DynamicTableModel has built in logic to handle that before asking filters.
        Parameters:
        filterExpression - The expression the user has provided.
        Returns:
        True if this filter should handle this expression. False otherwise.
      • keepRecord

        public abstract boolean keepRecord​(int sourceIndex,
                                           boolean isChecked,
                                           java.lang.String filterExpression,
                                           java.lang.Object record,
                                           java.util.Map<java.lang.String,​java.lang.Object> rowValues)
        If handlesExpression(String) returns true, this method will be invoked for each record. It should return true for records that should make it into the final collection and false for records that should be filtered out.
        Parameters:
        sourceIndex - The index of the record in the full un-filtered source collection.
        isChecked - Whether the given record is currently checked
        filterExpression - The filter expression provided by the user. This value should never be null, only whitespace or empty.
        record - The record to inspect and make a decision about.
        rowValues - A map of the values actual represented as columns in the table. Relies on table model's DynamicTableValueCallback.
        Returns:
        True to keep the record, false to filter it out.
      • beforeFiltering

        public void beforeFiltering​(java.lang.String filterExpression,
                                    java.util.List<java.lang.Object> allRecords)
        Invoked once before filtering begins, allowing for up front work to be performed that might then be leveraged in subsequent calls to keepRecord(int, boolean, String, Object, Map). Override in derived implementation, default implementation does nothing.
        Parameters:
        filterExpression - The filter expression that was provided
        allRecords - All the of records pre-filtering