Package com.jbstrap.ui.components.filter
Class TextFilter
java.lang.Object
com.jbstrap.core.messagebus.MessageBus
com.jbstrap.ui.Component<T>
com.jbstrap.ui.components.filter.BaseFilter<T>
com.jbstrap.ui.components.filter.JBBaseFilter<TextFilter>
com.jbstrap.ui.components.filter.TextFilter
- All Implemented Interfaces:
Animatable<TextFilter>
,CanDrop<TextFilter>
,Draggable<TextFilter>
,HandleHotKey<TextFilter>
public class TextFilter
extends JBBaseFilter<TextFilter>
implements Animatable<TextFilter>, HandleHotKey<TextFilter>, Draggable<TextFilter>, CanDrop<TextFilter>
Text filter component
The text filter component displays a text input field and a search button on the interface. The user can enter the filter condition into the text field and by pressing ENTER or by clicking on the search button the search is started.
The search is performed on all fields of type TEXT
in the given DataDescriptor, concatenating the given
search condition LIKE
to all text columns and joins the columns with an OR
condition.
This results in all such records displayed to the user that contain the given search text in any of the text fields.
Supported events:
AnimationStart
AnimationEnd
,
Drop
,
DragStart
,
DragEnd
HotKey
- Since:
- 4.0
- Author:
- JBStrap
-
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
ConstructorDescriptionCreates a TextFilter componentTextFilter
(String language) Creates a TextFilter component for the given filter component in the language providedTextFilter
(String language, FilterBarFiltering<?> filtering) Creates a TextFilter component for the given filter component in the language providedTextFilter
(String id, String language, FilterBarFiltering<?> filtering) Creates a TextFilter component for the given filter component in the language provided -
Method Summary
Modifier and TypeMethodDescriptionGets column names in the filterQuery the operator in the search termsetCriteria
(Criteria criteria) Sets the criterion for text filter component.setFilteredColumns
(String... columns) Set the columns in the filter
By default, the filter includes all visible columns of type TEXT from the DataDescriptor.setWorldOperator
(OperatorType type) Sets the operator between the words of the search term you entered.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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jbstrap.ui.Animatable
addAnimationEndHandler, addAnimationStartHandler, getAnimation, removeAnimation, setAnimation
Methods inherited from interface com.jbstrap.ui.CanDrop
addDropEventHandler
Methods inherited from interface com.jbstrap.ui.Draggable
addDragEndEventHandler, addDragStartEventHandler, setDraggable
Methods inherited from interface com.jbstrap.ui.HandleHotKey
addHotKey, addHotKey, removeHotKey, removeHotKeys
-
Constructor Details
-
TextFilter
public TextFilter()Creates a TextFilter component -
TextFilter
Creates a TextFilter component for the given filter component in the language provided- Parameters:
language
- The language code according to which the filter component is created. If not provided or entered asnull
, the filter component is created according to the default language setting of the framework. The default language for the framework is specified by the JBStrap parameterDEFAULT_LANGUAGE
.
-
TextFilter
Creates a TextFilter component for the given filter component in the language provided- Parameters:
language
- The language code according to which the filter component is created. If not provided or entered asnull
, the filter component is created according to the default language setting of the framework. The default language for the framework is specified by the JBStrap parameterDEFAULT_LANGUAGE
.filtering
- An instance of the component to be filtered. The component specified here must implement the interfaceFilterBarFiltering
.
-
TextFilter
Creates a TextFilter component for the given filter component in the language provided- 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
- The language code according to which the filter component is created. If not provided or entered asnull
, the filter component is created according to the default language setting of the framework. The default language for the framework is specified by the JBStrap parameterDEFAULT_LANGUAGE
.filtering
- An instance of the component to be filtered. The component specified here must implement the interfaceFilterBarFiltering
.
-
-
Method Details
-
setCriteria
Sets the criterion for text filter component. You can only specify a simple criterion with a LIKE operator. The method throws an exception for any other criteria.- Specified by:
setCriteria
in classJBBaseFilter<TextFilter>
- Parameters:
criteria
- Filter criterion Ifnull
is specified, the text filter component is reset to default- Returns:
- Text filter component
- Throws:
IllegalArgumentException
- Thrown if the specified criterion is a complex criterion or does not contain a LIKE operator
-
setWorldOperator
Sets the operator between the words of the search term you entered. By default, words are included in the words when the user searches for a multi-word phrase- Parameters:
type
- The operator that appears in the words. By default AND. You can use the AND or OR operator of theOperatorType
enum values- Returns:
- Text filter component
-
getWorldOperator
Query the operator in the search term- Returns:
- The operator in the words of the search word
-
setFilteredColumns
Set the columns in the filter
By default, the filter includes all visible columns of type TEXT from the DataDescriptor. If you set the columns in the filter, only the columns specified here will be included in the criteria.
Only columns of type TEXT in the DataDescriptor can be set with this method, all other types of columns will be ignored.- Parameters:
columns
- The filterable column list- Returns:
- The filter component
-
getFilteredColumnNames
Gets column names in the filter- Returns:
- The list of filterable column names
-