Class AdvancedFilter


public class AdvancedFilter extends JBBaseFilter<AdvancedFilter>

Advanced filter component

The advanced filter component enables the user to filter a DataDescriptor by an arbitrarily complex filter criterion. The filter can either be used as a standalone component or combined with the ListGrid component.

The filter also contains an editor that enables the user to enter a basic filter criterion. You can also find the column selector, an operator selector and a filter value editor component. These make it possible to define a filter element that can be later attached to the previously created filter elements.

Alongside the editor you will find an ‘AND’ button whose purpose is to add the recently edited element to previous elements using an AND connection. The button is enabled for use only if the edited element itself is valid which means all necessary parameters have been specified. By clicking on the button the filter criterion is added to a previously selected row.

Also, an ‘OR’ button is located next to the ‘AND’ button that is enabled if the current filter criterion is valid. By clicking on the ‘OR’ button one is able to attach the recently edited filter element to the previous elements using an OR connection. This way the filter element will be displayed in a new row, also making it the currently selected row.

The filter element also contains a filter button that starts the filtering. When filtering, all elements added to the filter component are considered at the same time. The reset button enables you to remove all set filter criteria and set the filter component back to its default values.

Rows containing filter elements are located below the filter editor. All filter elements within a row are connected with an AND whereas individual rows are connected to each other using an OR operator. Thus the user is able to define a criterion up to any degree of complexity.

Filter elements in each row can be dragged and dropped over filter rows. If the user hovers with the mouse over a filter element, the filter element will display 4 buttons. Individual filter elements are disable by clicking on the buttons and they won’t be included in the filter criterion or they can even be negated, thus the filter criterion will contain the inverse of the original one. It is also possible to regain the editing of a filter element, this is when the filter criterion in the filter element is displayed again in the editor and is modified freely. The ‘AND’ and ‘OR’ buttons are not displayed, instead, a ‘Save’ button is there. By clicking on the ‘Cancel’ button the editing process is canceled and modifications are lost; the ‘Save’ button sets the previous filter element to its recently edited state.

The fourth button on the filter element deletes the element. This way the filter element is permanently removed from the filter criteria.

At the end of each row is a drop-down menu with 4 options. It is possible to enable/disable the entire filter row, meaning that all filter elements are enabled/disabled at the same time. The entire row can be negated or removed from the filter criterion. The fourth option is to copy the entire row into a new row. This way the row itself and the constituting elements are copied as well.

Setting the language or customizing the filter elements’ texts is done by inserting the following entries into a properties file:

  • filterbar.valueEditor.placeholder - Placeholder text displayed in the filter input field
  • filterbar.columnSelector.placeholder - Placeholder text displayed in the column selector menu until a column is selected or the current selection is deleted.
  • filterbar.columnSelector.tooltip - Texts displayed if the user hovers with the mouse over the column selector drop-down menu
  • filterbar.operatorSelector.placeholder - Placeholder text displayed in the operator type selection menu until a filter operator is selected or the currently selected operator is deleted.
  • filterbar.operatorSelector.tooltip - Text displayed if the user hovers with the mouse over the filter condition.
  • operator.[operator name in lowercase] - The name of the operator as displayed to the user
  • operator.short.[operator type name in lowercase] - Shortened form of operator in the filter element’s criterion text.
  • filterbar.editingWarningTitle - ‘Editing in progress’ warning header
  • filterbar.editingWarningTitle - ‘Editing in progress’ warning message
  • filterbar.menu.allOnOff - Menu item text to enable/disable all filter criteria
  • filterbar.menu.allNegate - Menu item text to negate all filter criteria
  • filterbar.menu.allRemove - Menu item text to remove the filter row
  • filterbar.menu.allCopy - Menu item text to copy the filter row
  • filterbar.andButtonTitle - Text of the ‘AND’ button
  • filterbar.orButtonTitle - Text of the ‘OR’ button
  • filterbar.cancelButtonTitle - Text of the ‘Cancel’ button
  • filterbar.saveButtonTitle - Text of the ‘Save’ button
  • filterbar.filterButtonTitle - Text of the button to start filtering
  • filterbar.clearButtonTitle - Text of the button to reset component
Find more information on setting the language here: MessageSourceAPI.

Supported events:

AnimationStart AnimationEnd, Drop, DragStart, DragEnd HotKey

Simple filter bar component
Since:
4.0
Author:
JBStrap
See Also:
  • Constructor Details

    • AdvancedFilter

      public AdvancedFilter()

      Creating the advanced filter component

    • AdvancedFilter

      public AdvancedFilter(String language)

      Creating the advanced filter component

      Parameters:
      language - Language code according to which the advanced filter component is created. If not provided or the entered value is null, the component is created using the framework’s default language. The default language of the framework is set via the JBStrap parameter DEFAULT_LANGUAGE.
    • AdvancedFilter

      public AdvancedFilter(String language, FilterBarFiltering<?> filtering)

      Creating the advanced filter component

      Parameters:
      language - Language code according to which the advanced filter component is created. If not provided or the entered value is null, the component is created using the framework’s default language. The default language of the framework is set via the JBStrap parameter DEFAULT_LANGUAGE.
      filtering - An instance of the component for which the filter criterion must be valid. The component specified here must also implement the interface FilterBarFiltering.
    • AdvancedFilter

      public AdvancedFilter(String id, String language, FilterBarFiltering<?> filtering)

      Creating the advanced filter component

      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 advanced filter component is created. If not provided or the entered value is null, the component is created using the framework’s default language. The default language of the framework is set via the JBStrap parameter DEFAULT_LANGUAGE.
      filtering - An instance of the component for which the filter criterion must be valid. The component specified here must also implement the interface FilterBarFiltering.
  • Method Details

    • setCriteria

      public AdvancedFilter setCriteria(Criteria criteria)
      Sets the filter component fulfilling the provided Criteria instance.
      Specified by:
      setCriteria in class JBBaseFilter<AdvancedFilter>
      Parameters:
      criteria - Filter criterion instance that sets the filter component
      Returns:
      The advanced filter component
    • setFilterButtonText

      public AdvancedFilter setFilterButtonText(String filterButtonText)
    • getFilterButtonText

      public String getFilterButtonText()
    • setFilterButtonIcon

      public AdvancedFilter setFilterButtonIcon(Icon icon)
    • getFilterButtonIcon

      public Icon getFilterButtonIcon()
    • setResetButtonText

      public AdvancedFilter setResetButtonText(String resetButtonText)
    • getResetButtonText

      public String getResetButtonText()
    • setResetButtonIcon

      public AdvancedFilter setResetButtonIcon(Icon icon)
    • getResetButtonIcon

      public Icon getResetButtonIcon()
    • setSaveButtonText

      public AdvancedFilter setSaveButtonText(String saveButtonText)
    • getSaveButtonText

      public String getSaveButtonText()
    • setSaveButtonIcon

      public AdvancedFilter setSaveButtonIcon(Icon icon)
    • getSaveButtonIcon

      public Icon getSaveButtonIcon()
    • setCancelButtonText

      public AdvancedFilter setCancelButtonText(String cancelButtonText)
    • getCancelButtonText

      public String getCancelButtonText()
    • setCancelButtonIcon

      public AdvancedFilter setCancelButtonIcon(Icon icon)
    • getCancelButtonIcon

      public Icon getCancelButtonIcon()