Package io.jmix.ui.component
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.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A configuration is a set of filter components.static class
Event sent when theFilter.Configuration
is changed.Nested classes/interfaces inherited from interface io.jmix.ui.component.Collapsable
Collapsable.ExpandedStateChangeEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.SupportsCaptionPosition
SupportsCaptionPosition.CaptionPosition
-
Field Summary
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCondition
(FilterComponent filterComponent) Adds a condition to the filter.void
addConfiguration
(Filter.Configuration configuration) Adds a configuration to the filter.addConfiguration
(String id, String name) Adds design-time configuration with given id and name.addConfiguration
(String id, String name, LogicalFilterComponent.Operation rootOperation) Adds design-time configuration with given id and name.Adds a listener that is invoked when theFilter.Configuration
changes.void
addPropertiesFilterPredicate
(Predicate<MetaPropertyPath> propertiesFilterPredicate) Adds a predicate to the current properties filter predicate.void
apply()
Applies the current configuration.int
Returns the number of columns to be displayed on one row.Gets a configuration by id.Gets the current configuration that is currently displayed inside the filter.Gets an empty configuration that is used when the user has not selected any of the existing configurations.boolean
void
Loads configurations forFilter
and apply default.void
Refreshes the display of the current configuration.void
removeCondition
(FilterComponent filterComponent) Removes a condition from filter.void
removeConfiguration
(Filter.Configuration configuration) Removes a configuration from filter.void
setAutoApply
(boolean autoApply) Sets whether the filter should be automatically applied to theDataLoader
when the value component value is changed.void
Sets caption position of filter child components.void
setColumnsCount
(int columnsCount) Sets the number of columns to be displayed on one row.void
setCurrentConfiguration
(Filter.Configuration currentConfiguration) Sets the given configuration as current and displays filter components from the current configuration.void
setDataLoader
(DataLoader dataLoader) Sets aDataLoader
related to the filter.void
setPropertiesFilterPredicate
(Predicate<MetaPropertyPath> propertiesFilterPredicate) Sets a predicate that tests whether a property with the given path should be available for filtering.Methods inherited from interface io.jmix.ui.component.ActionsHolder
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActions
Methods inherited from interface io.jmix.ui.component.Collapsable
addExpandedStateChangeListener, isCollapsable, isExpanded, setCollapsable, setExpanded
Methods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSet
Methods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
-
Field Details
-
NAME
- See Also:
-
-
Method Details
-
getColumnsCount
int getColumnsCount()Returns the number of columns to be displayed on one row. The default value is taken fromUiComponentProperties.getFilterColumnsCount()
.- Specified by:
getColumnsCount
in interfaceSupportsColumnsCount
- Returns:
- the number of columns to be displayed on one row
-
setColumnsCount
Sets the number of columns to be displayed on one row. The default value is taken fromUiComponentProperties.getFilterColumnsCount()
.- Specified by:
setColumnsCount
in interfaceSupportsColumnsCount
- Parameters:
columnsCount
- the number of columns to be displayed on one row
-
getPropertiesFilterPredicate
- Returns:
- a properties filter predicate
-
setPropertiesFilterPredicate
Sets a predicate that tests whether a property with the given path should be available for filtering.- Parameters:
propertiesFilterPredicate
- a predicate to set
-
addPropertiesFilterPredicate
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
Sets aDataLoader
related to the filter.- Parameters:
dataLoader
- aDataLoader
to set
-
isAutoApply
boolean isAutoApply()- Returns:
true
if the filter should be automatically applied to theDataLoader
when the value component value is changed
-
setAutoApply
Sets whether the filter should be automatically applied to theDataLoader
when the value component value is changed.- Parameters:
autoApply
-true
if the filter should be automatically applied to theDataLoader
when the value component value is changed
-
apply
void apply()Applies the current configuration. -
getCaptionPosition
SupportsCaptionPosition.CaptionPosition getCaptionPosition()- Specified by:
getCaptionPosition
in interfaceSupportsCaptionPosition
- Returns:
- caption position of filter child components
-
setCaptionPosition
Sets caption position of filter child components.SupportsCaptionPosition.CaptionPosition.LEFT
- component captions will be placed in a separate column on the left side of the componentsSupportsCaptionPosition.CaptionPosition.TOP
- component captions will be placed above the components
- Specified by:
setCaptionPosition
in interfaceSupportsCaptionPosition
- Parameters:
position
- caption position of filter child components
-
addConfiguration
Adds design-time configuration with given id and name. A configuration is a set ofFilterComponent
s. The configuration does not store a reference to all components, but stores a reference only to the root elementLogicalFilterComponent
from which the restFilterComponent
s can be obtained. The rootLogicalFilterComponent
is generated with aLogicalFilterComponent.Operation.AND
operation.The configuration defined in XML is a
DesignTimeConfiguration
.- Parameters:
id
- a configuration id. Must be unique within this filtername
- 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 ofFilterComponent
s. The configuration does not store a reference to all components, but stores a reference only to the root elementLogicalFilterComponent
from which the restFilterComponent
s can be obtained. The rootLogicalFilterComponent
is generated with a given operation.The configuration defined in XML is a
DesignTimeConfiguration
.- Parameters:
id
- a configuration id. Must be unique within this filtername
- a configuration namerootOperation
- an operation of rootLogicalFilterComponent
- 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
Removes a configuration from filter.- Parameters:
configuration
- configuration to remove
-
setCurrentConfiguration
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
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 aFilterComponent
that is not initially added to any of the configurations, but the user can select this component in theAddConditionScreen
in theConditions
section and add it to theRunTimeConfiguration
.- 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
Removes a condition from filter.- Parameters:
filterComponent
- a filter component to remove from conditions
-
addConfigurationChangeListener
Adds a listener that is invoked when theFilter.Configuration
changes.- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-
loadConfigurationsAndApplyDefault
void loadConfigurationsAndApplyDefault()Loads configurations forFilter
and apply default. NOTE: call this method after the frame is fully initialized (for example, inComponentLoader.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.
-