Class ComboBoxGlazedListsFilterStrategy<T>

All Implemented Interfaces:
IActivatableFilterStrategy<T>, IFilterStrategy<T>
Direct Known Subclasses:
ComboBoxGlazedListsWithExcludeFilterStrategy

public class ComboBoxGlazedListsFilterStrategy<T> extends DefaultGlazedListsStaticFilterStrategy<T>
Specialisation of the DefaultGlazedListsStaticFilterStrategy that is intended to be used in combination with FilterRowComboBoxCellEditors that allows filtering via multiselect comboboxes like in Excel. As it extends DefaultGlazedListsStaticFilterStrategy it also supports static filters which allows to integrate it with the GlazedListsRowHideShowLayer.

The special case in here is that if nothing is selected in the filter combobox, then everything should be filtered.

  • Constructor Details

    • ComboBoxGlazedListsFilterStrategy

      public ComboBoxGlazedListsFilterStrategy(FilterRowComboBoxDataProvider<T> comboBoxDataProvider, ca.odell.glazedlists.FilterList<T> filterList, IColumnAccessor<T> columnAccessor, IConfigRegistry configRegistry)
      Parameters:
      comboBoxDataProvider - The FilterRowComboBoxDataProvider needed to determine whether filters should applied or not. If there are no values specified for filtering of a column then everything should be filtered, if all possible values are given as filter then no filter needs to be applied.
      filterList - The CompositeMatcherEditor that is used for GlazedLists filtering
      columnAccessor - The IColumnAccessor needed to access the row data to perform filtering
      configRegistry - The IConfigRegistry to retrieve several configurations from
    • ComboBoxGlazedListsFilterStrategy

      public ComboBoxGlazedListsFilterStrategy(FilterRowComboBoxDataProvider<T> comboBoxDataProvider, ca.odell.glazedlists.FilterList<T> filterList, ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> matcherEditor, IColumnAccessor<T> columnAccessor, IConfigRegistry configRegistry)
      Parameters:
      comboBoxDataProvider - The FilterRowComboBoxDataProvider needed to determine whether filters should applied or not. If there are no values specified for filtering of a column then everything should be filtered, if all possible values are given as filter then no filter needs to be applied.
      filterList - The FilterList that is used within the GlazedLists based NatTable for filtering.
      matcherEditor - The CompositeMatcherEditor that should be used by this DefaultGlazedListsStaticFilterStrategy.
      columnAccessor - The IColumnAccessor necessary to access the column data of the row objects in the FilterList.
      configRegistry - The IConfigRegistry necessary to retrieve filter specific configurations.
  • Method Details

    • applyFilter

      public void applyFilter(Map<Integer,Object> filterIndexToObjectMap)
      Description copied from class: DefaultGlazedListsStaticFilterStrategy
      Create GlazedLists matcher editors and apply them to facilitate filtering. Always adds the static matchers.
      Specified by:
      applyFilter in interface IFilterStrategy<T>
      Overrides:
      applyFilter in class DefaultGlazedListsStaticFilterStrategy<T>
      Parameters:
      filterIndexToObjectMap - A Map of column indexes to filter text Strings.
    • getStringFromColumnObject

      protected String getStringFromColumnObject(int columnIndex, Object object)
      Converts the object inserted to the filter cell at the given column position to the corresponding String.

      This implementation is able to handle Collections and will generate a regular expression containing all values in the Collection.

      Overrides:
      getStringFromColumnObject in class DefaultGlazedListsFilterStrategy<T>
      Parameters:
      columnIndex - The column index of the filter cell that should be processed.
      object - The value set to the filter cell that needs to be converted
      Returns:
      The String value for the given filter value.
    • filterCollectionsEqual

      protected boolean filterCollectionsEqual(Collection filter1, Collection filter2)
    • hasComboBoxFilterEditorRegistered

      protected boolean hasComboBoxFilterEditorRegistered()
      Checks if at least one combobox cell editor is registered. Needed to the matchNone processing if the filter collection is empty.
      Returns:
      true if at least one combobox cell editor is registered, false if not.
      Since:
      2.1