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.HasAriaLabel,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,com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,,V>, V> FilterComponent,SingleFilterComponent<V>,HasRequired,SupportsLabelPosition,SupportsValidation<V>,HasSubParts,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
FullTextFilter,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, com.vaadin.flow.component.HasAriaLabel, 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
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected booleanprotected booleanprotected DataLoaderprotected static final Stringprotected com.vaadin.flow.component.html.NativeLabelprotected SupportsLabelPosition.LabelPositionprotected Stringprotected booleanprotected Stringprotected Conditionprotected com.vaadin.flow.component.orderedlayout.HorizontalLayoutprotected UiComponentsprotected com.vaadin.flow.component.HasValueAndElement<?,V> Fields inherited from interface io.jmix.flowui.component.HasRequired
PROPERTY_REQUIREDFields inherited from interface io.jmix.flowui.component.SupportsValidation
PROPERTY_ERROR_MESSAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddValidator(Validator<? super V> validator) Adds a validator to the list of validators for the component.voidvoidapply()Applies the current filter component condition.protected voidvoidblur()protected voidprotected com.vaadin.flow.component.html.NativeLabelprotected abstract Conditionprotected com.vaadin.flow.component.orderedlayout.HorizontalLayoutvoidExecutes all registered validators against the current value of the component.voidfocus()protected Vabstract StringgetLabel()Returns the current label position of the component.Returns the custom validation message to be displayed if the component is marked as required and the validation fails due to a missing value.com.vaadin.flow.component.orderedlayout.HorizontalLayoutgetRoot()com.vaadin.flow.component.HasValueAndElement<?,V> protected voidprotected voidinitRootComponent(com.vaadin.flow.component.orderedlayout.HorizontalLayout root) protected voidinitValueComponent(com.vaadin.flow.component.HasValueAndElement<?, V> valueComponent) booleanbooleanbooleanbooleanprotected voidonFieldInvalidChanged(com.vaadin.flow.dom.PropertyChangeEvent event) protected voidonFieldStatusChanged(SupportsStatusChangeHandler.StatusContext<?> statusContext) protected voidonFieldValueChanged(com.vaadin.flow.component.HasValue.ValueChangeEvent<V> valueChangeEvent) protected voidonFilterValueChanged(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>, V> event) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetAriaLabel(String ariaLabel) voidsetAriaLabelledBy(String labelledBy) voidsetAutoApply(boolean autoApply) Sets whether the filter component should be automatically applied to theDataLoaderwhen the value component value is changed.voidsetConditionModificationDelegated(boolean conditionModificationDelegated) Sets whether the modification ofDataLoadercondition is delegated to the ownerFilterComponentorGenericFilter.voidsetDataLoader(DataLoader dataLoader) Sets aDataLoaderrelated to the current filter component.voidsetInvalid(boolean invalid) Sets invalid state to the field considering result of field validation.voidvoidsetLabelDelegate(Consumer<String> labelDelegate) protected voidsetLabelInternal(String labelText) voidsetLabelPosition(SupportsLabelPosition.LabelPosition labelPosition) Sets the position of the label for the component.voidsetLabelVisible(boolean labelVisible) Sets label visibility.voidsetLabelWidth(String labelWidth) Sets the label width.protected voidsetPresentationValue(V newPresentationValue) voidsetReadOnly(boolean readOnly) voidsetRequired(boolean required) Sets the required property for the component.voidsetRequiredMessage(String requiredMessage) Sets a message that will be displayed or logged when a required field or input is not provided.voidsetTabIndex(int tabIndex) protected voidvoidsetValueComponent(com.vaadin.flow.component.HasValueAndElement<?, V> valueComponent) Sets the field for editing a property value.voidprotected voidprotected voidprotected voidprotected abstract voidupdateQueryCondition(V newValue) Methods inherited from class com.vaadin.flow.component.customfield.CustomField
add, addThemeVariants, remove, removeThemeVariants, updateValueMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods 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, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, getTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface io.jmix.flowui.component.HasRequired
isRequiredMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisibleMethods inherited from interface io.jmix.flowui.component.filter.SingleFilterComponent
getParameterName, getSubPart, setParameterNameMethods 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.NativeLabel 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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin 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:
generateModelValuein classcom.vaadin.flow.component.customfield.CustomField<V>
-
setPresentationValue
- Specified by:
setPresentationValuein classcom.vaadin.flow.component.customfield.CustomField<V>
-
createQueryCondition
-
updateQueryCondition
-
getDataLoader
- Specified by:
getDataLoaderin interfaceFilterComponent- Returns:
- a
DataLoaderrelated to the current filter component
-
setDataLoader
Description copied from interface:FilterComponentSets aDataLoaderrelated to the current filter component.- Specified by:
setDataLoaderin interfaceFilterComponent- Parameters:
dataLoader- aDataLoaderto set
-
updateDataLoaderCondition
protected void updateDataLoaderCondition() -
isAutoApply
public boolean isAutoApply()- Specified by:
isAutoApplyin interfaceFilterComponent- Returns:
trueif the filter component should be automatically applied to theDataLoaderwhen the value component value is changed
-
setAutoApply
public void setAutoApply(boolean autoApply) Description copied from interface:FilterComponentSets whether the filter component should be automatically applied to theDataLoaderwhen the value component value is changed.- Specified by:
setAutoApplyin interfaceFilterComponent- Parameters:
autoApply-trueif the filter component should be automatically applied to theDataLoaderwhen the value component value is changed
-
isConditionModificationDelegated
public boolean isConditionModificationDelegated()- Specified by:
isConditionModificationDelegatedin interfaceFilterComponent- Returns:
trueif the filter component is located inside theGenericFilterand the modification ofDataLoadercondition is delegated to the ownerFilterComponentorGenericFilter,falseotherwise
-
setConditionModificationDelegated
public void setConditionModificationDelegated(boolean conditionModificationDelegated) Description copied from interface:FilterComponentSets whether the modification ofDataLoadercondition is delegated to the ownerFilterComponentorGenericFilter.- Specified by:
setConditionModificationDelegatedin interfaceFilterComponent- Parameters:
conditionModificationDelegated-trueif the filter component is located inside theGenericFilterand the modification ofDataLoadercondition is delegated to the ownerFilterComponentorGenericFilter,falseotherwise
-
getQueryCondition
- Specified by:
getQueryConditionin interfaceFilterComponent- Returns:
- a
Conditionrelated to the current filter component
-
apply
public void apply()Description copied from interface:FilterComponentApplies the current filter component condition.- Specified by:
applyin interfaceFilterComponent
-
setupLoaderFirstResult
protected void setupLoaderFirstResult() -
getLabel
- Specified by:
getLabelin interfacecom.vaadin.flow.component.HasLabel- Overrides:
getLabelin classcom.vaadin.flow.component.customfield.CustomField<V>
-
setLabel
- Specified by:
setLabelin interfacecom.vaadin.flow.component.HasLabel- Overrides:
setLabelin classcom.vaadin.flow.component.customfield.CustomField<V>
-
setLabelInternal
-
setLabelDelegate
-
getLabelPosition
Description copied from interface:SupportsLabelPositionReturns the current label position of the component.- Specified by:
getLabelPositionin interfaceSupportsLabelPosition- Returns:
- the label position indicating the position of the label
-
setLabelPosition
Description copied from interface:SupportsLabelPositionSets the position of the label for the component.- Specified by:
setLabelPositionin interfaceSupportsLabelPosition- Parameters:
labelPosition- the label position to define the position of the label
-
updateChildAlignment
protected void updateChildAlignment() -
updateLabelLayout
protected void updateLabelLayout() -
createLabel
protected com.vaadin.flow.component.html.NativeLabel createLabel() -
getInnerComponentPrefix
-
getLabelWidth
- Specified by:
getLabelWidthin interfaceSingleFilterComponent<V>- Returns:
- the width which has been set for the label
-
setLabelWidth
Description copied from interface:SingleFilterComponentSets the label width.The width should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided
widthvalue is null then width is removed.- Specified by:
setLabelWidthin interfaceSingleFilterComponent<V>- Parameters:
labelWidth- the width to set, may benull
-
isLabelVisible
public boolean isLabelVisible()- Specified by:
isLabelVisiblein interfaceSingleFilterComponent<V>- Returns:
trueif label is visible
-
setLabelVisible
public void setLabelVisible(boolean labelVisible) Description copied from interface:SingleFilterComponentSets label visibility. Default value istrue.- Specified by:
setLabelVisiblein interfaceSingleFilterComponent<V>- Parameters:
labelVisible- whether to show label or not
-
setWidth
- Specified by:
setWidthin interfacecom.vaadin.flow.component.HasSize
-
getValueComponent
- Specified by:
getValueComponentin interfaceSingleFilterComponent<V>- Returns:
- a field for editing a property value
-
setValueComponent
Description copied from interface:SingleFilterComponentSets the field for editing a property value.- Specified by:
setValueComponentin 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:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,V>, V> - Specified by:
setReadOnlyin 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:
isInvalidin interfacecom.vaadin.flow.component.HasValidation- Specified by:
isInvalidin interfacecom.vaadin.flow.component.shared.HasValidationProperties
-
setInvalid
public void setInvalid(boolean invalid) Description copied from interface:SupportsValidationSets 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:
setInvalidin interfacecom.vaadin.flow.component.HasValidation- Specified by:
setInvalidin interfacecom.vaadin.flow.component.shared.HasValidationProperties- Specified by:
setInvalidin interfaceSupportsValidation<V>- Parameters:
invalid- whether field should be invalid
-
getRequiredMessage
Description copied from interface:HasRequiredReturns the custom validation message to be displayed if the component is marked as required and the validation fails due to a missing value.- Specified by:
getRequiredMessagein interfaceHasRequired- Returns:
- the required message set for the component, or
nullif no message is defined
-
setRequiredMessage
Description copied from interface:HasRequiredSets a message that will be displayed or logged when a required field or input is not provided.- Specified by:
setRequiredMessagein interfaceHasRequired- Parameters:
requiredMessage- the message to be set for required fields. Ifnull, the default message or no message will be used.
-
setRequired
public void setRequired(boolean required) Description copied from interface:HasRequiredSets the required property for the component. When a component is marked as required, it indicates that a value must be provided for the component in order to pass validation.- Specified by:
setRequiredin interfaceHasRequired- Parameters:
required- a boolean value indicating whether the component is marked as required.trueto mark the component as required,falseotherwise.
-
addValidator
Description copied from interface:SupportsValidationAdds a validator to the list of validators for the component. The provided validator will be used to validate the value of the component during validation execution.- Specified by:
addValidatorin interfaceSupportsValidation<V>- Parameters:
validator- the validator to be added; should not benull- Returns:
- a
Registrationobject that allows removing the added validator
-
executeValidators
Description copied from interface:SupportsValidationExecutes all registered validators against the current value of the component. If any of the validators fail, aValidationExceptionis thrown to indicate the failure. The exact behavior and order of validation depend on the validators added.- Specified by:
executeValidatorsin interfaceSupportsValidation<V>- Throws:
ValidationException- if validation fails for one or more validators
-
setTabIndex
public void setTabIndex(int tabIndex) - Specified by:
setTabIndexin interfacecom.vaadin.flow.component.Focusable<V>
-
getAriaLabel
- Specified by:
getAriaLabelin interfacecom.vaadin.flow.component.HasAriaLabel
-
setAriaLabel
- Specified by:
setAriaLabelin interfacecom.vaadin.flow.component.HasAriaLabel
-
getAriaLabelledBy
- Specified by:
getAriaLabelledByin interfacecom.vaadin.flow.component.HasAriaLabel
-
setAriaLabelledBy
- Specified by:
setAriaLabelledByin interfacecom.vaadin.flow.component.HasAriaLabel
-
focus
public void focus()- Specified by:
focusin interfacecom.vaadin.flow.component.Focusable<V>
-
blur
public void blur()- Specified by:
blurin interfacecom.vaadin.flow.component.Focusable<V>
-
checkValueComponentState
protected void checkValueComponentState()
-