@CssImport(value="./styles/label-positions-custom-field.css",
themeFor="vaadin-custom-field")
public class MapField<K,V>
extends com.vaadin.flow.component.customfield.CustomField<Map<K,V>>
implements com.vaadin.flow.component.HasStyle, WithIdMixin<MapField<K,V>>, WithValueMixin<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<Map<K,V>>,Map<K,V>>,Map<K,V>,MapField<K,V>>, WithHelperPositionableMixin<MapField<K,V>>, WithHelperMixin<MapField<K,V>>, WithLabelMixin<MapField<K,V>>, WithCollectionValueComponentProviderMixin<Map.Entry<K,V>,MapField<K,V>>, WithCollectionElementFilterMixin<Map.Entry<K,V>,MapField<K,V>>, WithLabelPositionableMixin<MapField<K,V>>
Maps.
This basically forwards everything to a CollectionField and wraps the value in a Map. It also expects
a component capable of displaying values of type Map.Entry.MapEntryField,
CollectionField,
Serialized Formcom.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<?>>HELPER_ABOVE_THEME_VARIANTLABEL_POSITION_ATTRIBUTE, LABEL_POSITION_DETAILS_ATTRIBUTE| Constructor and Description |
|---|
MapField(com.vaadin.flow.function.SerializableSupplier<C> entryComponentProvider)
Creates a new
MapField with given entry component provider. |
MapField(com.vaadin.flow.function.SerializableSupplier<Map<K,V>> emptyMapSupplier,
CollectionLayoutProvider<?> mainLayoutProvider,
CollectionValueComponentProvider<Map.Entry<K,V>,?> entryValueComponentProvider)
Creates a new
MapField using given empty map provider, and layout and entry component providers for the underlying CollectionField. |
MapField(com.vaadin.flow.function.SerializableSupplier<Map<K,V>> emptyMapSupplier,
Supplier<L> layoutProvider,
com.vaadin.flow.function.SerializableSupplier<C> entryComponentProvider)
Creates a new
MapField with given empty map supplier, layout provider and entry component provider. |
MapField(Supplier<L> layoutProvider,
com.vaadin.flow.function.SerializableSupplier<C> entryComponentProvider)
Creates a new
MapField with given layout provider and entry component provider. |
| Modifier and Type | Method and Description |
|---|---|
void |
focus() |
protected Map<K,V> |
generateModelValue() |
com.vaadin.flow.function.SerializablePredicate<Map.Entry<K,V>> |
getCollectionElementFilter()
Returns current value filter.
|
<W extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,Map.Entry<K,V>>> |
getCollectionValueComponentProvider()
Returns the current provider used to generate components.
|
static <X,Y> com.vaadin.flow.function.SerializablePredicate<Map.Entry<X,Y>> |
nonNullEntryFilter()
Produces a non-null entry filter (entry, its key and its value must be non-
null). |
void |
setCollectionElementFilter(com.vaadin.flow.function.SerializablePredicate<Map.Entry<K,V>> collectionElementFilter)
Sets a value filter.
|
void |
setCollectionValueComponentProvider(CollectionValueComponentProvider<Map.Entry<K,V>,?> provider)
Sets the provider used to generate components for each element of the collection.
|
protected void |
setPresentationValue(Map<K,V> map) |
void |
setReadOnly(boolean readOnly) |
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, setClassNamewithIdwithValueaddValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible, setValuewithHelperAbove, withHelperAbove, withHelperBelowisHelperAbove, setHelperAbove, setHelperAbove, setHelperBelowwithHelperComponent, withHelperTextgetHelperComponent, getHelperText, setHelperComponent, setHelperTextwithLabelwithCollectionComponentProviderwithCollectionElementFilterwithLabelPositiongetLabelPosition, 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, getTabIndex, setTabIndexpublic MapField(com.vaadin.flow.function.SerializableSupplier<Map<K,V>> emptyMapSupplier, Supplier<L> layoutProvider, com.vaadin.flow.function.SerializableSupplier<C> entryComponentProvider)
MapField with given empty map supplier, layout provider and entry component provider.L - Ensures layout provider produces a Component that HasComponents.C - Ensures entry component provider produces a Component that HasValue of type Map.Entry<K, V>.emptyMapSupplier - A supplier of empty maps.layoutProvider - Provider of the main layout of the component.entryComponentProvider - Provides component to display entries of the map.MapEntryFieldpublic MapField(Supplier<L> layoutProvider, com.vaadin.flow.function.SerializableSupplier<C> entryComponentProvider)
MapField with given layout provider and entry component provider. The produced map will be a LinkedHashMap.L - Ensures layout provider produces a Component that HasComponents.C - Ensures entry component provider produces a Component that HasValue of type Map.Entry<K, V>.layoutProvider - Provider of the main layout of the component.entryComponentProvider - Provides component to display entries of the map.MapEntryFieldpublic MapField(com.vaadin.flow.function.SerializableSupplier<C> entryComponentProvider)
MapField with given entry component provider. Uses FlexLayoutHelpers.column() as layout provider. The produced map will be a LinkedHashMap.C - Ensures entry component provider produces a Component that HasValue of type Map.Entry<K, V>.entryComponentProvider - Provides component to display entries of the map.public MapField(com.vaadin.flow.function.SerializableSupplier<Map<K,V>> emptyMapSupplier, CollectionLayoutProvider<?> mainLayoutProvider, CollectionValueComponentProvider<Map.Entry<K,V>,?> entryValueComponentProvider)
MapField using given empty map provider, and layout and entry component providers for the underlying CollectionField.emptyMapSupplier - A supplier of empty maps.mainLayoutProvider - Provider of the main layout for the underlying CollectionField.entryValueComponentProvider - Provider of entry components displayed in the underlying CollectionField.public static <X,Y> com.vaadin.flow.function.SerializablePredicate<Map.Entry<X,Y>> nonNullEntryFilter()
null).X - Key type.Y - Value type.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<Map<K,V>>,Map<K,V>>,Map<K,V>>setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<Map<K,V>>,Map<K,V>>,Map<K,V>>public void focus()
focus in interface com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField>public void setCollectionValueComponentProvider(CollectionValueComponentProvider<Map.Entry<K,V>,?> provider)
HasCollectionValueComponentProvidersetCollectionValueComponentProvider in interface HasCollectionValueComponentProvider<Map.Entry<K,V>>provider - A non-null provider.public <W extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,Map.Entry<K,V>>> CollectionValueComponentProvider<Map.Entry<K,V>,W> getCollectionValueComponentProvider()
HasCollectionValueComponentProvidergetCollectionValueComponentProvider in interface HasCollectionValueComponentProvider<Map.Entry<K,V>>W - Generic type of the actual component.null provider.public void setCollectionElementFilter(com.vaadin.flow.function.SerializablePredicate<Map.Entry<K,V>> collectionElementFilter)
HasCollectionElementFiltersetCollectionElementFilter in interface HasCollectionElementFilter<Map.Entry<K,V>>collectionElementFilter - Value filter to use.public com.vaadin.flow.function.SerializablePredicate<Map.Entry<K,V>> getCollectionElementFilter()
HasCollectionElementFiltergetCollectionElementFilter in interface HasCollectionElementFilter<Map.Entry<K,V>>null filter.Copyright © 2023 Miki. All rights reserved.