Class AbstractFieldSupport<C extends Component & HasValue<AbstractField.ComponentValueChangeEvent<C,T>,T>,T>
java.lang.Object
com.vaadin.flow.component.internal.AbstractFieldSupport<C,T>
- Type Parameters:
C
- the value change source typeT
- the value type
- All Implemented Interfaces:
Serializable
public class AbstractFieldSupport<C extends Component & HasValue<AbstractField.ComponentValueChangeEvent<C,T>,T>,T>
extends Object
implements Serializable
Encapsulates all the logic required for a typical field implementation. This
reduces the risk of implementing logic changes in
AbstractField
but
not in AbstractCompositeField
, or vice versa.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorDescriptionAbstractFieldSupport
(C component, T defaultValue, SerializableBiPredicate<T, T> valueEquals, SerializableConsumer<T> setPresentationValue) Creates a new field support. -
Method Summary
Modifier and TypeMethodDescriptionaddValueChangeListener
(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<C, T>> listener) Delegate method forHasValue.getEmptyValue()
.getValue()
Delegate method forHasValue.getValue()
.void
setModelValue
(T newModelValue, boolean fromClient) Delegate method corresponding toAbstractField.setModelValue(Object, boolean)
.void
Delegate method forHasValue.setValue(Object)
.boolean
valueEquals
(T value1, T value2) Delegate method corresponding toAbstractField.valueEquals(Object, Object)
.
-
Constructor Details
-
AbstractFieldSupport
public AbstractFieldSupport(C component, T defaultValue, SerializableBiPredicate<T, T> valueEquals, SerializableConsumer<T> setPresentationValue) Creates a new field support.- Parameters:
component
- the owning field componentdefaultValue
- the default field valuevalueEquals
- a callback for comparing valuessetPresentationValue
- a callback for setting presentation values
-
-
Method Details
-
addValueChangeListener
public Registration addValueChangeListener(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<C, T>> listener) Delegate method forHasValue.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
- Parameters:
listener
- the listener to add- Returns:
- a registration for the listener
-
getValue
Delegate method forHasValue.getValue()
.- Returns:
- the field value
-
getEmptyValue
Delegate method forHasValue.getEmptyValue()
.- Returns:
- the empty value of this field
-
setValue
Delegate method forHasValue.setValue(Object)
.- Parameters:
value
- the value to set
-
valueEquals
Delegate method corresponding toAbstractField.valueEquals(Object, Object)
.- Parameters:
value1
- the first instancevalue2
- the second instance- Returns:
true
if the instances are equal; otherwisefalse
-
setModelValue
Delegate method corresponding toAbstractField.setModelValue(Object, boolean)
.- Parameters:
newModelValue
- the new internal value to usefromClient
-true
if the new value originates from the client; otherwisefalse
-