Package io.jmix.flowui.component.filter
Class SingleFilterComponentBase<V>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<V>
io.jmix.flowui.component.filter.SingleFilterComponentBase<V>
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField<V>>
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<V>>
,com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField<V>>
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasEnabled
,com.vaadin.flow.component.HasHelper
,com.vaadin.flow.component.HasLabel
,com.vaadin.flow.component.HasSize
,com.vaadin.flow.component.HasStyle
,com.vaadin.flow.component.HasTheme
,com.vaadin.flow.component.HasValidation
,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,
,V>, V> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,
,V>, V> com.vaadin.flow.component.shared.HasTooltip
,com.vaadin.flow.component.shared.HasValidationProperties
,FilterComponent
,SingleFilterComponent<V>
,HasRequired
,SupportsLabelPosition
,SupportsValidation<V>
,Serializable
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
JpqlFilter
,PropertyFilter
public abstract class SingleFilterComponentBase<V>
extends com.vaadin.flow.component.customfield.CustomField<V>
implements SingleFilterComponent<V>, SupportsLabelPosition, SupportsValidation<V>, HasRequired, com.vaadin.flow.component.shared.HasTooltip, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,
V extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>
Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
Nested classes/interfaces inherited from interface io.jmix.flowui.component.SupportsLabelPosition
SupportsLabelPosition.LabelPosition
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected boolean
protected boolean
protected DataLoader
protected static final String
protected com.vaadin.flow.component.html.Label
protected SupportsLabelPosition.LabelPosition
protected String
protected boolean
protected String
protected Condition
protected com.vaadin.flow.component.orderedlayout.HorizontalLayout
protected UiComponents
protected com.vaadin.flow.component.HasValueAndElement<?,
V> Fields inherited from interface io.jmix.flowui.component.HasRequired
PROPERTY_REQUIRED
Fields inherited from interface io.jmix.flowui.component.SupportsValidation
PROPERTY_ERROR_MESSAGE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.Registration
addValidator
(Validator<? super V> validator) void
void
apply()
Applies the current filter component condition.protected void
void
blur()
protected void
protected com.vaadin.flow.component.html.Label
protected abstract Condition
protected com.vaadin.flow.component.orderedlayout.HorizontalLayout
void
void
focus()
protected V
abstract String
getLabel()
com.vaadin.flow.component.orderedlayout.HorizontalLayout
getRoot()
com.vaadin.flow.component.HasValueAndElement<?,
V> protected void
protected void
initRootComponent
(com.vaadin.flow.component.orderedlayout.HorizontalLayout root) protected void
initValueComponent
(com.vaadin.flow.component.HasValueAndElement<?, V> valueComponent) boolean
boolean
boolean
boolean
protected void
onFieldInvalidChanged
(com.vaadin.flow.dom.PropertyChangeEvent event) protected void
onFieldStatusChanged
(SupportsStatusChangeHandler.StatusContext<?> statusContext) protected void
onFieldValueChanged
(com.vaadin.flow.component.HasValue.ValueChangeEvent<V> valueChangeEvent) protected void
onFilterValueChanged
(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>, V> event) void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setAutoApply
(boolean autoApply) Sets whether the filter component should be automatically applied to theDataLoader
when the value component value is changed.void
setConditionModificationDelegated
(boolean conditionModificationDelegated) Sets whether the modification ofDataLoader
condition is delegated to the ownerFilterComponent
orGenericFilter
.void
setDataLoader
(DataLoader dataLoader) Sets aDataLoader
related to the current filter component.void
setInvalid
(boolean invalid) Sets invalid state to the field considering result of field validation.void
void
setLabelDelegate
(Consumer<String> labelDelegate) protected void
setLabelInternal
(String labelText) void
setLabelPosition
(SupportsLabelPosition.LabelPosition labelPosition) void
setLabelVisible
(boolean labelVisible) Sets label visibility.void
setLabelWidth
(String labelWidth) Sets the label width.protected void
setPresentationValue
(V newPresentationValue) void
setReadOnly
(boolean readOnly) void
setRequired
(boolean required) void
setRequiredMessage
(String requiredMessage) void
setTabIndex
(int tabIndex) protected void
void
setValueComponent
(com.vaadin.flow.component.HasValueAndElement<?, V> valueComponent) Sets the field for editing a property value.void
protected void
protected void
protected void
protected abstract void
updateQueryCondition
(V newValue) Methods inherited from class com.vaadin.flow.component.customfield.CustomField
add, addThemeVariants, onAttach, remove, removeThemeVariants, updateValue
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, getTabIndex
Methods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListener
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
Methods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperText
Methods inherited from interface io.jmix.flowui.component.HasRequired
isRequired
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipText
Methods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValue
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible
Methods inherited from interface io.jmix.flowui.component.filter.SingleFilterComponent
getParameterName, setParameterName
Methods inherited from interface io.jmix.flowui.component.SupportsValidation
getErrorMessage, setErrorMessage
-
Field Details
-
FILTER_LABEL_CLASS_NAME
- See Also:
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
uiComponents
-
valueComponent
-
dataLoader
-
autoApply
protected boolean autoApply -
queryCondition
-
conditionModificationDelegated
protected boolean conditionModificationDelegated -
root
protected com.vaadin.flow.component.orderedlayout.HorizontalLayout root -
label
protected com.vaadin.flow.component.html.Label label -
labelText
-
labelWidth
-
labelVisible
protected boolean labelVisible -
labelPosition
-
labelDelegate
-
-
Constructor Details
-
SingleFilterComponentBase
public SingleFilterComponentBase()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
autowireDependencies
protected void autowireDependencies() -
initComponent
protected void initComponent() -
onFilterValueChanged
-
createRootComponent
protected com.vaadin.flow.component.orderedlayout.HorizontalLayout createRootComponent() -
initRootComponent
protected void initRootComponent(com.vaadin.flow.component.orderedlayout.HorizontalLayout root) -
getRoot
public com.vaadin.flow.component.orderedlayout.HorizontalLayout getRoot() -
generateModelValue
- Specified by:
generateModelValue
in classcom.vaadin.flow.component.customfield.CustomField<V>
-
setPresentationValue
- Specified by:
setPresentationValue
in classcom.vaadin.flow.component.customfield.CustomField<V>
-
createQueryCondition
-
updateQueryCondition
-
getDataLoader
- Specified by:
getDataLoader
in interfaceFilterComponent
- Returns:
- a
DataLoader
related to the current filter component
-
setDataLoader
Description copied from interface:FilterComponent
Sets aDataLoader
related to the current filter component.- Specified by:
setDataLoader
in interfaceFilterComponent
- Parameters:
dataLoader
- aDataLoader
to set
-
updateDataLoaderCondition
protected void updateDataLoaderCondition() -
isAutoApply
public boolean isAutoApply()- Specified by:
isAutoApply
in interfaceFilterComponent
- Returns:
true
if the filter component should be automatically applied to theDataLoader
when the value component value is changed
-
setAutoApply
public void setAutoApply(boolean autoApply) Description copied from interface:FilterComponent
Sets whether the filter component should be automatically applied to theDataLoader
when the value component value is changed.- Specified by:
setAutoApply
in interfaceFilterComponent
- Parameters:
autoApply
-true
if the filter component should be automatically applied to theDataLoader
when the value component value is changed
-
isConditionModificationDelegated
public boolean isConditionModificationDelegated()- Specified by:
isConditionModificationDelegated
in interfaceFilterComponent
- Returns:
true
if the filter component is located inside theGenericFilter
and the modification ofDataLoader
condition is delegated to the ownerFilterComponent
orGenericFilter
,false
otherwise
-
setConditionModificationDelegated
public void setConditionModificationDelegated(boolean conditionModificationDelegated) Description copied from interface:FilterComponent
Sets whether the modification ofDataLoader
condition is delegated to the ownerFilterComponent
orGenericFilter
.- Specified by:
setConditionModificationDelegated
in interfaceFilterComponent
- Parameters:
conditionModificationDelegated
-true
if the filter component is located inside theGenericFilter
and the modification ofDataLoader
condition is delegated to the ownerFilterComponent
orGenericFilter
,false
otherwise
-
getQueryCondition
- Specified by:
getQueryCondition
in interfaceFilterComponent
- Returns:
- a
Condition
related to the current filter component
-
apply
public void apply()Description copied from interface:FilterComponent
Applies the current filter component condition.- Specified by:
apply
in interfaceFilterComponent
-
setupLoaderFirstResult
protected void setupLoaderFirstResult() -
getLabel
- Specified by:
getLabel
in interfacecom.vaadin.flow.component.HasLabel
- Overrides:
getLabel
in classcom.vaadin.flow.component.customfield.CustomField<V>
-
setLabel
- Specified by:
setLabel
in interfacecom.vaadin.flow.component.HasLabel
- Overrides:
setLabel
in classcom.vaadin.flow.component.customfield.CustomField<V>
-
setLabelInternal
-
setLabelDelegate
-
getLabelPosition
- Specified by:
getLabelPosition
in interfaceSupportsLabelPosition
-
setLabelPosition
- Specified by:
setLabelPosition
in interfaceSupportsLabelPosition
-
updateChildAlignment
protected void updateChildAlignment() -
updateLabelLayout
protected void updateLabelLayout() -
createLabel
protected com.vaadin.flow.component.html.Label createLabel() -
getInnerComponentPrefix
-
getLabelWidth
- Specified by:
getLabelWidth
in interfaceSingleFilterComponent<V>
- Returns:
- the width which has been set for the label
-
setLabelWidth
Description copied from interface:SingleFilterComponent
Sets the label width.The width should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided
width
value is null then width is removed.- Specified by:
setLabelWidth
in interfaceSingleFilterComponent<V>
- Parameters:
labelWidth
- the width to set, may benull
-
isLabelVisible
public boolean isLabelVisible()- Specified by:
isLabelVisible
in interfaceSingleFilterComponent<V>
- Returns:
true
if label is visible
-
setLabelVisible
public void setLabelVisible(boolean labelVisible) Description copied from interface:SingleFilterComponent
Sets label visibility. Default value istrue
.- Specified by:
setLabelVisible
in interfaceSingleFilterComponent<V>
- Parameters:
labelVisible
- whether to show label or not
-
setWidth
- Specified by:
setWidth
in interfacecom.vaadin.flow.component.HasSize
-
getValueComponent
- Specified by:
getValueComponent
in interfaceSingleFilterComponent<V>
- Returns:
- a field for editing a property value
-
setValueComponent
Description copied from interface:SingleFilterComponent
Sets the field for editing a property value.- Specified by:
setValueComponent
in interfaceSingleFilterComponent<V>
- Parameters:
valueComponent
- a field for editing a property value
-
initValueComponent
-
onFieldValueChanged
protected void onFieldValueChanged(com.vaadin.flow.component.HasValue.ValueChangeEvent<V> valueChangeEvent) -
onFieldStatusChanged
-
onFieldInvalidChanged
protected void onFieldInvalidChanged(com.vaadin.flow.dom.PropertyChangeEvent event) -
setReadOnly
public void setReadOnly(boolean readOnly) - Specified by:
setReadOnly
in interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,
V>, V> - Specified by:
setReadOnly
in interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,
V>, V>
-
isInvalid
public boolean isInvalid()- Specified by:
isInvalid
in interfacecom.vaadin.flow.component.HasValidation
- Specified by:
isInvalid
in interfacecom.vaadin.flow.component.shared.HasValidationProperties
-
setInvalid
public void setInvalid(boolean invalid) Description copied from interface:SupportsValidation
Sets invalid state to the field considering result of field validation.- Invalid - false and validation passed - false = field is invalid
- Invalid - false and validation passed - true = field is valid
- Invalid - true and validation passed - false = field is invalid
- Invalid - true and validation passed - true = field is invalid
- Specified by:
setInvalid
in interfacecom.vaadin.flow.component.HasValidation
- Specified by:
setInvalid
in interfacecom.vaadin.flow.component.shared.HasValidationProperties
- Specified by:
setInvalid
in interfaceSupportsValidation<V>
- Parameters:
invalid
- whether field should be invalid
-
getRequiredMessage
- Specified by:
getRequiredMessage
in interfaceHasRequired
-
setRequiredMessage
- Specified by:
setRequiredMessage
in interfaceHasRequired
-
setRequired
public void setRequired(boolean required) - Specified by:
setRequired
in interfaceHasRequired
-
addValidator
- Specified by:
addValidator
in interfaceSupportsValidation<V>
-
executeValidators
- Specified by:
executeValidators
in interfaceSupportsValidation<V>
- Throws:
ValidationException
-
setTabIndex
public void setTabIndex(int tabIndex) - Specified by:
setTabIndex
in interfacecom.vaadin.flow.component.Focusable<V>
-
focus
public void focus()- Specified by:
focus
in interfacecom.vaadin.flow.component.Focusable<V>
-
blur
public void blur()- Specified by:
blur
in interfacecom.vaadin.flow.component.Focusable<V>
-
checkValueComponentState
protected void checkValueComponentState()
-