Class ComboBoxFilterRowHeaderComposite<T>

  • All Implemented Interfaces:
    IFilterRowComboUpdateListener, ILayer, ILayerListener, IPersistable

    public class ComboBoxFilterRowHeaderComposite<T>
    extends CompositeLayer
    implements IFilterRowComboUpdateListener
    CompositeLayer that is build out of the columnheader layer stack and a filter row layer. The column header layer stack needs to be provided at creation time while the filter row layer is created in here.

    The special about this ComboBoxFilterRowHeaderComposite is that it creates a filter row that behaves and looks like the Excel filter. So it doesn't provide text fields for free filtering but adds comboboxes for all columns that contain all available values for that column that can be de-/selected via checkboxes.

    • Field Detail

      • filterRowDataLayer

        protected final FilterRowDataLayer<T> filterRowDataLayer
        The FilterRowDataLayer which serves as the filter row layer.
      • filterRowVisible

        protected boolean filterRowVisible
        Flag that allows to set the filter row visible or invisible.
      • comboBoxDataProvider

        protected final FilterRowComboBoxDataProvider<T> comboBoxDataProvider
        The IComboBoxDataProvider that is used to fill the filter row comboboxes.
    • Constructor Detail

      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ca.odell.glazedlists.FilterList<T> filterList,
                                                ILayer bodyLayer,
                                                Collection<T> baseCollection,
                                                IColumnAccessor<T> bodyDataColumnAccessor,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Using this constructor will create the FilterRowComboBoxDataProvider needed for filtering and add the default ComboBoxFilterRowConfiguration.
        Parameters:
        filterList - The FilterList that will be used for filtering.
        bodyLayer - A layer in the body region. Usually the DataLayer or a layer that is responsible for list event handling. Needed for creation of the FilterRowComboBoxDataProvider.
        baseCollection - The base collection that is used to fill the body. Needed to determine the values to show in the filter comboboxes and initially pre-select them.
        bodyDataColumnAccessor - The IColumnAccessor that is needed by the IFilterStrategy to perform filtering.
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ca.odell.glazedlists.FilterList<T> filterList,
                                                ILayer bodyLayer,
                                                Collection<T> baseCollection,
                                                IColumnAccessor<T> bodyDataColumnAccessor,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry,
                                                boolean useDefaultConfiguration)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Using this constructor will create the FilterRowComboBoxDataProvider needed for filtering .
        Parameters:
        filterList - The FilterList that will be used for filtering.
        bodyLayer - A layer in the body region. Usually the DataLayer or a layer that is responsible for list event handling. Needed for creation of the FilterRowComboBoxDataProvider.
        baseCollection - The base collection that is used to fill the body. Needed to determine the values to show in the filter comboboxes and initially pre-select them.
        bodyDataColumnAccessor - The IColumnAccessor that is needed by the IFilterStrategy to perform filtering.
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
        useDefaultConfiguration - Tell whether the default configuration should be used or not. If not you need to ensure to add a configuration that adds at least the needed configuration specified in ComboBoxFilterRowConfiguration
      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ca.odell.glazedlists.FilterList<T> filterList,
                                                ILayer bodyLayer,
                                                Collection<T> baseCollection,
                                                IColumnAccessor<T> bodyDataColumnAccessor,
                                                boolean lazyLoading,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry,
                                                boolean useDefaultConfiguration)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Using this constructor will create the FilterRowComboBoxDataProvider needed for filtering .
        Parameters:
        filterList - The FilterList that will be used for filtering.
        bodyLayer - A layer in the body region. Usually the DataLayer or a layer that is responsible for list event handling. Needed for creation of the FilterRowComboBoxDataProvider.
        baseCollection - The base collection that is used to fill the body. Needed to determine the values to show in the filter comboboxes and initially pre-select them.
        bodyDataColumnAccessor - The IColumnAccessor that is needed by the IFilterStrategy to perform filtering.
        lazyLoading - Flag to configure whether the content of the comboboxes should be loaded lazily or not. Default is true
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
        useDefaultConfiguration - Tell whether the default configuration should be used or not. If not you need to ensure to add a configuration that adds at least the needed configuration specified in ComboBoxFilterRowConfiguration
      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ca.odell.glazedlists.FilterList<T> filterList,
                                                ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> matcherEditor,
                                                ILayer bodyLayer,
                                                Collection<T> baseCollection,
                                                IColumnAccessor<T> bodyDataColumnAccessor,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry,
                                                boolean useDefaultConfiguration)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Using this constructor will create the FilterRowComboBoxDataProvider needed for filtering .

        Note:This constructor should only be used in cases where it is absolutely necessary to use a custom CompositeMatcherEditor. This could be for example to create a complex NatTable instance where several filter rows need to be combined.

        Parameters:
        filterList - The FilterList that will be used for filtering.
        matcherEditor - The CompositeMatcherEditor that is set to the FilterList and needs to be used by the ComboBoxGlazedListsFilterStrategy to apply the filters via filter row.
        bodyLayer - A layer in the body region. Usually the DataLayer or a layer that is responsible for list event handling. Needed for creation of the FilterRowComboBoxDataProvider.
        baseCollection - The base collection that is used to fill the body. Needed to determine the values to show in the filter comboboxes and initially pre-select them.
        bodyDataColumnAccessor - The IColumnAccessor that is needed by the IFilterStrategy to perform filtering.
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
        useDefaultConfiguration - Tell whether the default configuration should be used or not. If not you need to ensure to add a configuration that adds at least the needed configuration specified in ComboBoxFilterRowConfiguration
      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ca.odell.glazedlists.FilterList<T> filterList,
                                                ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> matcherEditor,
                                                ILayer bodyLayer,
                                                Collection<T> baseCollection,
                                                IColumnAccessor<T> bodyDataColumnAccessor,
                                                boolean lazyLoading,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry,
                                                boolean useDefaultConfiguration)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Using this constructor will create the FilterRowComboBoxDataProvider needed for filtering .

        Note:This constructor should only be used in cases where it is absolutely necessary to use a custom CompositeMatcherEditor. This could be for example to create a complex NatTable instance where several filter rows need to be combined.

        Parameters:
        filterList - The FilterList that will be used for filtering.
        matcherEditor - The CompositeMatcherEditor that is set to the FilterList and needs to be used by the ComboBoxGlazedListsFilterStrategy to apply the filters via filter row.
        bodyLayer - A layer in the body region. Usually the DataLayer or a layer that is responsible for list event handling. Needed for creation of the FilterRowComboBoxDataProvider.
        baseCollection - The base collection that is used to fill the body. Needed to determine the values to show in the filter comboboxes and initially pre-select them.
        bodyDataColumnAccessor - The IColumnAccessor that is needed by the IFilterStrategy to perform filtering.
        lazyLoading - Flag to configure whether the content of the comboboxes should be loaded lazily or not. Default is true
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
        useDefaultConfiguration - Tell whether the default configuration should be used or not. If not you need to ensure to add a configuration that adds at least the needed configuration specified in ComboBoxFilterRowConfiguration
      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ca.odell.glazedlists.FilterList<T> filterList,
                                                FilterRowComboBoxDataProvider<T> comboBoxDataProvider,
                                                IColumnAccessor<T> bodyDataColumnAccessor,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Using this constructor will add the default ComboBoxFilterRowConfiguration.
        Parameters:
        filterList - The FilterList that will be used for filtering.
        comboBoxDataProvider - The FilterRowComboBoxDataProvider that should be used to fill the filter comboboxes.
        bodyDataColumnAccessor - The IColumnAccessor that is needed by the IFilterStrategy to perform filtering.
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ca.odell.glazedlists.FilterList<T> filterList,
                                                FilterRowComboBoxDataProvider<T> comboBoxDataProvider,
                                                IColumnAccessor<T> bodyDataColumnAccessor,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry,
                                                boolean useDefaultConfiguration)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Will use the given FilterList for creating the ComboBoxGlazedListsFilterStrategy and the given FilterRowComboBoxDataProvider instead of creating a new one.
        Parameters:
        filterList - The FilterList that will be used for filtering.
        comboBoxDataProvider - The FilterRowComboBoxDataProvider that should be used to fill the filter comboboxes.
        bodyDataColumnAccessor - The IColumnAccessor that is needed by the IFilterStrategy to perform filtering.
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
        useDefaultConfiguration - Tell whether the default configuration should be used or not. If not you need to ensure to add a configuration that adds at least the needed configuration specified in ComboBoxFilterRowConfiguration
      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ca.odell.glazedlists.FilterList<T> filterList,
                                                ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> matcherEditor,
                                                FilterRowComboBoxDataProvider<T> comboBoxDataProvider,
                                                IColumnAccessor<T> bodyDataColumnAccessor,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry,
                                                boolean useDefaultConfiguration)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Will use the given FilterList and MatcherEditor for creating the ComboBoxGlazedListsFilterStrategy and the given FilterRowComboBoxDataProvider instead of creating a new one.

        Note:This constructor should only be used in cases where it is absolutely necessary to use a custom CompositeMatcherEditor. This could be for example to create a complex NatTable instance where several filter rows need to be combined.

        Parameters:
        filterList - The FilterList that will be used for filtering.
        matcherEditor - The CompositeMatcherEditor that is set to the FilterList and needs to be used by the ComboBoxGlazedListsFilterStrategy to apply the filters via filter row.
        comboBoxDataProvider - The FilterRowComboBoxDataProvider that should be used to fill the filter comboboxes.
        bodyDataColumnAccessor - The IColumnAccessor that is needed by the IFilterStrategy to perform filtering.
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
        useDefaultConfiguration - Tell whether the default configuration should be used or not. If not you need to ensure to add a configuration that adds at least the needed configuration specified in ComboBoxFilterRowConfiguration
      • ComboBoxFilterRowHeaderComposite

        public ComboBoxFilterRowHeaderComposite​(ComboBoxGlazedListsFilterStrategy<T> filterStrategy,
                                                FilterRowComboBoxDataProvider<T> comboBoxDataProvider,
                                                ILayer columnHeaderLayer,
                                                IDataProvider columnHeaderDataProvider,
                                                IConfigRegistry configRegistry,
                                                boolean useDefaultConfiguration)
        Creates a new ComboBoxFilterRowHeaderComposite based on the given informations. Will use the given ComboBoxGlazedListsFilterStrategy instead of creating a new one.
        Parameters:
        filterStrategy - The ComboBoxGlazedListsFilterStrategy that should be used for filtering.
        comboBoxDataProvider - The FilterRowComboBoxDataProvider that should be used to fill the filter comboboxes.
        columnHeaderLayer - The columnheader layer the filter row layer is related to. Needed for building this CompositeLayer, dimensionally connect the filter row to and retrieve information and perform actions related to filtering.
        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 various configurations.
        useDefaultConfiguration - Tell whether the default configuration should be used or not. If not you need to ensure to add a configuration that adds at least the needed configuration specified in ComboBoxFilterRowConfiguration
    • Method Detail

      • 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
        Overrides:
        loadState in class CompositeLayer
        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.
      • getFilterRowDataLayer

        public FilterRowDataLayer<T> getFilterRowDataLayer()
        Returns:
        The FilterRowDataLayer which serves as the filter row layer.
      • getMatcherEditor

        public ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> getMatcherEditor()
        Returns:
        The CompositeMatcherEditor that is used for filtering. As this one is filled with MatcherEditors by the IFilterStrategy, direct modifications may be overridden on changing cell values in the filter row.
      • getFilterStrategy

        public ComboBoxGlazedListsFilterStrategy<T> getFilterStrategy()
        Returns the IFilterStrategy that is used by this ComboBoxFilterRowHeaderComposite. This is needed to integrate static filters, e.g. using GlazedListsRowHideShowLayer together with this ComboBoxFilterRowHeaderComposite by adding the MatcherEditor as static filter to the ComboBoxGlazedListsFilterStrategy.
        Returns:
        The IFilterStrategy that is used by this ComboBoxFilterRowHeaderComposite.
      • getComboBoxDataProvider

        public FilterRowComboBoxDataProvider<T> getComboBoxDataProvider()
        Returns:
        The IComboBoxDataProvider that is used to fill the filter row comboboxes.
      • isFilterRowVisible

        public boolean isFilterRowVisible()
        Returns:
        true if the filter row is visible, false if not.
      • setFilterRowVisible

        public void setFilterRowVisible​(boolean filterRowVisible)
        Sets the visibility state of the filter row.
        Parameters:
        filterRowVisible - true to set the filter row visible, false to hide it.
      • setAllValuesSelected

        public void setAllValuesSelected()
        Sets all values for all comboboxes as selected. This is needed because selecting all items in the comboboxes mean to have no filter applied.

        Note: The filter row IDataProvider is filled by modifying the Map of filter objects directly instead of calling setDataValue(). This is because calling setDataValue() will transform indexes which is not necessary on initialization and causes strange behaviour in some compositions.

      • getHeight

        public int getHeight()
        Description copied from interface: ILayer
        Returns the total height in pixels of this layer.
        Specified by:
        getHeight in interface ILayer
        Overrides:
        getHeight in class CompositeLayer
        Returns:
        The total height in pixels of this layer.
      • doCommand

        public boolean doCommand​(ILayerCommand command)
        Description copied from class: CompositeLayer
        Opportunity to respond to a command as it flows down the stack. If the layer is not interested in the command it should allow the command to keep traveling down the stack.

        Note: Before the layer can process a command it must convert the command to its local coordinates using ILayerCommand.convertToTargetLayer(ILayer) Handle commands

        Specified by:
        doCommand in interface ILayer
        Overrides:
        doCommand in class CompositeLayer
        Parameters:
        command - The command to execute.
        Returns:
        true if the command has been handled and was therefore consumed, false otherwise.