V - Value type.@CssImport(value="./styles/label-positions-custom-field.css",
themeFor="vaadin-custom-field")
@Tag(value="label-field")
@JsModule(value="./label-field.js")
public class LabelField<V>
extends com.vaadin.flow.component.customfield.CustomField<V>
implements com.vaadin.flow.component.HasStyle, WithLabelMixin<LabelField<V>>, WithHelperPositionableMixin<LabelField<V>>, WithHelperMixin<LabelField<V>>, WithLabelPositionableMixin<LabelField<V>>, WithIdMixin<LabelField<V>>, WithValueMixin<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,V>,V,LabelField<V>>
Object.toString() to show the text representation and DEFAULT_NULL_REPRESENTATION to show null values.com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V>com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_NULL_REPRESENTATION |
HELPER_ABOVE_THEME_VARIANTLABEL_POSITION_ATTRIBUTE, LABEL_POSITION_DETAILS_ATTRIBUTE| Constructor and Description |
|---|
LabelField()
Creates a label field.
|
| Modifier and Type | Method and Description |
|---|---|
protected V |
generateModelValue() |
com.vaadin.flow.function.SerializableFunction<V,String> |
getConverter()
Returns converter from value to
String. |
String |
getNullRepresentation()
Returns current representation for
null value. |
void |
setConverter(com.vaadin.flow.function.SerializableFunction<V,String> converter)
Sets a converter used to translate a value of type
V to String. |
void |
setNullRepresentation(String nullRepresentation)
Sets text to be displayed when the value is
null. |
protected void |
setPresentationValue(V v) |
LabelField<V> |
withConverter(com.vaadin.flow.function.SerializableFunction<V,String> converter)
Chains
setConverter(SerializableFunction) and returns itself. |
LabelField<V> |
withNullRepresentation(String nullRepresentation)
Chains
setNullRepresentation(String) and returns itself. |
add, getErrorMessage, getLabel, isInvalid, remove, setErrorMessage, setInvalid, setLabel, updateValueaddValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNamewithLabelwithHelperAbove, withHelperAbove, withHelperBelowisHelperAbove, setHelperAbove, setHelperAbove, setHelperBelowwithHelperComponent, withHelperTextgetHelperComponent, getHelperText, setHelperComponent, setHelperTextwithLabelPositiongetLabelPosition, setLabelPositionwithIdwithValueaddValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible, setValuegetCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFulladdFocusShortcut, blur, focus, getTabIndex, setTabIndexpublic static final String DEFAULT_NULL_REPRESENTATION
protected V generateModelValue()
generateModelValue in class com.vaadin.flow.component.customfield.CustomField<V>protected void setPresentationValue(V v)
setPresentationValue in class com.vaadin.flow.component.customfield.CustomField<V>public final String getNullRepresentation()
null value.null. Will never be null itself.public final void setNullRepresentation(String nullRepresentation)
null.nullRepresentation - New text. If it is null, DEFAULT_NULL_REPRESENTATION will be used instead.public final LabelField<V> withNullRepresentation(String nullRepresentation)
setNullRepresentation(String) and returns itself.nullRepresentation - Text to display when value is null.public com.vaadin.flow.function.SerializableFunction<V,String> getConverter()
String.null function that accepts V and returns a String. Object.toString() by default.public void setConverter(com.vaadin.flow.function.SerializableFunction<V,String> converter)
V to String. Updates the currently shown text.converter - A converter to use. null is never passed to the converter.setNullRepresentation(String)public final LabelField<V> withConverter(com.vaadin.flow.function.SerializableFunction<V,String> converter)
setConverter(SerializableFunction) and returns itself.converter - Converter to use.Copyright © 2024 Miki. All rights reserved.