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
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA configuration is a set of filter components.static classEvent sent when theFilter.Configurationis changed.Nested classes/interfaces inherited from interface io.jmix.ui.component.Collapsable
Collapsable.ExpandedStateChangeEventNested 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.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested classes/interfaces inherited from interface io.jmix.ui.component.SupportsCaptionPosition
SupportsCaptionPosition.CaptionPosition -
Field Summary
FieldsFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCondition(FilterComponent filterComponent) Adds a condition to the filter.voidaddConfiguration(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.Configurationchanges.voidaddPropertiesFilterPredicate(Predicate<MetaPropertyPath> propertiesFilterPredicate) Adds a predicate to the current properties filter predicate.voidapply()Applies the current configuration.floatintReturns 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.booleanvoidLoads configurations forFilterand apply default.voidRefreshes the display of the current configuration.voidremoveCondition(FilterComponent filterComponent) Removes a condition from filter.voidremoveConfiguration(Filter.Configuration configuration) Removes a configuration from filter.voidsetAutoApply(boolean autoApply) Sets whether the filter should be automatically applied to theDataLoaderwhen the value component value is changed.voidSets caption position of filter child components.voidsetCaptionWidth(String width) Sets caption width of filter child components.voidsetColumnsCount(int columnsCount) Sets the number of columns to be displayed on one row.voidsetCurrentConfiguration(Filter.Configuration currentConfiguration) Sets the given configuration as current and displays filter components from the current configuration.voidsetDataLoader(DataLoader dataLoader) Sets aDataLoaderrelated to the filter.voidsetPropertiesFilterPredicate(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, removeAllActionsMethods inherited from interface io.jmix.ui.component.Collapsable
addExpandedStateChangeListener, isCollapsable, isExpanded, setCollapsable, setExpandedMethods 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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledMethods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods 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:
getColumnsCountin 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:
setColumnsCountin 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
DataLoaderrelated to the filter
-
setDataLoader
Sets aDataLoaderrelated to the filter.- Parameters:
dataLoader- aDataLoaderto set
-
isAutoApply
boolean isAutoApply()- Returns:
trueif the filter should be automatically applied to theDataLoaderwhen the value component value is changed
-
setAutoApply
Sets whether the filter should be automatically applied to theDataLoaderwhen the value component value is changed.- Parameters:
autoApply-trueif the filter should be automatically applied to theDataLoaderwhen the value component value is changed
-
apply
void apply()Applies the current configuration. -
getCaptionPosition
SupportsCaptionPosition.CaptionPosition getCaptionPosition()- Specified by:
getCaptionPositionin 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:
setCaptionPositionin interfaceSupportsCaptionPosition- Parameters:
position- caption position of filter child components
-
getCaptionWidth
float getCaptionWidth()- Returns:
- caption width of filter child components
-
getCaptionWidthSizeUnit
SizeUnit getCaptionWidthSizeUnit()- Returns:
- caption width size unit of filter child components
-
setCaptionWidth
Sets caption width of filter child components.- Parameters:
width- caption width of filter child components
-
addConfiguration
Adds design-time configuration with given id and name. A configuration is a set ofFilterComponents. The configuration does not store a reference to all components, but stores a reference only to the root elementLogicalFilterComponentfrom which the restFilterComponents can be obtained. The rootLogicalFilterComponentis generated with aLogicalFilterComponent.Operation.ANDoperation.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 ofFilterComponents. The configuration does not store a reference to all components, but stores a reference only to the root elementLogicalFilterComponentfrom which the restFilterComponents can be obtained. The rootLogicalFilterComponentis 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
nullif 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 aFilterComponentthat is not initially added to any of the configurations, but the user can select this component in theAddConditionScreenin theConditionssection 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.Configurationchanges.- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
loadConfigurationsAndApplyDefault
void loadConfigurationsAndApplyDefault()Loads configurations forFilterand apply default. NOTE: call this method after the frame is fully initialized (for example, inComponentLoader.InitTaskin a loader). -
refreshCurrentConfigurationLayout
void refreshCurrentConfigurationLayout()Refreshes the display of the current configuration. Allows the user to refresh the display after changing the current configuration.
-