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

    Fields
    Modifier and Type
    Field
    Description
    protected org.springframework.context.ApplicationContext
     
    protected boolean
     
    protected boolean
     
    protected DataLoader
     
    protected static final String
     
    protected com.vaadin.flow.component.html.NativeLabel
     
    protected Consumer<String>
     
     
    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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addValidator(Validator<? super V> validator)
    Adds a validator to the list of validators for the component.
    void
     
    void
    Applies the current filter component condition.
    protected void
     
    void
     
    protected void
     
    protected com.vaadin.flow.component.html.NativeLabel
     
    protected abstract Condition
     
    protected com.vaadin.flow.component.orderedlayout.HorizontalLayout
     
    void
    Executes all registered validators against the current value of the component.
    void
     
    protected V
     
     
     
     
    abstract String
     
     
    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.HorizontalLayout
     
    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
     
    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
    setAriaLabel(String ariaLabel)
     
    void
     
    void
    setAutoApply(boolean autoApply)
    Sets whether the filter component should be automatically applied to the DataLoader when the value component value is changed.
    void
    setConditionModificationDelegated(boolean conditionModificationDelegated)
    Sets whether the modification of DataLoader condition is delegated to the owner FilterComponent or GenericFilter.
    void
    Sets a DataLoader related to the current filter component.
    void
    setInvalid(boolean invalid)
    Sets invalid state to the field considering result of field validation.
    void
     
    void
     
    protected void
     
    void
    Sets the position of the label for the component.
    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)
    Sets the required property for the component.
    void
    setRequiredMessage(String requiredMessage)
    Sets a message that will be displayed or logged when a required field or input is not provided.
    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
     

    Methods inherited from class com.vaadin.flow.component.customfield.CustomField

    add, addThemeVariants, 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, onAttach, 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.HasValidation

    setManualValidation

    Methods inherited from interface com.vaadin.flow.component.HasValue

    addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValue

    Methods inherited from interface com.vaadin.flow.component.HasValueAndElement

    isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible

    Methods inherited from interface io.jmix.flowui.component.filter.SingleFilterComponent

    getParameterName, getSubPart, setParameterName

    Methods inherited from interface io.jmix.flowui.component.SupportsValidation

    getErrorMessage, setErrorMessage
  • Field Details

    • FILTER_LABEL_CLASS_NAME

      protected static final String FILTER_LABEL_CLASS_NAME
      See Also:
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • uiComponents

      protected UiComponents uiComponents
    • valueComponent

      protected com.vaadin.flow.component.HasValueAndElement<?,V> valueComponent
    • dataLoader

      protected DataLoader dataLoader
    • autoApply

      protected boolean autoApply
    • queryCondition

      protected Condition queryCondition
    • conditionModificationDelegated

      protected boolean conditionModificationDelegated
    • root

      protected com.vaadin.flow.component.orderedlayout.HorizontalLayout root
    • label

      protected com.vaadin.flow.component.html.NativeLabel label
    • labelText

      protected String labelText
    • labelWidth

      protected String labelWidth
    • labelVisible

      protected boolean labelVisible
    • labelPosition

      protected SupportsLabelPosition.LabelPosition labelPosition
    • labelDelegate

      protected Consumer<String> labelDelegate
  • Constructor Details

    • SingleFilterComponentBase

      public SingleFilterComponentBase()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • autowireDependencies

      protected void autowireDependencies()
    • initComponent

      protected void initComponent()
    • onFilterValueChanged

      protected void onFilterValueChanged(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,V> event)
    • 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

      protected V generateModelValue()
      Specified by:
      generateModelValue in class com.vaadin.flow.component.customfield.CustomField<V>
    • setPresentationValue

      protected void setPresentationValue(V newPresentationValue)
      Specified by:
      setPresentationValue in class com.vaadin.flow.component.customfield.CustomField<V>
    • createQueryCondition

      protected abstract Condition createQueryCondition()
    • updateQueryCondition

      protected abstract void updateQueryCondition(@Nullable V newValue)
    • getDataLoader

      public DataLoader getDataLoader()
      Specified by:
      getDataLoader in interface FilterComponent
      Returns:
      a DataLoader related to the current filter component
    • setDataLoader

      public void setDataLoader(DataLoader dataLoader)
      Description copied from interface: FilterComponent
      Sets a DataLoader related to the current filter component.
      Specified by:
      setDataLoader in interface FilterComponent
      Parameters:
      dataLoader - a DataLoader to set
    • updateDataLoaderCondition

      protected void updateDataLoaderCondition()
    • isAutoApply

      public boolean isAutoApply()
      Specified by:
      isAutoApply in interface FilterComponent
      Returns:
      true if the filter component should be automatically applied to the DataLoader 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 the DataLoader when the value component value is changed.
      Specified by:
      setAutoApply in interface FilterComponent
      Parameters:
      autoApply - true if the filter component should be automatically applied to the DataLoader when the value component value is changed
    • isConditionModificationDelegated

      public boolean isConditionModificationDelegated()
      Specified by:
      isConditionModificationDelegated in interface FilterComponent
      Returns:
      true if the filter component is located inside the GenericFilter and the modification of DataLoader condition is delegated to the owner FilterComponent or GenericFilter, false otherwise
    • setConditionModificationDelegated

      public void setConditionModificationDelegated(boolean conditionModificationDelegated)
      Description copied from interface: FilterComponent
      Sets whether the modification of DataLoader condition is delegated to the owner FilterComponent or GenericFilter.
      Specified by:
      setConditionModificationDelegated in interface FilterComponent
      Parameters:
      conditionModificationDelegated - true if the filter component is located inside the GenericFilter and the modification of DataLoader condition is delegated to the owner FilterComponent or GenericFilter, false otherwise
    • getQueryCondition

      public Condition getQueryCondition()
      Specified by:
      getQueryCondition in interface FilterComponent
      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 interface FilterComponent
    • setupLoaderFirstResult

      protected void setupLoaderFirstResult()
    • getLabel

      @Nullable public String getLabel()
      Specified by:
      getLabel in interface com.vaadin.flow.component.HasLabel
      Overrides:
      getLabel in class com.vaadin.flow.component.customfield.CustomField<V>
    • setLabel

      public void setLabel(@Nullable String label)
      Specified by:
      setLabel in interface com.vaadin.flow.component.HasLabel
      Overrides:
      setLabel in class com.vaadin.flow.component.customfield.CustomField<V>
    • setLabelInternal

      protected void setLabelInternal(@Nullable String labelText)
    • setLabelDelegate

      public void setLabelDelegate(Consumer<String> labelDelegate)
    • getLabelPosition

      public SupportsLabelPosition.LabelPosition getLabelPosition()
      Description copied from interface: SupportsLabelPosition
      Returns the current label position of the component.
      Specified by:
      getLabelPosition in interface SupportsLabelPosition
      Returns:
      the label position indicating the position of the label
    • setLabelPosition

      public void setLabelPosition(SupportsLabelPosition.LabelPosition labelPosition)
      Description copied from interface: SupportsLabelPosition
      Sets the position of the label for the component.
      Specified by:
      setLabelPosition in interface SupportsLabelPosition
      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

      public abstract String getInnerComponentPrefix()
    • getLabelWidth

      @Nullable public String getLabelWidth()
      Specified by:
      getLabelWidth in interface SingleFilterComponent<V>
      Returns:
      the width which has been set for the label
    • setLabelWidth

      public void setLabelWidth(@Nullable String labelWidth)
      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 interface SingleFilterComponent<V>
      Parameters:
      labelWidth - the width to set, may be null
    • isLabelVisible

      public boolean isLabelVisible()
      Specified by:
      isLabelVisible in interface SingleFilterComponent<V>
      Returns:
      true if label is visible
    • setLabelVisible

      public void setLabelVisible(boolean labelVisible)
      Description copied from interface: SingleFilterComponent
      Sets label visibility. Default value is true.
      Specified by:
      setLabelVisible in interface SingleFilterComponent<V>
      Parameters:
      labelVisible - whether to show label or not
    • setWidth

      public void setWidth(String width)
      Specified by:
      setWidth in interface com.vaadin.flow.component.HasSize
    • getValueComponent

      public com.vaadin.flow.component.HasValueAndElement<?,V> getValueComponent()
      Specified by:
      getValueComponent in interface SingleFilterComponent<V>
      Returns:
      a field for editing a property value
    • setValueComponent

      public void setValueComponent(com.vaadin.flow.component.HasValueAndElement<?,V> valueComponent)
      Description copied from interface: SingleFilterComponent
      Sets the field for editing a property value.
      Specified by:
      setValueComponent in interface SingleFilterComponent<V>
      Parameters:
      valueComponent - a field for editing a property value
    • initValueComponent

      protected void initValueComponent(com.vaadin.flow.component.HasValueAndElement<?,V> valueComponent)
    • onFieldValueChanged

      protected void onFieldValueChanged(com.vaadin.flow.component.HasValue.ValueChangeEvent<V> valueChangeEvent)
    • onFieldStatusChanged

      protected void onFieldStatusChanged(SupportsStatusChangeHandler.StatusContext<?> statusContext)
    • onFieldInvalidChanged

      protected void onFieldInvalidChanged(com.vaadin.flow.dom.PropertyChangeEvent event)
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,V>,V>
      Specified by:
      setReadOnly in interface com.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 interface com.vaadin.flow.component.HasValidation
      Specified by:
      isInvalid in interface com.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 interface com.vaadin.flow.component.HasValidation
      Specified by:
      setInvalid in interface com.vaadin.flow.component.shared.HasValidationProperties
      Specified by:
      setInvalid in interface SupportsValidation<V>
      Parameters:
      invalid - whether field should be invalid
    • getRequiredMessage

      @Nullable public String getRequiredMessage()
      Description copied from interface: HasRequired
      Returns 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:
      getRequiredMessage in interface HasRequired
      Returns:
      the required message set for the component, or null if no message is defined
    • setRequiredMessage

      public void setRequiredMessage(@Nullable String requiredMessage)
      Description copied from interface: HasRequired
      Sets a message that will be displayed or logged when a required field or input is not provided.
      Specified by:
      setRequiredMessage in interface HasRequired
      Parameters:
      requiredMessage - the message to be set for required fields. If null, the default message or no message will be used.
    • setRequired

      public void setRequired(boolean required)
      Description copied from interface: HasRequired
      Sets 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:
      setRequired in interface HasRequired
      Parameters:
      required - a boolean value indicating whether the component is marked as required. true to mark the component as required, false otherwise.
    • addValidator

      public com.vaadin.flow.shared.Registration addValidator(Validator<? super V> validator)
      Description copied from interface: SupportsValidation
      Adds 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:
      addValidator in interface SupportsValidation<V>
      Parameters:
      validator - the validator to be added; should not be null
      Returns:
      a Registration object that allows removing the added validator
    • executeValidators

      public void executeValidators() throws ValidationException
      Description copied from interface: SupportsValidation
      Executes all registered validators against the current value of the component. If any of the validators fail, a ValidationException is thrown to indicate the failure. The exact behavior and order of validation depend on the validators added.
      Specified by:
      executeValidators in interface SupportsValidation<V>
      Throws:
      ValidationException - if validation fails for one or more validators
    • setTabIndex

      public void setTabIndex(int tabIndex)
      Specified by:
      setTabIndex in interface com.vaadin.flow.component.Focusable<V>
    • getAriaLabel

      public Optional<String> getAriaLabel()
      Specified by:
      getAriaLabel in interface com.vaadin.flow.component.HasAriaLabel
    • setAriaLabel

      public void setAriaLabel(String ariaLabel)
      Specified by:
      setAriaLabel in interface com.vaadin.flow.component.HasAriaLabel
    • getAriaLabelledBy

      public Optional<String> getAriaLabelledBy()
      Specified by:
      getAriaLabelledBy in interface com.vaadin.flow.component.HasAriaLabel
    • setAriaLabelledBy

      public void setAriaLabelledBy(String labelledBy)
      Specified by:
      setAriaLabelledBy in interface com.vaadin.flow.component.HasAriaLabel
    • focus

      public void focus()
      Specified by:
      focus in interface com.vaadin.flow.component.Focusable<V>
    • blur

      public void blur()
      Specified by:
      blur in interface com.vaadin.flow.component.Focusable<V>
    • checkValueComponentState

      protected void checkValueComponentState()