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.CreateEvent
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.Filter
Filter.Configuration, Filter.ConfigurationChangeEvent
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
Modifier and TypeFieldDescriptionprotected Actions
protected LinkButton
protected boolean
protected SupportsCaptionPosition.CaptionPosition
protected int
protected List<FilterComponent>
protected boolean
protected List<Filter.Configuration>
protected ResponsiveGridLayout
protected CurrentAuthentication
protected Filter.Configuration
protected DataLoader
protected Filter.Configuration
protected static final String
protected static final String
protected FilterSupport
protected Condition
protected Messages
protected Metadata
protected Predicate<MetaPropertyPath>
protected LogicalFilterComponent
protected ScreenBuilders
protected Button
protected CssLayout
protected PopupButton
protected PopupButton
protected UiComponents
Fields inherited from class io.jmix.ui.component.CompositeComponent
applicationContext, frame, id, prefixId, root
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an action to the componentvoid
Add an action to the component with index.void
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.protected void
addSelectConfigurationAction
(Filter.Configuration configuration) void
apply()
Applies the current configuration.protected void
attachToFrame
(Component childComponent) protected void
protected LinkButton
createConditionRemoveButton
(SingleFilterComponent<?> singleFilter, String removeButtonId) protected LogicalFilterComponent
protected Action
int
Returns the number of columns to be displayed on one row.Gets a configuration by id.protected String
getConfigurationCaption
(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 void
protected void
protected void
protected void
protected void
protected void
boolean
boolean
boolean
void
Loads configurations forFilter
and apply default.protected void
onCreate
(CompositeComponent.CreateEvent createEvent) void
Refreshes the display of the current configuration.void
removeAction
(Action action) Remove the action from the componentvoid
removeAction
(String id) Remove the action by its ID.void
Remove all actions from the componentvoid
removeCondition
(FilterComponent filterComponent) Removes a condition from filter.void
removeConfiguration
(Filter.Configuration configuration) Removes a configuration from filter.protected void
removeFilterComponent
(FilterComponent filterComponent) protected void
resetFilterComponentDefaultValue
(PropertyFilter<?> propertyFilter) void
setAccessManager
(AccessManager accessManager) void
setActions
(Actions actions) void
setAutoApply
(boolean autoApply) Sets whether the filter should be automatically applied to theDataLoader
when the value component value is changed.void
setCaption
(String caption) Sets the component's caption.void
Sets caption position of filter child components.void
setCollapsable
(boolean collapsable) void
setColumnsCount
(int columnsCount) Sets the number of columns to be displayed on one row.void
setCurrentAuthentication
(CurrentAuthentication currentAuthentication) 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
setExpanded
(boolean expanded) void
setFilterSupport
(FilterSupport filterSupport) void
void
setMessages
(Messages messages) void
setMetadata
(Metadata metadata) void
setPropertiesFilterPredicate
(Predicate<MetaPropertyPath> propertiesFilterPredicate) Sets a predicate that tests whether a property with the given path should be available for filtering.void
setScreenBuilders
(ScreenBuilders screenBuilders) void
setUiComponentProperties
(UiComponentProperties componentProperties) void
setUiComponents
(UiComponents uiComponents) protected void
protected void
protected void
updateConditionRemoveButton
(SingleFilterComponent<?> singleFilter) protected void
protected void
protected void
updateRootLogicalFilterComponent
(LogicalFilterComponent logicalFilterComponent) protected void
updateSearchButtonCaption
(boolean autoApply) protected void
Methods 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, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.ActionsHolder
getActionNN, getSubPart
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
Methods inherited from interface io.jmix.ui.component.CompositeWithCaption
getCaption
Methods inherited from interface io.jmix.ui.component.CompositeWithContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.CompositeWithDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.CompositeWithHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.CompositeWithHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.CompositeWithIcon
getIcon, setIcon, setIconFromSet
Methods 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 -
propertiesFilterPredicate
-
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:
isExpanded
in interfaceCollapsable
-
setExpanded
public void setExpanded(boolean expanded) - Specified by:
setExpanded
in interfaceCollapsable
-
isCollapsable
public boolean isCollapsable()- Specified by:
isCollapsable
in interfaceCollapsable
-
setCollapsable
public void setCollapsable(boolean collapsable) - Specified by:
setCollapsable
in interfaceCollapsable
-
addExpandedStateChangeListener
public Subscription addExpandedStateChangeListener(Consumer<Collapsable.ExpandedStateChangeEvent> listener) - Specified by:
addExpandedStateChangeListener
in interfaceCollapsable
-
getDataLoader
- Specified by:
getDataLoader
in interfaceFilter
- Returns:
- a
DataLoader
related to the filter
-
setDataLoader
Description copied from interface:Filter
Sets aDataLoader
related to the filter.- Specified by:
setDataLoader
in interfaceFilter
- Parameters:
dataLoader
- aDataLoader
to set
-
isAutoApply
public boolean isAutoApply()- Specified by:
isAutoApply
in interfaceFilter
- Returns:
true
if the filter should be automatically applied to theDataLoader
when the value component value is changed
-
setAutoApply
public void setAutoApply(boolean autoApply) Description copied from interface:Filter
Sets whether the filter should be automatically applied to theDataLoader
when the value component value is changed.- Specified by:
setAutoApply
in interfaceFilter
- Parameters:
autoApply
-true
if the filter should be automatically applied to theDataLoader
when the value component value is changed
-
apply
public void apply()Description copied from interface:Filter
Applies the current configuration. -
getCaptionPosition
- Specified by:
getCaptionPosition
in interfaceFilter
- Specified by:
getCaptionPosition
in interfaceSupportsCaptionPosition
- Returns:
- caption position of filter child components
-
setCaptionPosition
Description copied from interface:Filter
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 interfaceFilter
- Specified by:
setCaptionPosition
in interfaceSupportsCaptionPosition
- Parameters:
position
- caption position of filter child components
-
getColumnsCount
public int getColumnsCount()Description copied from interface:Filter
Returns the number of columns to be displayed on one row. The default value is taken fromUiComponentProperties.getFilterColumnsCount()
.- Specified by:
getColumnsCount
in interfaceFilter
- Specified by:
getColumnsCount
in interfaceSupportsColumnsCount
- Returns:
- the number of columns to be displayed on one row
-
setColumnsCount
public void setColumnsCount(int columnsCount) Description copied from interface:Filter
Sets the number of columns to be displayed on one row. The default value is taken fromUiComponentProperties.getFilterColumnsCount()
.- Specified by:
setColumnsCount
in interfaceFilter
- Specified by:
setColumnsCount
in interfaceSupportsColumnsCount
- Parameters:
columnsCount
- the number of columns to be displayed on one row
-
setFrame
- Specified by:
setFrame
in interfaceComponent.BelongToFrame
- Overrides:
setFrame
in classCompositeComponent<GroupBoxLayout>
-
attachToFrame
-
getPropertiesFilterPredicate
- Specified by:
getPropertiesFilterPredicate
in interfaceFilter
- Returns:
- a properties filter predicate
-
setPropertiesFilterPredicate
public void setPropertiesFilterPredicate(@Nullable Predicate<MetaPropertyPath> propertiesFilterPredicate) Description copied from interface:Filter
Sets a predicate that tests whether a property with the given path should be available for filtering.- Specified by:
setPropertiesFilterPredicate
in interfaceFilter
- Parameters:
propertiesFilterPredicate
- a predicate to set
-
addPropertiesFilterPredicate
Description copied from interface:Filter
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.- Specified by:
addPropertiesFilterPredicate
in interfaceFilter
- Parameters:
propertiesFilterPredicate
- a predicate to add
-
setCurrentConfiguration
Description copied from interface:Filter
Sets the given configuration as current and displays filter components from the current configuration.- Specified by:
setCurrentConfiguration
in interfaceFilter
- Parameters:
currentConfiguration
- a configuration
-
getCurrentConfiguration
Description copied from interface:Filter
Gets the current configuration that is currently displayed inside the filter.- Specified by:
getCurrentConfiguration
in interfaceFilter
- Returns:
- a current configuration
-
getConfiguration
Description copied from interface:Filter
Gets a configuration by id.- Specified by:
getConfiguration
in interfaceFilter
- Parameters:
id
- the configuration id- Returns:
- the configuration of
null
if not found
-
getEmptyConfiguration
Description copied from interface:Filter
Gets an empty configuration that is used when the user has not selected any of the existing configurations.- Specified by:
getEmptyConfiguration
in interfaceFilter
- Returns:
- an empty configuration
-
getConfigurations
- Specified by:
getConfigurations
in interfaceFilter
- Returns:
- a list of all configurations related to the filter
-
addConfiguration
Description copied from interface:Filter
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
.- Specified by:
addConfiguration
in 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:Filter
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
.- Specified by:
addConfiguration
in 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:Filter
Adds a configuration to the filter.- Specified by:
addConfiguration
in interfaceFilter
- Parameters:
configuration
- configuration to add- See Also:
-
removeConfiguration
Description copied from interface:Filter
Removes a configuration from filter.- Specified by:
removeConfiguration
in interfaceFilter
- Parameters:
configuration
- configuration to remove
-
addCondition
Description copied from interface:Filter
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
.- Specified by:
addCondition
in interfaceFilter
- Parameters:
filterComponent
- a filter component to add to conditions- See Also:
-
getConditions
- Specified by:
getConditions
in interfaceFilter
- Returns:
- a list of all conditions related to the filter
-
removeCondition
Description copied from interface:Filter
Removes a condition from filter.- Specified by:
removeCondition
in interfaceFilter
- Parameters:
filterComponent
- a filter component to remove from conditions
-
addConfigurationChangeListener
public Subscription addConfigurationChangeListener(Consumer<Filter.ConfigurationChangeEvent> listener) Description copied from interface:Filter
Adds a listener that is invoked when theFilter.Configuration
changes.- Specified by:
addConfigurationChangeListener
in interfaceFilter
- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-
loadConfigurationsAndApplyDefault
public void loadConfigurationsAndApplyDefault()Description copied from interface:Filter
Loads configurations forFilter
and apply default. NOTE: call this method after the frame is fully initialized (for example, inComponentLoader.InitTask
in a loader).- Specified by:
loadConfigurationsAndApplyDefault
in interfaceFilter
-
refreshCurrentConfigurationLayout
public void refreshCurrentConfigurationLayout()Description copied from interface:Filter
Refreshes the display of the current configuration. Allows the user to refresh the display after changing the current configuration.- Specified by:
refreshCurrentConfigurationLayout
in interfaceFilter
-
addAction
Description copied from interface:ActionsHolder
Add an action to the component- Specified by:
addAction
in interfaceActionsHolder
-
addAction
Description copied from interface:ActionsHolder
Add an action to the component with index.- Specified by:
addAction
in interfaceActionsHolder
-
removeAction
Description copied from interface:ActionsHolder
Remove the action from the component- Specified by:
removeAction
in interfaceActionsHolder
-
removeAction
Description copied from interface:ActionsHolder
Remove the action by its ID. If there is no action with that ID, nothing happens.- Specified by:
removeAction
in interfaceActionsHolder
-
removeAllActions
public void removeAllActions()Description copied from interface:ActionsHolder
Remove all actions from the component- Specified by:
removeAllActions
in interfaceActionsHolder
-
getActions
- Specified by:
getActions
in interfaceActionsHolder
- Returns:
- unmodifiable collection of actions
-
getAction
- Specified by:
getAction
in interfaceActionsHolder
- Returns:
- an action by its ID, or null if not found
-
setCaption
Description copied from interface:Component.HasCaption
Sets the component's caption.- Specified by:
setCaption
in interfaceComponent.HasCaption
- Specified by:
setCaption
in 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()
-