Class SimpleFilter


public class SimpleFilter extends JBBaseFilter<SimpleFilter>

Simple filter component

The user is able to filter the data in a column by using the simple filter component. No advanced filter expressions can be entered as only one column is filtered.

The user is able to select one of the component's columns from the dropdown menu and a filter operator from another dropdown menu, containing the operators available for the specific column. In a further input field, the filter expression is entered. This input field is automatically replaced according to the selected column and selected operator type in order for the user to enter the filter value with a proper input field type.

The filter component has two further buttons to execute the search and to set the filter to default. Filtering can only be performed only if all the necessary information is available. As long as the user is editing the filter expression and the expression is incomplete, the filter start button remains inactive.

Texts on the filter component may be localized or customized by saving the following entries in a properties file:

  • filterbar.valueEditor.placeholder - Placeholder text in the filter value input field
  • filterbar.columnSelector.placeholder - Placeholder text displayed in the column selector dropdown menu as long as the user selects a column or deletes the selected column
  • filterbar.columnSelector.tooltip - Text displayed when the user hovers with the mouse over the column select dropdown menu
  • filterbar.operatorSelector.placeholder - Placeholder text displayed in the operator type selecion menu as long as the user selects a filter operator or deletes the selected operator.
  • filterbar.operatorSelector.tooltip - Text displayed when the user hovers with the mouse over the filter operator selecion menu
  • operator.[Operator name in lowercase] - Operator name visible to the user on the interface
  • filterbar.filterButtonTitle - Button text for the filter start button
  • filterbar.clearButtonTitle - Text of the button which resets the filter to default
Further details on language settings in the description of MessageSourceAPI.

Supported events:

AnimationStart AnimationEnd, Drop, DragStart, DragEnd HotKey

Since:
4.0
Author:
JBStrap
See Also:
  • Constructor Details

    • SimpleFilter

      public SimpleFilter()
      Creates the simple filter component
    • SimpleFilter

      public SimpleFilter(String language)
      Creates the simple filter component according the language setting
      Parameters:
      language - Language code according to which the component is created. If not provided or the entered value is null, the filter component will be created according to the default language setting of the framework. The default language is specified by the JBStrap parameter DEFAULT_LANGUAGE.
    • SimpleFilter

      public SimpleFilter(String language, FilterBarFiltering<?> filtering)
      Creates the simple filter component according the language setting
      Parameters:
      language - Language code according to which the component is created. If not provided or the entered value is null, the filter component will be created according to the default language setting of the framework. The default language is specified by the JBStrap parameter DEFAULT_LANGUAGE.
      filtering - Component instance to be filtered. The component given here must implement the interface FilterBarFiltering.
    • SimpleFilter

      public SimpleFilter(String id, String language, FilterBarFiltering<?> filtering)
      Creates the simple filter component according the language setting
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      language - Language code according to which the component is created. If not provided or the entered value is null, the filter component will be created according to the default language setting of the framework. The default language is specified by the JBStrap parameter DEFAULT_LANGUAGE.
      filtering - Component instance to be filtered. The component given here must implement the interface FilterBarFiltering.
  • Method Details

    • setCriteria

      public SimpleFilter setCriteria(Criteria criteria)
      Sets the filter component according to the filter expression given. The method sets the component into such a state as if the filter expression had been written by the user. If null is provided, the filter component is set to default.
      Specified by:
      setCriteria in class JBBaseFilter<SimpleFilter>
      Parameters:
      criteria - The Criteria instance according to which the component is set
      Returns:
      Simple filter component
      Throws:
      IllegalArgumentException - Thrown if the simple filter component is passed an advanced filter expression as a parameter.
    • setFilterButtonText

      public SimpleFilter setFilterButtonText(String filterButtonText)
    • getFilterButtonText

      public String getFilterButtonText()
    • setFilterButtonIcon

      public SimpleFilter setFilterButtonIcon(Icon icon)
    • getFilterButtonIcon

      public Icon getFilterButtonIcon()
    • setResetButtonText

      public SimpleFilter setResetButtonText(String resetButtonText)
    • getResetButtonText

      public String getResetButtonText()
    • setResetButtonIcon

      public SimpleFilter setResetButtonIcon(Icon icon)
    • getResetButtonIcon

      public Icon getResetButtonIcon()