Class 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
MessageSourceAPI
.
Supported events:
AnimationStart
AnimationEnd
,
Drop
,
DragStart
,
DragEnd
HotKey
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jbstrap.ui.components.filter.BaseFilter
BaseFilter.ColumnParams
-
Field Summary
Fields inherited from class com.jbstrap.ui.components.filter.JBBaseFilter
ADVANCED, cancelButtonIcon, cancelButtonText, currentCriteria, defaultWorldOperator, filterButtonIcon, filterButtonText, filteredColumn, HIDDEN_OPERATORS, resetButtonIcon, resetButtonText, saveButtonIcon, saveButtonText, SIMPLE, TEXT
Fields inherited from class com.jbstrap.ui.components.filter.BaseFilter
columns, defaultEditor, ds, filtering, postInitScript, type
Fields inherited from class com.jbstrap.ui.Component
animation, attributes, backgroundColor, borderColor, color, defaultHotKeyHandler, handlers, hotKeys, styleClasses, textAlign, toolTip, toolTipPosition
-
Constructor Summary
ConstructorDescriptionCreating the advanced filter componentAdvancedFilter
(String language) Creating the advanced filter componentAdvancedFilter
(String language, FilterBarFiltering<?> filtering) Creating the advanced filter componentAdvancedFilter
(String id, String language, FilterBarFiltering<?> filtering) Creating the advanced filter component -
Method Summary
Modifier and TypeMethodDescriptionsetCancelButtonIcon
(Icon icon) setCancelButtonText
(String cancelButtonText) setCriteria
(Criteria criteria) Sets the filter component fulfilling the providedCriteria
instance.setFilterButtonIcon
(Icon icon) setFilterButtonText
(String filterButtonText) setResetButtonIcon
(Icon icon) setResetButtonText
(String resetButtonText) setSaveButtonIcon
(Icon icon) setSaveButtonText
(String saveButtonText) Methods inherited from class com.jbstrap.ui.components.filter.JBBaseFilter
getColumnParamsAsJson, getCriteria, init, isShowEditor, onChangeEditor, onFilter, reset, setButtonsData, setEnabled, setShowEditor
Methods inherited from class com.jbstrap.ui.components.filter.BaseFilter
getComponents, getDataDescriptor, getFiltering, getType, onHide, runAfterDrawOnEditor, runOnHideOnEditor, runOnShowOnEdior, setDataDescriptor, setFiltering, writeHTML
Methods inherited from class com.jbstrap.ui.Component
_hide, _setAttribute, addAllowedRole, addComponent, addComponent, addComponents, addDeniedRole, addHandler, addStyle, addStyleClass, addStyleClasses, afterDraw, clearfix, closeTag, combinateAccess, containsStyle, containsStyleClass, draw, drawSubComponents, error, flattendComponentTree, getAccess, getAccessMode, getAllowedRoles, getAttribute, getAttributes, getBackgroundColor, getBorderColor, getClient, getComponentById, getComponents, getComponentsByClass, getData, getDeniedRoles, getHandlers, getId, getLanguageCode, getName, getParent, getParent, getRegisteredEvents, getStyle, getStyleClasses, getTextAlign, getTextColor, getToolTip, getToolTipPosition, getTypeName, getUI, insertComponentAfter, insertComponentBefore, isAccess, isDrawn, isEnabled, isEventBubbling, isVisible, onHotKeyEventHandler, onShow, openTag, redraw, removeAllComponents, removeAllowedRole, removeAllStyleClasses, removeAttribute, removeComponent, removeComponent, removeComponents, removeDeniedRole, removeHandler, removeStyle, removeStyle, removeStyleClass, removeStyleClasses, replaceComponent, replaceStyleClass, runAfterDraw, runJavaScript, runJavaScript, runJavaScript, runOnHide, runOnShow, say, setAttribute, setBackgroundColor, setBorder, setBorderColor, setData, setDisplayType, setEventBubbling, setFlex, setFloating, setHeight100, setHeight25, setHeight50, setHeight75, setHeightAuto, setLanguage, setMargin, setName, setOverflow, setPadding, setParent, setScrollable, setSelectionType, setShadow, setStyle, setTextAlign, setTextColor, setToolTip, setToolTipPosition, setVisible, setWidth100, setWidth25, setWidth50, setWidth75, setWidthAuto, showNotification, showNotification, showProcessIndicator, toggleStyleClass
Methods inherited from class com.jbstrap.core.messagebus.MessageBus
closeMessageBus, messageBusOpened, openMessageBus, renewSubscription, sendMessageToMessageBus, subscribeMessageBus, unsubscribeAllListeners, unsubscribeMessageBus
-
Constructor Details
-
AdvancedFilter
public AdvancedFilter()Creating the advanced filter component
-
AdvancedFilter
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 isnull
, the component is created using the framework’s default language. The default language of the framework is set via the JBStrap parameterDEFAULT_LANGUAGE
.
-
AdvancedFilter
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 isnull
, the component is created using the framework’s default language. The default language of the framework is set via the JBStrap parameterDEFAULT_LANGUAGE
.filtering
- An instance of the component for which the filter criterion must be valid. The component specified here must also implement the interfaceFilterBarFiltering
.
-
AdvancedFilter
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 isnull
, the component is created using the framework’s default language. The default language of the framework is set via the JBStrap parameterDEFAULT_LANGUAGE
.filtering
- An instance of the component for which the filter criterion must be valid. The component specified here must also implement the interfaceFilterBarFiltering
.
-
-
Method Details
-
setCriteria
Sets the filter component fulfilling the providedCriteria
instance.- Specified by:
setCriteria
in classJBBaseFilter<AdvancedFilter>
- Parameters:
criteria
- Filter criterion instance that sets the filter component- Returns:
- The advanced filter component
-
setFilterButtonText
-
getFilterButtonText
-
setFilterButtonIcon
-
getFilterButtonIcon
-
setResetButtonText
-
getResetButtonText
-
setResetButtonIcon
-
getResetButtonIcon
-
setSaveButtonText
-
getSaveButtonText
-
setSaveButtonIcon
-
getSaveButtonIcon
-
setCancelButtonText
-
getCancelButtonText
-
setCancelButtonIcon
-
getCancelButtonIcon
-