@StudioComponent(caption="Filter", category="Components", xmlElement="filter", icon="io/jmix/ui/icon/component/filter.svg", canvasIconSize=LARGE, documentationURL="https://docs.jmix.io/jmix/%VERSION%/backoffice-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
Modifier and Type | Interface and Description |
---|---|
static interface |
Filter.Configuration
A configuration is a set of filter components.
|
static class |
Filter.ConfigurationChangeEvent
Event sent when the
Filter.Configuration is changed. |
HasContextHelp.ContextHelpIconClickEvent
Collapsable.ExpandedStateChangeEvent
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
SupportsCaptionPosition.CaptionPosition
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Modifier and Type | Method and Description |
---|---|
void |
addCondition(FilterComponent filterComponent)
Adds a condition to the filter.
|
void |
addConfiguration(Filter.Configuration configuration)
Adds a configuration to the filter.
|
DesignTimeConfiguration |
addConfiguration(java.lang.String id,
java.lang.String name)
Adds design-time configuration with given id and name.
|
DesignTimeConfiguration |
addConfiguration(java.lang.String id,
java.lang.String name,
LogicalFilterComponent.Operation rootOperation)
Adds design-time configuration with given id and name.
|
io.jmix.core.common.event.Subscription |
addConfigurationChangeListener(java.util.function.Consumer<Filter.ConfigurationChangeEvent> listener)
Adds a listener that is invoked when the
Filter.Configuration changes. |
void |
addPropertiesFilterPredicate(java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> propertiesFilterPredicate)
Adds a predicate to the current properties filter predicate.
|
void |
apply()
Applies the current configuration.
|
SupportsCaptionPosition.CaptionPosition |
getCaptionPosition() |
int |
getColumnsCount()
Returns the number of columns to be displayed on one row.
|
java.util.List<FilterComponent> |
getConditions() |
Filter.Configuration |
getConfiguration(java.lang.String id)
Gets a configuration by id.
|
java.util.List<Filter.Configuration> |
getConfigurations() |
Filter.Configuration |
getCurrentConfiguration()
Gets the current configuration that is currently displayed inside the filter.
|
DataLoader |
getDataLoader() |
Filter.Configuration |
getEmptyConfiguration()
Gets an empty configuration that is used when the user has not selected any of the existing
configurations.
|
java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> |
getPropertiesFilterPredicate() |
boolean |
isAutoApply() |
void |
loadConfigurationsAndApplyDefault()
Loads configurations for
Filter and apply default. |
void |
refreshCurrentConfigurationLayout()
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 the
DataLoader when the value component value is changed. |
void |
setCaptionPosition(SupportsCaptionPosition.CaptionPosition position)
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 a
DataLoader related to the filter. |
void |
setPropertiesFilterPredicate(java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> propertiesFilterPredicate)
Sets a predicate that tests whether a property with the given path should be
available for filtering.
|
getFrame, setFrame
getIcon, setIcon, setIconFromSet
isCaptionAsHtml, setCaptionAsHtml
getCaption, setCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
addExpandedStateChangeListener, isCollapsable, isExpanded, setCollapsable, setExpanded
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActions
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
static final java.lang.String NAME
int getColumnsCount()
UiComponentProperties.getFilterColumnsCount()
.getColumnsCount
in interface SupportsColumnsCount
@StudioProperty @Positive void setColumnsCount(int columnsCount)
UiComponentProperties.getFilterColumnsCount()
.setColumnsCount
in interface SupportsColumnsCount
columnsCount
- the number of columns to be displayed on one row@Nullable java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> getPropertiesFilterPredicate()
void setPropertiesFilterPredicate(@Nullable java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> propertiesFilterPredicate)
propertiesFilterPredicate
- a predicate to setvoid addPropertiesFilterPredicate(java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> propertiesFilterPredicate)
propertiesFilterPredicate
- a predicate to addDataLoader getDataLoader()
DataLoader
related to the filter@StudioProperty(type=DATALOADER_REF) void setDataLoader(DataLoader dataLoader)
DataLoader
related to the filter.dataLoader
- a DataLoader
to setboolean isAutoApply()
true
if the filter should be automatically applied to
the DataLoader
when the value component value is changed@StudioProperty void setAutoApply(boolean autoApply)
DataLoader
when the value component value is changed.autoApply
- true
if the filter should be automatically
applied to the DataLoader
when the value
component value is changedvoid apply()
SupportsCaptionPosition.CaptionPosition getCaptionPosition()
getCaptionPosition
in interface SupportsCaptionPosition
void setCaptionPosition(SupportsCaptionPosition.CaptionPosition position)
CaptionPosition#LEFT
- component captions will be placed
in a separate column on the left side of the componentsCaptionPosition#TOP
- component captions will be placed
above the componentssetCaptionPosition
in interface SupportsCaptionPosition
position
- caption position of filter child componentsDesignTimeConfiguration addConfiguration(java.lang.String id, @Nullable java.lang.String name)
FilterComponent
s. The configuration does not store a reference to all
components, but stores a reference only to the root element LogicalFilterComponent
from which the rest FilterComponent
s can be obtained. The root
LogicalFilterComponent
is generated with a LogicalFilterComponent.Operation.AND
operation.
The configuration defined in XML is a DesignTimeConfiguration
.
id
- a configuration id. Must be unique within this filtername
- a configuration nameDesignTimeConfiguration
LogicalFilterComponent
DesignTimeConfiguration addConfiguration(java.lang.String id, @Nullable java.lang.String name, LogicalFilterComponent.Operation rootOperation)
FilterComponent
s. The configuration does not store a reference to all
components, but stores a reference only to the root element LogicalFilterComponent
from which the rest FilterComponent
s can be obtained. The root
LogicalFilterComponent
is generated with a given operation.
The configuration defined in XML is a DesignTimeConfiguration
.
id
- a configuration id. Must be unique within this filtername
- a configuration namerootOperation
- an operation of root LogicalFilterComponent
DesignTimeConfiguration
void addConfiguration(Filter.Configuration configuration)
configuration
- configuration to addDesignTimeConfiguration
,
RunTimeConfiguration
void removeConfiguration(Filter.Configuration configuration)
configuration
- configuration to removevoid setCurrentConfiguration(Filter.Configuration currentConfiguration)
currentConfiguration
- a configurationFilter.Configuration getCurrentConfiguration()
@Nullable Filter.Configuration getConfiguration(java.lang.String id)
id
- the configuration idnull
if not foundFilter.Configuration getEmptyConfiguration()
java.util.List<Filter.Configuration> getConfigurations()
void addCondition(FilterComponent filterComponent)
FilterComponent
that is not initially
added to any of the configurations, but the user can select this component in the
AddConditionScreen
in the Conditions
section and add it to the
RunTimeConfiguration
.filterComponent
- a filter component to add to conditionsFilterComponent
,
AddConditionScreen
,
RunTimeConfiguration
java.util.List<FilterComponent> getConditions()
void removeCondition(FilterComponent filterComponent)
filterComponent
- a filter component to remove from conditionsio.jmix.core.common.event.Subscription addConfigurationChangeListener(java.util.function.Consumer<Filter.ConfigurationChangeEvent> listener)
Filter.Configuration
changes.listener
- a listener to addvoid loadConfigurationsAndApplyDefault()
Filter
and apply default.
NOTE: call this method after the frame is fully initialized
(for example, in ComponentLoader.PostInitTask
in a loader).void refreshCurrentConfigurationLayout()