Interface Filter

All Superinterfaces:
ActionsHolder, Collapsable, Component, Component.BelongToFrame, Component.HasCaption, Component.HasDescription, Component.HasIcon, HasContextHelp, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, HasSubParts, SupportsCaptionPosition, SupportsColumnsCount
All Known Implementing Classes:
FilterImpl

@StudioComponent(caption="Filter", category="Components", xmlElement="filter", icon="io/jmix/ui/icon/component/filter.svg", canvasBehaviour=FILTER, documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/vcl/components/filter.html") public interface Filter extends Component, Component.BelongToFrame, Component.HasDescription, Component.HasCaption, Component.HasIcon, HasHtmlCaption, HasHtmlDescription, HasContextHelp, HasHtmlSanitizer, Collapsable, ActionsHolder, SupportsCaptionPosition, SupportsColumnsCount
Generic filter component.
  • Field Details

  • Method Details

    • getColumnsCount

      int getColumnsCount()
      Returns the number of columns to be displayed on one row. The default value is taken from UiComponentProperties.getFilterColumnsCount().
      Specified by:
      getColumnsCount in interface SupportsColumnsCount
      Returns:
      the number of columns to be displayed on one row
    • setColumnsCount

      @StudioProperty @Positive void setColumnsCount(int columnsCount)
      Sets the number of columns to be displayed on one row. The default value is taken from UiComponentProperties.getFilterColumnsCount().
      Specified by:
      setColumnsCount in interface SupportsColumnsCount
      Parameters:
      columnsCount - the number of columns to be displayed on one row
    • getPropertiesFilterPredicate

      @Nullable Predicate<MetaPropertyPath> getPropertiesFilterPredicate()
      Returns:
      a properties filter predicate
    • setPropertiesFilterPredicate

      void setPropertiesFilterPredicate(@Nullable Predicate<MetaPropertyPath> propertiesFilterPredicate)
      Sets a predicate that tests whether a property with the given path should be available for filtering.
      Parameters:
      propertiesFilterPredicate - a predicate to set
    • addPropertiesFilterPredicate

      void addPropertiesFilterPredicate(Predicate<MetaPropertyPath> propertiesFilterPredicate)
      Adds a predicate to the current properties filter predicate. The result predicate is a composed predicate that represents a short-circuiting logical AND of given predicate and current properties filter predicate.
      Parameters:
      propertiesFilterPredicate - a predicate to add
    • getDataLoader

      DataLoader getDataLoader()
      Returns:
      a DataLoader related to the filter
    • setDataLoader

      @StudioProperty(type=DATALOADER_REF) void setDataLoader(DataLoader dataLoader)
      Sets a DataLoader related to the filter.
      Parameters:
      dataLoader - a DataLoader to set
    • isAutoApply

      boolean isAutoApply()
      Returns:
      true if the filter should be automatically applied to the DataLoader when the value component value is changed
    • setAutoApply

      @StudioProperty void setAutoApply(boolean autoApply)
      Sets whether the filter should be automatically applied to the DataLoader when the value component value is changed.
      Parameters:
      autoApply - true if the filter should be automatically applied to the DataLoader when the value component value is changed
    • getShortcutCombination

      @Nullable KeyCombination getShortcutCombination()
      Returns:
      apply Filter key combination
    • setApplyShortcutCombination

      void setApplyShortcutCombination(@Nullable KeyCombination applyShortcut)
      Sets shortcut combination for apply Filter.
      Parameters:
      applyShortcut - key combination
    • setApplyShortcut

      @StudioProperty(type=SHORTCUT) void setApplyShortcut(@Nullable String applyShortcut)
      Sets shortcut for apply Filter from string representation.
      Parameters:
      applyShortcut - string of type "Modifiers-Key", e.g. "Alt-N". Case-insensitive
    • apply

      void apply()
      Applies the current configuration.
    • getCaptionPosition

      Specified by:
      getCaptionPosition in interface SupportsCaptionPosition
      Returns:
      caption position of filter child components
    • setCaptionPosition

      void setCaptionPosition(SupportsCaptionPosition.CaptionPosition position)
      Sets caption position of filter child components.
      Specified by:
      setCaptionPosition in interface SupportsCaptionPosition
      Parameters:
      position - caption position of filter child components
    • getCaptionWidth

      float getCaptionWidth()
      Returns:
      caption width of filter child components
    • getCaptionWidthSizeUnit

      SizeUnit getCaptionWidthSizeUnit()
      Returns:
      caption width size unit of filter child components
    • setCaptionWidth

      void setCaptionWidth(String width)
      Sets caption width of filter child components.
      Parameters:
      width - caption width of filter child components
    • addConfiguration

      DesignTimeConfiguration addConfiguration(String id, @Nullable String name)
      Adds design-time configuration with given id and name. A configuration is a set of FilterComponents. The configuration does not store a reference to all components, but stores a reference only to the root element LogicalFilterComponent from which the rest FilterComponents can be obtained. The root LogicalFilterComponent is generated with a LogicalFilterComponent.Operation.AND operation.

      The configuration defined in XML is a DesignTimeConfiguration.

      Parameters:
      id - a configuration id. Must be unique within this filter
      name - a configuration name
      Returns:
      DesignTimeConfiguration
      See Also:
    • addConfiguration

      DesignTimeConfiguration addConfiguration(String id, @Nullable String name, LogicalFilterComponent.Operation rootOperation)
      Adds design-time configuration with given id and name. A configuration is a set of FilterComponents. The configuration does not store a reference to all components, but stores a reference only to the root element LogicalFilterComponent from which the rest FilterComponents can be obtained. The root LogicalFilterComponent is generated with a given operation.

      The configuration defined in XML is a DesignTimeConfiguration.

      Parameters:
      id - a configuration id. Must be unique within this filter
      name - a configuration name
      rootOperation - an operation of root LogicalFilterComponent
      Returns:
      DesignTimeConfiguration
    • addConfiguration

      @StudioElementsGroup(xmlElement="configurations", caption="Configurations", documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/vcl/components/filter.html#configuration", icon="io/jmix/ui/icon/element/configurations.svg") void addConfiguration(Filter.Configuration configuration)
      Adds a configuration to the filter.
      Parameters:
      configuration - configuration to add
      See Also:
    • removeConfiguration

      void removeConfiguration(Filter.Configuration configuration)
      Removes a configuration from filter.
      Parameters:
      configuration - configuration to remove
    • setCurrentConfiguration

      void setCurrentConfiguration(Filter.Configuration currentConfiguration)
      Sets the given configuration as current and displays filter components from the current configuration.
      Parameters:
      currentConfiguration - a configuration
    • getCurrentConfiguration

      Filter.Configuration getCurrentConfiguration()
      Gets the current configuration that is currently displayed inside the filter.
      Returns:
      a current configuration
    • getConfiguration

      @Nullable Filter.Configuration getConfiguration(String id)
      Gets a configuration by id.
      Parameters:
      id - the configuration id
      Returns:
      the configuration of null if not found
    • getEmptyConfiguration

      Filter.Configuration getEmptyConfiguration()
      Gets an empty configuration that is used when the user has not selected any of the existing configurations.
      Returns:
      an empty configuration
    • getConfigurations

      List<Filter.Configuration> getConfigurations()
      Returns:
      a list of all configurations related to the filter
    • addCondition

      @StudioElementsGroup(xmlElement="conditions", caption="Conditions", documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/vcl/components/filter.html#add-condition", icon="io/jmix/ui/icon/element/conditions.svg") void addCondition(FilterComponent filterComponent)
      Adds a condition to the filter. A condition is a FilterComponent that is not initially added to any of the configurations, but the user can select this component in the AddConditionScreen in the Conditions section and add it to the RunTimeConfiguration.
      Parameters:
      filterComponent - a filter component to add to conditions
      See Also:
    • getConditions

      List<FilterComponent> getConditions()
      Returns:
      a list of all conditions related to the filter
    • removeCondition

      void removeCondition(FilterComponent filterComponent)
      Removes a condition from filter.
      Parameters:
      filterComponent - a filter component to remove from conditions
    • addConfigurationChangeListener

      Subscription addConfigurationChangeListener(Consumer<Filter.ConfigurationChangeEvent> listener)
      Adds a listener that is invoked when the Filter.Configuration changes.
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • loadConfigurationsAndApplyDefault

      void loadConfigurationsAndApplyDefault()
      Loads configurations for Filter and apply default. NOTE: call this method after the frame is fully initialized (for example, in ComponentLoader.InitTask in a loader).
    • refreshCurrentConfigurationLayout

      void refreshCurrentConfigurationLayout()
      Refreshes the display of the current configuration. Allows the user to refresh the display after changing the current configuration.