Package io.jmix.ui.component.impl
Class FilterImpl
- All Implemented Interfaces:
ActionsHolder,AttachNotifier,Collapsable,Component,Component.BelongToFrame,Component.HasCaption,Component.HasDescription,Component.HasIcon,CompositeWithCaption,CompositeWithContextHelp,CompositeWithDescription,CompositeWithHtmlCaption,CompositeWithHtmlDescription,CompositeWithIcon,Filter,HasContextHelp,HasDebugId,HasHtmlCaption,HasHtmlDescription,HasHtmlSanitizer,HasSubParts,SupportsCaptionPosition,SupportsColumnsCount
public class FilterImpl
extends CompositeComponent<GroupBoxLayout>
implements Filter, CompositeWithHtmlCaption, CompositeWithHtmlDescription, CompositeWithContextHelp, CompositeWithIcon
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.ui.component.CompositeComponent
CompositeComponent.CreateEventNested 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.Filter
Filter.Configuration, Filter.ConfigurationChangeEventNested 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
FieldsModifier and TypeFieldDescriptionprotected Actionsprotected LinkButtonprotected booleanprotected SupportsCaptionPosition.CaptionPositionprotected floatprotected SizeUnitprotected intprotected List<FilterComponent>protected booleanprotected List<Filter.Configuration>protected ResponsiveGridLayoutprotected CurrentAuthenticationprotected Filter.Configurationprotected DataLoaderprotected Filter.Configurationprotected static final Stringprotected static final Stringprotected FilterSupportprotected Conditionprotected Messagesprotected Metadataprotected Predicate<MetaPropertyPath>protected LogicalFilterComponentprotected ScreenBuildersprotected Buttonprotected CssLayoutprotected PopupButtonprotected PopupButtonprotected UiComponentsFields inherited from class io.jmix.ui.component.CompositeComponent
applicationContext, frame, id, prefixId, rootFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an action to the componentvoidAdd an action to the component with index.voidaddCondition(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.protected voidaddSelectConfigurationAction(Filter.Configuration configuration) voidapply()Applies the current configuration.protected voidattachToFrame(Component childComponent) protected voidprotected LinkButtoncreateConditionRemoveButton(SingleFilterComponent<?> singleFilter, String removeButtonId) protected LogicalFilterComponentprotected ActionfloatintReturns the number of columns to be displayed on one row.Gets a configuration by id.protected StringgetConfigurationCaption(Filter.Configuration configuration) 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.protected voidprotected voidprotected voidprotected voidprotected voidprotected voidbooleanbooleanbooleanvoidLoads configurations forFilterand apply default.protected voidonCreate(CompositeComponent.CreateEvent createEvent) voidRefreshes the display of the current configuration.voidremoveAction(Action action) Remove the action from the componentvoidremoveAction(String id) Remove the action by its ID.voidRemove all actions from the componentvoidremoveCondition(FilterComponent filterComponent) Removes a condition from filter.voidremoveConfiguration(Filter.Configuration configuration) Removes a configuration from filter.protected voidremoveFilterComponent(FilterComponent filterComponent) protected voidresetFilterComponentDefaultValue(PropertyFilter<?> propertyFilter) voidsetAccessManager(AccessManager accessManager) voidsetActions(Actions actions) voidsetAutoApply(boolean autoApply) Sets whether the filter should be automatically applied to theDataLoaderwhen the value component value is changed.voidsetCaption(String caption) Sets the component's caption.voidSets caption position of filter child components.voidsetCaptionWidth(String width) Sets caption width of filter child components.voidsetCollapsable(boolean collapsable) voidsetColumnsCount(int columnsCount) Sets the number of columns to be displayed on one row.voidsetCurrentAuthentication(CurrentAuthentication currentAuthentication) 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.voidsetExpanded(boolean expanded) voidsetFilterSupport(FilterSupport filterSupport) voidvoidsetMessages(Messages messages) voidsetMetadata(Metadata metadata) voidsetPropertiesFilterPredicate(Predicate<MetaPropertyPath> propertiesFilterPredicate) Sets a predicate that tests whether a property with the given path should be available for filtering.voidsetScreenBuilders(ScreenBuilders screenBuilders) voidsetUiComponentProperties(UiComponentProperties componentProperties) voidsetUiComponents(UiComponents uiComponents) protected voidprotected voidprotected voidupdateConditionRemoveButton(SingleFilterComponent<?> singleFilter) protected voidprotected voidprotected voidupdateRootLogicalFilterComponent(LogicalFilterComponent logicalFilterComponent) protected voidupdateSearchButtonCaption(boolean autoApply) protected voidMethods inherited from class io.jmix.ui.component.CompositeComponent
addAttachListener, addCreateListener, addDetachListener, addStyleName, assignDebugId, attached, detached, disableEventListeners, enableEventListeners, getAlignment, getComposition, getCompositionOrNull, getDebugId, getEventHub, getFrame, getFullId, getHeight, getHeightSizeUnit, getId, getInnerComponent, getInnerComponentOptional, getParent, getPrefixId, getStyleName, getUiEventListeners, getWidth, getWidthSizeUnit, hasSubscriptions, isAttached, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, publish, removeStyleName, setAlignment, setApplicationContext, setComposition, setDebugId, setEnabled, setHeight, setHtmlSanitizerEnabled, setId, setParent, setResponsive, setStyleName, setUiEventListeners, setVisible, setWidth, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, updateComponentIds, updateIdIfNeeded, withUnwrapped, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.ui.component.ActionsHolder
getActionNN, getSubPartMethods 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
getFrameMethods inherited from interface io.jmix.ui.component.CompositeWithCaption
getCaptionMethods inherited from interface io.jmix.ui.component.CompositeWithContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledMethods inherited from interface io.jmix.ui.component.CompositeWithDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.CompositeWithHtmlCaption
isCaptionAsHtml, setCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.CompositeWithHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods inherited from interface io.jmix.ui.component.CompositeWithIcon
getIcon, setIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
-
Field Details
-
FILTER_STYLENAME
- See Also:
-
FILTER_ROOT_COMPONENT_STYLENAME
- See Also:
-
actions
-
currentAuthentication
-
filterSupport
-
messages
-
metadata
-
screenBuilders
-
uiComponents
-
rootLogicalFilterComponent
-
controlsLayout
-
searchLayout
-
searchButton
-
selectConfigurationButton
-
addConditionButton
-
settingsButton
-
dataLoader
-
initialDataLoaderCondition
-
autoApply
protected boolean autoApply -
columnsCount
protected int columnsCount -
captionPosition
-
propertiesFilterPredicate
-
captionWidth
protected float captionWidth -
captionWidthUnit
-
emptyConfiguration
-
currentConfiguration
-
configurations
-
conditions
-
configurationModifyPermitted
protected boolean configurationModifyPermitted
-
-
Constructor Details
-
FilterImpl
public FilterImpl()
-
-
Method Details
-
setActions
-
setCurrentAuthentication
-
setFilterSupport
-
setMessages
-
setMetadata
-
setScreenBuilders
-
setUiComponents
-
setUiComponentProperties
-
setAccessManager
-
isExpanded
public boolean isExpanded()- Specified by:
isExpandedin interfaceCollapsable
-
setExpanded
public void setExpanded(boolean expanded) - Specified by:
setExpandedin interfaceCollapsable
-
isCollapsable
public boolean isCollapsable()- Specified by:
isCollapsablein interfaceCollapsable
-
setCollapsable
public void setCollapsable(boolean collapsable) - Specified by:
setCollapsablein interfaceCollapsable
-
addExpandedStateChangeListener
public Subscription addExpandedStateChangeListener(Consumer<Collapsable.ExpandedStateChangeEvent> listener) - Specified by:
addExpandedStateChangeListenerin interfaceCollapsable
-
getDataLoader
- Specified by:
getDataLoaderin interfaceFilter- Returns:
- a
DataLoaderrelated to the filter
-
setDataLoader
Description copied from interface:FilterSets aDataLoaderrelated to the filter.- Specified by:
setDataLoaderin interfaceFilter- Parameters:
dataLoader- aDataLoaderto set
-
isAutoApply
public boolean isAutoApply()- Specified by:
isAutoApplyin interfaceFilter- Returns:
trueif the filter should be automatically applied to theDataLoaderwhen the value component value is changed
-
setAutoApply
public void setAutoApply(boolean autoApply) Description copied from interface:FilterSets whether the filter should be automatically applied to theDataLoaderwhen the value component value is changed.- Specified by:
setAutoApplyin interfaceFilter- Parameters:
autoApply-trueif the filter should be automatically applied to theDataLoaderwhen the value component value is changed
-
apply
public void apply()Description copied from interface:FilterApplies the current configuration. -
getCaptionPosition
- Specified by:
getCaptionPositionin interfaceFilter- Specified by:
getCaptionPositionin interfaceSupportsCaptionPosition- Returns:
- caption position of filter child components
-
setCaptionPosition
Description copied from interface:FilterSets 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 interfaceFilter- Specified by:
setCaptionPositionin interfaceSupportsCaptionPosition- Parameters:
position- caption position of filter child components
-
getCaptionWidth
public float getCaptionWidth()- Specified by:
getCaptionWidthin interfaceFilter- Returns:
- caption width of filter child components
-
getCaptionWidthSizeUnit
- Specified by:
getCaptionWidthSizeUnitin interfaceFilter- Returns:
- caption width size unit of filter child components
-
setCaptionWidth
Description copied from interface:FilterSets caption width of filter child components.- Specified by:
setCaptionWidthin interfaceFilter- Parameters:
width- caption width of filter child components
-
getColumnsCount
public int getColumnsCount()Description copied from interface:FilterReturns the number of columns to be displayed on one row. The default value is taken fromUiComponentProperties.getFilterColumnsCount().- Specified by:
getColumnsCountin interfaceFilter- Specified by:
getColumnsCountin interfaceSupportsColumnsCount- Returns:
- the number of columns to be displayed on one row
-
setColumnsCount
public void setColumnsCount(int columnsCount) Description copied from interface:FilterSets the number of columns to be displayed on one row. The default value is taken fromUiComponentProperties.getFilterColumnsCount().- Specified by:
setColumnsCountin interfaceFilter- Specified by:
setColumnsCountin interfaceSupportsColumnsCount- Parameters:
columnsCount- the number of columns to be displayed on one row
-
setFrame
- Specified by:
setFramein interfaceComponent.BelongToFrame- Overrides:
setFramein classCompositeComponent<GroupBoxLayout>
-
attachToFrame
-
getPropertiesFilterPredicate
- Specified by:
getPropertiesFilterPredicatein interfaceFilter- Returns:
- a properties filter predicate
-
setPropertiesFilterPredicate
public void setPropertiesFilterPredicate(@Nullable Predicate<MetaPropertyPath> propertiesFilterPredicate) Description copied from interface:FilterSets a predicate that tests whether a property with the given path should be available for filtering.- Specified by:
setPropertiesFilterPredicatein interfaceFilter- Parameters:
propertiesFilterPredicate- a predicate to set
-
addPropertiesFilterPredicate
Description copied from interface:FilterAdds 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.- Specified by:
addPropertiesFilterPredicatein interfaceFilter- Parameters:
propertiesFilterPredicate- a predicate to add
-
setCurrentConfiguration
Description copied from interface:FilterSets the given configuration as current and displays filter components from the current configuration.- Specified by:
setCurrentConfigurationin interfaceFilter- Parameters:
currentConfiguration- a configuration
-
getCurrentConfiguration
Description copied from interface:FilterGets the current configuration that is currently displayed inside the filter.- Specified by:
getCurrentConfigurationin interfaceFilter- Returns:
- a current configuration
-
getConfiguration
Description copied from interface:FilterGets a configuration by id.- Specified by:
getConfigurationin interfaceFilter- Parameters:
id- the configuration id- Returns:
- the configuration of
nullif not found
-
getEmptyConfiguration
Description copied from interface:FilterGets an empty configuration that is used when the user has not selected any of the existing configurations.- Specified by:
getEmptyConfigurationin interfaceFilter- Returns:
- an empty configuration
-
getConfigurations
- Specified by:
getConfigurationsin interfaceFilter- Returns:
- a list of all configurations related to the filter
-
addConfiguration
Description copied from interface:FilterAdds 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.- Specified by:
addConfigurationin interfaceFilter- Parameters:
id- a configuration id. Must be unique within this filtername- a configuration name- Returns:
DesignTimeConfiguration- See Also:
-
addConfiguration
public DesignTimeConfiguration addConfiguration(String id, @Nullable String name, LogicalFilterComponent.Operation rootOperation) Description copied from interface:FilterAdds 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.- Specified by:
addConfigurationin interfaceFilter- Parameters:
id- a configuration id. Must be unique within this filtername- a configuration namerootOperation- an operation of rootLogicalFilterComponent- Returns:
DesignTimeConfiguration
-
addConfiguration
Description copied from interface:FilterAdds a configuration to the filter.- Specified by:
addConfigurationin interfaceFilter- Parameters:
configuration- configuration to add- See Also:
-
removeConfiguration
Description copied from interface:FilterRemoves a configuration from filter.- Specified by:
removeConfigurationin interfaceFilter- Parameters:
configuration- configuration to remove
-
addCondition
Description copied from interface:FilterAdds 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.- Specified by:
addConditionin interfaceFilter- Parameters:
filterComponent- a filter component to add to conditions- See Also:
-
getConditions
- Specified by:
getConditionsin interfaceFilter- Returns:
- a list of all conditions related to the filter
-
removeCondition
Description copied from interface:FilterRemoves a condition from filter.- Specified by:
removeConditionin interfaceFilter- Parameters:
filterComponent- a filter component to remove from conditions
-
addConfigurationChangeListener
public Subscription addConfigurationChangeListener(Consumer<Filter.ConfigurationChangeEvent> listener) Description copied from interface:FilterAdds a listener that is invoked when theFilter.Configurationchanges.- Specified by:
addConfigurationChangeListenerin interfaceFilter- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
loadConfigurationsAndApplyDefault
public void loadConfigurationsAndApplyDefault()Description copied from interface:FilterLoads configurations forFilterand apply default. NOTE: call this method after the frame is fully initialized (for example, inComponentLoader.InitTaskin a loader).- Specified by:
loadConfigurationsAndApplyDefaultin interfaceFilter
-
refreshCurrentConfigurationLayout
public void refreshCurrentConfigurationLayout()Description copied from interface:FilterRefreshes the display of the current configuration. Allows the user to refresh the display after changing the current configuration.- Specified by:
refreshCurrentConfigurationLayoutin interfaceFilter
-
addAction
Description copied from interface:ActionsHolderAdd an action to the component- Specified by:
addActionin interfaceActionsHolder
-
addAction
Description copied from interface:ActionsHolderAdd an action to the component with index.- Specified by:
addActionin interfaceActionsHolder
-
removeAction
Description copied from interface:ActionsHolderRemove the action from the component- Specified by:
removeActionin interfaceActionsHolder
-
removeAction
Description copied from interface:ActionsHolderRemove the action by its ID. If there is no action with that ID, nothing happens.- Specified by:
removeActionin interfaceActionsHolder
-
removeAllActions
public void removeAllActions()Description copied from interface:ActionsHolderRemove all actions from the component- Specified by:
removeAllActionsin interfaceActionsHolder
-
getActions
- Specified by:
getActionsin interfaceActionsHolder- Returns:
- unmodifiable collection of actions
-
getAction
- Specified by:
getActionin interfaceActionsHolder- Returns:
- an action by its ID, or null if not found
-
setCaption
Description copied from interface:Component.HasCaptionSets the component's caption.- Specified by:
setCaptionin interfaceComponent.HasCaption- Specified by:
setCaptionin interfaceCompositeWithCaption- Parameters:
caption- the new component's caption
-
getQueryCondition
-
onCreate
-
initRootComponent
protected void initRootComponent() -
initEmptyConfiguration
protected void initEmptyConfiguration() -
initAddConditionButton
protected void initAddConditionButton() -
initSearchButton
protected void initSearchButton() -
initSelectConfigurationButton
protected void initSelectConfigurationButton() -
initSettingsButton
protected void initSettingsButton() -
createConditionRemoveButton
protected LinkButton createConditionRemoveButton(SingleFilterComponent<?> singleFilter, String removeButtonId) -
removeFilterComponent
-
createResetFilterAction
-
createConfigurationRootLogicalFilterComponent
protected LogicalFilterComponent createConfigurationRootLogicalFilterComponent(LogicalFilterComponent.Operation rootOperation) -
addSelectConfigurationAction
-
getConfigurationCaption
-
updateRootLayoutCaption
protected void updateRootLayoutCaption() -
updateSearchButtonCaption
protected void updateSearchButtonCaption(boolean autoApply) -
updateDataLoaderCondition
protected void updateDataLoaderCondition() -
updateActionsState
protected void updateActionsState() -
updateRootLogicalFilterComponent
-
updateConditionRemoveButton
-
resetFilterComponentDefaultValue
-
updateSelectConfigurationButton
protected void updateSelectConfigurationButton() -
clearValues
protected void clearValues() -
setupLoaderFirstResult
protected void setupLoaderFirstResult()
-