Class AbstractSliderDelegate<C extends com.vaadin.flow.component.AbstractField<?,V>,T extends Number,V extends Number>
- Type Parameters:
C- component typeT- value source value typeV- component value type
- All Implemented Interfaces:
ValueBindingDelegate<T>,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
DecimalSliderDelegate,IntegerSliderDelegate
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.component.delegate.ValueBindingDelegate
ValueBindingDelegate.ValueBindingChangeEvent<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.vaadin.flow.shared.Registrationprotected com.vaadin.flow.shared.Registrationprotected booleanFields inherited from class io.jmix.flowui.component.delegate.AbstractFieldDelegate
applicationContext, conversionInvalid, datatype, errorMessage, explicitlyInvalid, immediateRequiredValidationEnabled, messages, metadataTools, PROPERTY_INVALID, requiredMessage, statusChangeHandler, toModelConverter, uiComponentProperties, validatorsFields inherited from class io.jmix.flowui.component.delegate.AbstractValueComponentDelegate
valueBindingFields inherited from class io.jmix.flowui.component.delegate.AbstractComponentDelegate
component -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearValue(Runnable clearComponentValueAction) Clears the value of the component.protected AbstractValueBinding<T> createValueBinding(ValueSource<T> valueSource) protected @Nullable TgetMaxValidator(T max) getMinValidator(T min) booleanisEmpty()Checks whether the component has no value.voidHandles a value that has been set to the component: makes sure the value reaches the value source and records that the component has a value.voidvoidprotected voidsetValueSet(boolean valueSet) Records whether a value has been set to the component.protected voidUpdates the validation state after the empty state of the component may have changed without a value change event.Methods inherited from class io.jmix.flowui.component.delegate.AbstractFieldDelegate
addUnparsableChangeListener, addValidator, applyDefaultValueFormat, checkUnparseableValue, executeValidators, formatMessage, getDatatype, getErrorMessage, getMessage, getRequiredErrorMessage, getRequiredMessage, initComponent, isEmptyAndRequired, isInvalid, isInvalidInternal, setApplicationContext, setComponentRequiredErrorState, setConversionInvalid, setDatatype, setErrorMessage, setInvalid, setInvalidInternal, setMessages, setMetadataTools, setRequiredMessage, setStatusChangeHandler, setToModelConverter, setUiComponentProperties, updateInvalidState, updateRequiredState, validatorsPassedMethods inherited from class io.jmix.flowui.component.delegate.AbstractValueComponentDelegate
addValueBindingChangeListener, getEventBus, getValueBinding, getValueSource, setupProperties, setValueSource, valueBindingChangedMethods inherited from class io.jmix.flowui.component.delegate.AbstractComponentDelegate
getComponent
-
Field Details
-
maxValidatorRegistration
protected com.vaadin.flow.shared.Registration maxValidatorRegistration -
minValidatorRegistration
protected com.vaadin.flow.shared.Registration minValidatorRegistration -
valueSet
protected boolean valueSet
-
-
Constructor Details
-
AbstractSliderDelegate
-
-
Method Details
-
setMax
-
getMaxValidator
-
setMin
-
getMinValidator
-
isEmpty
public boolean isEmpty()Checks whether the component has no value.A slider always shows a number: an absent value is replaced with the minimum value, hence the component value cannot indicate the empty state. A component bound to a value source is empty when the value source value is absent, because the substituted minimum value is not propagated back, see
SliderValueBinding. An unbound component is empty until a value is set to it, either by the user or programmatically.- Returns:
trueif the component has no value,falseotherwise
-
getComponentValue
An empty component shows the minimum value as a substitute for an absent one. That substitute is not the value of the component and is not passed to validators.
- Overrides:
getComponentValuein classAbstractFieldDelegate<C extends com.vaadin.flow.component.AbstractField<?,V>, T extends Number, V extends Number>
-
clearValue
Clears the value of the component. A bound component clears its value source as well, instead of writing the minimum value substituted for the absent one.- Parameters:
clearComponentValueAction- action that clears the component value
-
onValueSet
public void onValueSet()Handles a value that has been set to the component: makes sure the value reaches the value source and records that the component has a value.The binding cannot propagate a value the component already showed, because setting it fires no value change event.
- See Also:
-
setValueSet
protected void setValueSet(boolean valueSet) Records whether a value has been set to the component. Affects an unbound component only, because for a bound one the value source is the source of truth.- Parameters:
valueSet- whether a value has been set to the component- See Also:
-
updateStateOnEmptyStateChange
protected void updateStateOnEmptyStateChange()Updates the validation state after the empty state of the component may have changed without a value change event.Entering the required error state respects
UiComponentProperties.isImmediateRequiredValidationEnabled(), while leaving it does not, the same wayAbstractFieldDelegate.setConversionInvalid(boolean)does it. Otherwise a required error raised by an explicit validation would never be cleared when the setting is off.- See Also:
-
createValueBinding
- Specified by:
createValueBindingin classAbstractValueComponentDelegate<C extends com.vaadin.flow.component.AbstractField<?,V>, T extends Number, V extends Number>
-