Package com.vaadin.flow.data.binder
Class ReadOnlyHasValue<V>
java.lang.Object
com.vaadin.flow.data.binder.ReadOnlyHasValue<V>
- Type Parameters:
V- the value type
- All Implemented Interfaces:
com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<V>,,V> Serializable
public class ReadOnlyHasValue<V>
extends Object
implements com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<V>,V>, Serializable
Generic
HasValue to use any type of component with Vaadin data
binding.
Example:
Label label = new Label(); ReadOnlyHasValue<String> hasValue = new ReadOnlyHasValue<>(label::setText); binder.forField(hasValue).bind(SomeBean::getName, null);
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Constructor Summary
ConstructorsConstructorDescriptionReadOnlyHasValue(com.vaadin.flow.function.SerializableConsumer<V> valueProcessor) Creates newReadOnlyHasValuewithnullas an empty value.ReadOnlyHasValue(com.vaadin.flow.function.SerializableConsumer<V> valueProcessor, V emptyValue) Creates newReadOnlyHasValue -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.HasValue.ValueChangeEvent<V>> listener) getValue()booleanbooleanvoidsetReadOnly(boolean readOnly) voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.HasValue
bindValue, clear, getOptionalValue, isEmpty
-
Constructor Details
-
ReadOnlyHasValue
public ReadOnlyHasValue(com.vaadin.flow.function.SerializableConsumer<V> valueProcessor, V emptyValue) Creates newReadOnlyHasValue- Parameters:
valueProcessor- the value valueProcessor, e.g. a setter for displaying the value in a componentemptyValue- the value to be used as empty,nullby default
-
ReadOnlyHasValue
Creates newReadOnlyHasValuewithnullas an empty value.- Parameters:
valueProcessor- the value valueProcessor, e.g. a setter for displaying the value in a component
-
-
Method Details
-
setValue
-
getValue
-
addValueChangeListener
public com.vaadin.flow.shared.Registration addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.HasValue.ValueChangeEvent<V>> listener) -
isRequiredIndicatorVisible
public boolean isRequiredIndicatorVisible() -
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) -
setReadOnly
public void setReadOnly(boolean readOnly) -
isReadOnly
public boolean isReadOnly() -
getEmptyValue
-