public class FilterImpl extends CompositeComponent<GroupBoxLayout> implements Filter, CompositeWithHtmlCaption, CompositeWithHtmlDescription, CompositeWithContextHelp, CompositeWithIcon
CompositeComponent.CreateEvent
Filter.Configuration, Filter.ConfigurationChangeEvent
Collapsable.ExpandedStateChangeEvent
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
SupportsCaptionPosition.CaptionPosition
HasContextHelp.ContextHelpIconClickEvent
applicationContext, frame, id, root
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
FilterImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addAction(Action action)
Add an action to the component
|
void |
addAction(Action action,
int index)
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.
|
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. |
io.jmix.core.common.event.Subscription |
addExpandedStateChangeListener(java.util.function.Consumer<Collapsable.ExpandedStateChangeEvent> listener) |
void |
addPropertiesFilterPredicate(java.util.function.Predicate<io.jmix.core.metamodel.model.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 |
clearValues() |
protected LinkButton |
createConditionRemoveButton(SingleFilterComponent<?> singleFilter,
java.lang.String removeButtonId) |
protected LogicalFilterComponent |
createConfigurationRootLogicalFilterComponent(LogicalFilterComponent.Operation rootOperation) |
protected Action |
createResetFilterAction() |
Action |
getAction(java.lang.String id) |
java.util.Collection<Action> |
getActions() |
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.
|
protected java.lang.String |
getConfigurationCaption(Filter.Configuration configuration) |
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() |
io.jmix.core.querycondition.Condition |
getQueryCondition() |
protected void |
initAddConditionButton() |
protected void |
initEmptyConfiguration() |
protected void |
initRootComponent() |
protected void |
initSearchButton() |
protected void |
initSelectConfigurationButton() |
protected void |
initSettingsButton() |
boolean |
isAutoApply() |
boolean |
isCollapsable() |
boolean |
isExpanded() |
void |
loadConfigurationsAndApplyDefault()
Loads configurations for
Filter and apply default. |
protected void |
onCreate(CompositeComponent.CreateEvent createEvent) |
void |
refreshCurrentConfigurationLayout()
Refreshes the display of the current configuration.
|
void |
removeAction(Action action)
Remove the action from the component
|
void |
removeAction(java.lang.String id)
Remove the action by its ID.
|
void |
removeAllActions()
Remove all actions from the component
|
void |
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(io.jmix.core.AccessManager accessManager) |
void |
setActions(Actions actions) |
void |
setAutoApply(boolean autoApply)
Sets whether the filter should be automatically applied to the
DataLoader when the value component value is changed. |
void |
setCaption(java.lang.String caption)
Sets the component's caption.
|
void |
setCaptionPosition(SupportsCaptionPosition.CaptionPosition position)
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(io.jmix.core.security.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 a
DataLoader related to the filter. |
void |
setExpanded(boolean expanded) |
void |
setFilterSupport(FilterSupport filterSupport) |
void |
setMessages(io.jmix.core.Messages messages) |
void |
setMetadata(io.jmix.core.Metadata metadata) |
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.
|
void |
setScreenBuilders(ScreenBuilders screenBuilders) |
void |
setUiComponentProperties(UiComponentProperties componentProperties) |
void |
setUiComponents(UiComponents uiComponents) |
protected void |
updateActionsState() |
protected void |
updateConditionRemoveButton(SingleFilterComponent<?> singleFilter) |
protected void |
updateDataLoaderCondition() |
protected void |
updateRootLayoutCaption() |
protected void |
updateRootLogicalFilterComponent(LogicalFilterComponent logicalFilterComponent) |
protected void |
updateSearchButtonCaption(boolean autoApply) |
protected void |
updateSelectConfigurationButton() |
addAttachListener, addCreateListener, addDetachListener, addStyleName, assignDebugId, attached, detached, disableEventListeners, enableEventListeners, getAlignment, getComposition, getCompositionOrNull, getDebugId, getEventHub, getFrame, getHeight, getHeightSizeUnit, getId, getInnerComponent, getInnerComponentOptional, getParent, getStyleName, getUiEventListeners, getWidth, getWidthSizeUnit, hasSubscriptions, isAttached, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, publish, removeStyleName, setAlignment, setApplicationContext, setComposition, setDebugId, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setId, setParent, setResponsive, setStyleName, setUiEventListeners, setVisible, setWidth, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFrame, setFrame
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
getActionNN, getSubPart
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
isCaptionAsHtml, setCaptionAsHtml
getCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
getIcon, setIcon, setIconFromSet
protected static final java.lang.String FILTER_STYLENAME
protected static final java.lang.String FILTER_ROOT_COMPONENT_STYLENAME
protected Actions actions
protected io.jmix.core.security.CurrentAuthentication currentAuthentication
protected FilterSupport filterSupport
protected io.jmix.core.Messages messages
protected io.jmix.core.Metadata metadata
protected ScreenBuilders screenBuilders
protected UiComponents uiComponents
protected LogicalFilterComponent rootLogicalFilterComponent
protected ResponsiveGridLayout controlsLayout
protected CssLayout searchLayout
protected Button searchButton
protected PopupButton selectConfigurationButton
protected LinkButton addConditionButton
protected PopupButton settingsButton
protected DataLoader dataLoader
protected io.jmix.core.querycondition.Condition initialDataLoaderCondition
protected boolean autoApply
protected int columnsCount
protected SupportsCaptionPosition.CaptionPosition captionPosition
protected java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> propertiesFilterPredicate
protected Filter.Configuration emptyConfiguration
protected Filter.Configuration currentConfiguration
protected java.util.List<Filter.Configuration> configurations
protected java.util.List<FilterComponent> conditions
protected boolean configurationModifyPermitted
@Autowired public void setActions(Actions actions)
@Autowired public void setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication)
@Autowired public void setFilterSupport(FilterSupport filterSupport)
@Autowired public void setMessages(io.jmix.core.Messages messages)
@Autowired public void setMetadata(io.jmix.core.Metadata metadata)
@Autowired public void setScreenBuilders(ScreenBuilders screenBuilders)
@Autowired public void setUiComponents(UiComponents uiComponents)
@Autowired public void setUiComponentProperties(UiComponentProperties componentProperties)
@Autowired public void setAccessManager(io.jmix.core.AccessManager accessManager)
public boolean isExpanded()
isExpanded
in interface Collapsable
public void setExpanded(boolean expanded)
setExpanded
in interface Collapsable
public boolean isCollapsable()
isCollapsable
in interface Collapsable
public void setCollapsable(boolean collapsable)
setCollapsable
in interface Collapsable
public io.jmix.core.common.event.Subscription addExpandedStateChangeListener(java.util.function.Consumer<Collapsable.ExpandedStateChangeEvent> listener)
addExpandedStateChangeListener
in interface Collapsable
public DataLoader getDataLoader()
getDataLoader
in interface Filter
DataLoader
related to the filterpublic void setDataLoader(DataLoader dataLoader)
Filter
DataLoader
related to the filter.setDataLoader
in interface Filter
dataLoader
- a DataLoader
to setpublic boolean isAutoApply()
isAutoApply
in interface Filter
true
if the filter should be automatically applied to
the DataLoader
when the value component value is changedpublic void setAutoApply(boolean autoApply)
Filter
DataLoader
when the value component value is changed.setAutoApply
in interface Filter
autoApply
- true
if the filter should be automatically
applied to the DataLoader
when the value
component value is changedpublic void apply()
Filter
public SupportsCaptionPosition.CaptionPosition getCaptionPosition()
getCaptionPosition
in interface Filter
getCaptionPosition
in interface SupportsCaptionPosition
public void setCaptionPosition(SupportsCaptionPosition.CaptionPosition position)
Filter
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 Filter
setCaptionPosition
in interface SupportsCaptionPosition
position
- caption position of filter child componentspublic int getColumnsCount()
Filter
UiComponentProperties.getFilterColumnsCount()
.getColumnsCount
in interface Filter
getColumnsCount
in interface SupportsColumnsCount
public void setColumnsCount(int columnsCount)
Filter
UiComponentProperties.getFilterColumnsCount()
.setColumnsCount
in interface Filter
setColumnsCount
in interface SupportsColumnsCount
columnsCount
- the number of columns to be displayed on one row@Nullable public java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> getPropertiesFilterPredicate()
getPropertiesFilterPredicate
in interface Filter
public void setPropertiesFilterPredicate(@Nullable java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> propertiesFilterPredicate)
Filter
setPropertiesFilterPredicate
in interface Filter
propertiesFilterPredicate
- a predicate to setpublic void addPropertiesFilterPredicate(java.util.function.Predicate<io.jmix.core.metamodel.model.MetaPropertyPath> propertiesFilterPredicate)
Filter
addPropertiesFilterPredicate
in interface Filter
propertiesFilterPredicate
- a predicate to addpublic void setCurrentConfiguration(Filter.Configuration currentConfiguration)
Filter
setCurrentConfiguration
in interface Filter
currentConfiguration
- a configurationpublic Filter.Configuration getCurrentConfiguration()
Filter
getCurrentConfiguration
in interface Filter
public Filter.Configuration getConfiguration(java.lang.String id)
Filter
getConfiguration
in interface Filter
id
- the configuration idnull
if not foundpublic Filter.Configuration getEmptyConfiguration()
Filter
getEmptyConfiguration
in interface Filter
public java.util.List<Filter.Configuration> getConfigurations()
getConfigurations
in interface Filter
public DesignTimeConfiguration addConfiguration(java.lang.String id, @Nullable java.lang.String name)
Filter
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
.
addConfiguration
in interface Filter
id
- a configuration id. Must be unique within this filtername
- a configuration nameDesignTimeConfiguration
LogicalFilterComponent
public DesignTimeConfiguration addConfiguration(java.lang.String id, @Nullable java.lang.String name, LogicalFilterComponent.Operation rootOperation)
Filter
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
.
addConfiguration
in interface Filter
id
- a configuration id. Must be unique within this filtername
- a configuration namerootOperation
- an operation of root LogicalFilterComponent
DesignTimeConfiguration
public void addConfiguration(Filter.Configuration configuration)
Filter
addConfiguration
in interface Filter
configuration
- configuration to addDesignTimeConfiguration
,
RunTimeConfiguration
public void removeConfiguration(Filter.Configuration configuration)
Filter
removeConfiguration
in interface Filter
configuration
- configuration to removepublic void addCondition(FilterComponent filterComponent)
Filter
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
.addCondition
in interface Filter
filterComponent
- a filter component to add to conditionsFilterComponent
,
AddConditionScreen
,
RunTimeConfiguration
public java.util.List<FilterComponent> getConditions()
getConditions
in interface Filter
public void removeCondition(FilterComponent filterComponent)
Filter
removeCondition
in interface Filter
filterComponent
- a filter component to remove from conditionspublic io.jmix.core.common.event.Subscription addConfigurationChangeListener(java.util.function.Consumer<Filter.ConfigurationChangeEvent> listener)
Filter
Filter.Configuration
changes.addConfigurationChangeListener
in interface Filter
listener
- a listener to addpublic void loadConfigurationsAndApplyDefault()
Filter
Filter
and apply default.
NOTE: call this method after the frame is fully initialized
(for example, in ComponentLoader.PostInitTask
in a loader).loadConfigurationsAndApplyDefault
in interface Filter
public void refreshCurrentConfigurationLayout()
Filter
refreshCurrentConfigurationLayout
in interface Filter
public void addAction(Action action)
ActionsHolder
addAction
in interface ActionsHolder
public void addAction(Action action, int index)
ActionsHolder
addAction
in interface ActionsHolder
public void removeAction(Action action)
ActionsHolder
removeAction
in interface ActionsHolder
public void removeAction(java.lang.String id)
ActionsHolder
removeAction
in interface ActionsHolder
public void removeAllActions()
ActionsHolder
removeAllActions
in interface ActionsHolder
public java.util.Collection<Action> getActions()
getActions
in interface ActionsHolder
@Nullable public Action getAction(java.lang.String id)
getAction
in interface ActionsHolder
public void setCaption(@Nullable java.lang.String caption)
Component.HasCaption
setCaption
in interface Component.HasCaption
setCaption
in interface CompositeWithCaption
caption
- the new component's captionpublic io.jmix.core.querycondition.Condition getQueryCondition()
protected void onCreate(CompositeComponent.CreateEvent createEvent)
protected void initRootComponent()
protected void initEmptyConfiguration()
protected void initAddConditionButton()
protected void initSearchButton()
protected void initSelectConfigurationButton()
protected void initSettingsButton()
protected LinkButton createConditionRemoveButton(SingleFilterComponent<?> singleFilter, java.lang.String removeButtonId)
protected void removeFilterComponent(FilterComponent filterComponent)
protected Action createResetFilterAction()
protected LogicalFilterComponent createConfigurationRootLogicalFilterComponent(LogicalFilterComponent.Operation rootOperation)
protected void addSelectConfigurationAction(Filter.Configuration configuration)
protected java.lang.String getConfigurationCaption(Filter.Configuration configuration)
protected void updateRootLayoutCaption()
protected void updateSearchButtonCaption(boolean autoApply)
protected void updateDataLoaderCondition()
protected void updateActionsState()
protected void updateRootLogicalFilterComponent(LogicalFilterComponent logicalFilterComponent)
protected void updateConditionRemoveButton(SingleFilterComponent<?> singleFilter)
protected void resetFilterComponentDefaultValue(PropertyFilter<?> propertyFilter)
protected void updateSelectConfigurationButton()
protected void clearValues()