@CssImport(value="./styles/label-positions-custom-field.css",
themeFor="vaadin-custom-field")
@Tag(value="variant-field")
@JsModule(value="./variant-field.js")
public class VariantField
extends com.vaadin.flow.component.customfield.CustomField<Object>
implements com.vaadin.flow.component.HasStyle, WithLabelMixin<VariantField>, WithHelperMixin<VariantField>, WithHelperPositionableMixin<VariantField>, WithValueMixin<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<Object>,Object>,Object,VariantField>, WithIdMixin<VariantField>, WithLabelPositionableMixin<VariantField>
Object as its value and displays a registered field that corresponds to a type of the value actually set by the field.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 com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> |
DEFAULT_NULL_COMPONENT_PROVIDER |
HELPER_ABOVE_THEME_VARIANTLABEL_POSITION_ATTRIBUTE, LABEL_POSITION_DETAILS_ATTRIBUTE| Constructor and Description |
|---|
VariantField()
Creates a
VariantField. |
VariantField(String label,
com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> nullComponentProvider,
TypedFieldProvider<?,?>... providers)
Creates a
VariantField with a given label, null component provider and given TypedFieldProviders. |
VariantField(String label,
TypedFieldProvider<?,?>... providers)
Creates a
VariantField with a given label and given TypedFieldProviders. |
| Modifier and Type | Method and Description |
|---|---|
void |
addTypedFieldProvider(TypedFieldProvider<?,?>... fieldProviders)
Adds one or more
TypedFieldProviders to this component. |
protected Object |
generateModelValue() |
com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> |
getNullComponentProvider()
Returns current provider of components used to show
null. |
void |
removeTypeFieldProvider(TypedFieldProvider<?,?> provider)
Removes a given
TypedFieldProvider if it was registered. |
void |
setNullComponentProvider(com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> nullComponentProvider)
Sets a provider of a component used to show
null. |
protected void |
setPresentationValue(Object o) |
void |
setReadOnly(boolean readOnly) |
VariantField |
withNullComponentProvider(com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> nullComponentProvider)
Chains
setNullComponentProvider(SerializableSupplier) and returns itself. |
VariantField |
withTypedFieldProvider(TypedFieldProvider<?,?>... fieldProviders)
Chains
addTypedFieldProvider(TypedFieldProvider[]) 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, setClassNamewithLabelwithHelperComponent, withHelperTextgetHelperComponent, getHelperText, setHelperComponent, setHelperTextwithHelperAbove, withHelperAbove, withHelperBelowisHelperAbove, setHelperAbove, setHelperAbove, setHelperBelowwithValueaddValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible, setValuewithIdwithLabelPositiongetLabelPosition, setLabelPositiongetCssSize, 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 com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> DEFAULT_NULL_COMPONENT_PROVIDER
public VariantField(String label, com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> nullComponentProvider, TypedFieldProvider<?,?>... providers)
VariantField with a given label, null component provider and given TypedFieldProviders.label - Label.nullComponentProvider - A component provider when value is null.providers - Providers to use.public VariantField(String label, TypedFieldProvider<?,?>... providers)
VariantField with a given label and given TypedFieldProviders.
Uses DEFAULT_NULL_COMPONENT_PROVIDER as setNullComponentProvider(SerializableSupplier).label - Label.providers - Providers to use.public VariantField()
VariantField.protected Object generateModelValue()
generateModelValue in class com.vaadin.flow.component.customfield.CustomField<Object>protected void setPresentationValue(Object o)
setPresentationValue in class com.vaadin.flow.component.customfield.CustomField<Object>public void addTypedFieldProvider(TypedFieldProvider<?,?>... fieldProviders)
TypedFieldProviders to this component.
Has no effect on the currently used value component.fieldProviders - Providers to use.public void removeTypeFieldProvider(TypedFieldProvider<?,?> provider)
TypedFieldProvider if it was registered.
Has no effect on the currently used value component, even if the removed provider was used to create it.provider - Provider to remove.public final VariantField withTypedFieldProvider(TypedFieldProvider<?,?>... fieldProviders)
addTypedFieldProvider(TypedFieldProvider[]) and returns itself.fieldProviders - Providers to use.public com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> getNullComponentProvider()
null.null.public void setNullComponentProvider(com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> nullComponentProvider)
null.
When the current value is null the provider will be invoked to replace the currently shown component.nullComponentProvider - Provider.public final VariantField withNullComponentProvider(com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.Component> nullComponentProvider)
setNullComponentProvider(SerializableSupplier) and returns itself.nullComponentProvider - Provider.public void setReadOnly(boolean readOnly)
setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<Object>,Object>,Object>setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<Object>,Object>,Object>Copyright © 2024 Miki. All rights reserved.