Class MapEntryField<K,V>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,V>>
org.vaadin.miki.superfields.collections.MapEntryField<K,V>
- Type Parameters:
K- Key type.V- Value type.
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,,V>>> com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,,V>>> com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,,V>>> com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasHelper,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.HasValidation,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,,V>>, Map.Entry<K, V>>, Map.Entry<K, V>> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,,V>>, Map.Entry<K, V>>, Map.Entry<K, V>> com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.component.shared.HasValidationProperties,Serializable
public class MapEntryField<K,V>
extends com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,V>>
A field for representing a
Map.Entry. Allows customisation of layout, key component and value component.
It uses DEFAULT_LAYOUT_PROVIDER and LabelField by default.- Since:
- 2022-04-08
- Author:
- miki
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.orderedlayout.FlexLayout>Default layout provider used byMapEntryField. -
Constructor Summary
ConstructorsConstructorDescriptionCreates aMapEntryFieldthat uses a (non-modifiable via the UI)LabelFieldas key and value component and aDEFAULT_LAYOUT_PROVIDER.MapEntryField(com.vaadin.flow.function.SerializableSupplier<KC> keyComponentSupplier, com.vaadin.flow.function.SerializableSupplier<VC> valueComponentSupplier) Creates aMapEntryFieldwith given providers for key and value component, and withDEFAULT_LAYOUT_PROVIDER.MapEntryField(com.vaadin.flow.function.SerializableSupplier<L> layoutSupplier) Creates aMapEntryFieldthat uses a (non-modifiable via the UI)LabelFieldas key and value component and a provided layout supplier.MapEntryField(com.vaadin.flow.function.SerializableSupplier<L> layoutSupplier, com.vaadin.flow.function.SerializableSupplier<KC> keyComponentSupplier, com.vaadin.flow.function.SerializableSupplier<VC> valueComponentSupplier) Creates aMapEntryFieldwith given providers for layout, key component and value component. -
Method Summary
Modifier and TypeMethodDescription<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,K>>
Supplier<C>Returns the current supplier of key components.<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasComponents>
Supplier<C>Returns the current supplier of layout.<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,V>>
Supplier<C>Returns the current supplier of value components.<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,K>>
voidsetKeyComponentSupplier(com.vaadin.flow.function.SerializableSupplier<C> keyComponentSupplier) Sets a new key component supplier.<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasComponents>
voidsetLayoutSupplier(com.vaadin.flow.function.SerializableSupplier<C> layoutSupplier) Sets a new supplier of layout.protected voidsetPresentationValue(Map.Entry<K, V> entry) voidsetReadOnly(boolean readOnly) <C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,V>>
voidsetValueComponentSupplier(com.vaadin.flow.function.SerializableSupplier<C> valueComponentSupplier) Sets a new value component supplier.Methods inherited from class com.vaadin.flow.component.customfield.CustomField
add, addThemeVariants, getLabel, onAttach, remove, removeThemeVariants, setLabel, updateValueMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible
-
Field Details
-
DEFAULT_LAYOUT_PROVIDER
public static final com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.orderedlayout.FlexLayout> DEFAULT_LAYOUT_PROVIDERDefault layout provider used byMapEntryField.
-
-
Constructor Details
-
MapEntryField
public MapEntryField(com.vaadin.flow.function.SerializableSupplier<L> layoutSupplier, com.vaadin.flow.function.SerializableSupplier<KC> keyComponentSupplier, com.vaadin.flow.function.SerializableSupplier<VC> valueComponentSupplier) Creates aMapEntryFieldwith given providers for layout, key component and value component.- Type Parameters:
L- Ensures layout provider is both aComponentandHasComponents.KC- Ensures key component provider is both aComponentandHasValueof typeK.VC- Ensures value component provider is both aComponentandHasValueof typeV.- Parameters:
layoutSupplier- Supplier of a layout to put key and value components in, in that order.keyComponentSupplier- Provides a field to display a key of the entry.valueComponentSupplier- Provides a field to display a value of the entry.
-
MapEntryField
public MapEntryField(com.vaadin.flow.function.SerializableSupplier<KC> keyComponentSupplier, com.vaadin.flow.function.SerializableSupplier<VC> valueComponentSupplier) Creates aMapEntryFieldwith given providers for key and value component, and withDEFAULT_LAYOUT_PROVIDER.- Type Parameters:
KC- Ensures key component provider is both aComponentandHasValueof typeK.VC- Ensures value component provider is both aComponentandHasValueof typeV.- Parameters:
keyComponentSupplier- Provides a field to display a key of the entry.valueComponentSupplier- Provides a field to display a value of the entry.
-
MapEntryField
public MapEntryField(com.vaadin.flow.function.SerializableSupplier<L> layoutSupplier) Creates aMapEntryFieldthat uses a (non-modifiable via the UI)LabelFieldas key and value component and a provided layout supplier.- Type Parameters:
L- Ensures layout provider is both aComponentandHasComponents.- Parameters:
layoutSupplier- Supplier of a layout to put key and value components in, in that order.- See Also:
-
MapEntryField
public MapEntryField()Creates aMapEntryFieldthat uses a (non-modifiable via the UI)LabelFieldas key and value component and aDEFAULT_LAYOUT_PROVIDER.
-
-
Method Details
-
generateModelValue
-
setPresentationValue
-
getKeyComponentSupplier
public <C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,K>> Supplier<C> getKeyComponentSupplier()Returns the current supplier of key components.- Type Parameters:
C- Ensures the result provides aComponentthatHasValueof typeK.- Returns:
- A
Supplier.
-
setKeyComponentSupplier
public <C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,K>> void setKeyComponentSupplier(com.vaadin.flow.function.SerializableSupplier<C> keyComponentSupplier) Sets a new key component supplier.- Type Parameters:
C- Ensures the supplier provides aComponentthatHasValueof typeK.- Parameters:
keyComponentSupplier- A supplier to use.
-
getValueComponentSupplier
public <C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,V>> Supplier<C> getValueComponentSupplier()Returns the current supplier of value components.- Type Parameters:
C- Ensures the result supplies aComponentthatHasValueof typeV.- Returns:
- A
Supplier.
-
setValueComponentSupplier
public <C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,V>> void setValueComponentSupplier(com.vaadin.flow.function.SerializableSupplier<C> valueComponentSupplier) Sets a new value component supplier.- Type Parameters:
C- Ensures the supplier provides aComponentthatHasValueof typeV.- Parameters:
valueComponentSupplier- A supplier to use.
-
getLayoutSupplier
public <C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasComponents> Supplier<C> getLayoutSupplier()Returns the current supplier of layout.- Type Parameters:
C- Ensures the result provides aComponentthatHasComponents.- Returns:
- A
Supplier
-
setLayoutSupplier
public <C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasComponents> void setLayoutSupplier(com.vaadin.flow.function.SerializableSupplier<C> layoutSupplier) Sets a new supplier of layout.- Type Parameters:
C- Ensures the supplier provides aComponentthatHasComponents.- Parameters:
layoutSupplier- A supplier to use. Key component will be added first, followed by the value component.
-
setReadOnly
public void setReadOnly(boolean readOnly)
-