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>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField>,com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField>,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,Serializable
public class MapEntryField<K,V> extends com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,V>>
A field for representing aMap.Entry. Allows customisation of layout, key component and value component. It usesDEFAULT_LAYOUT_PROVIDERandLabelFieldby default.- Since:
- 2022-04-08
- Author:
- miki
- See Also:
- Serialized Form
-
-
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
Fields Modifier and Type Field Description static com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.orderedlayout.FlexLayout>DEFAULT_LAYOUT_PROVIDERDefault layout provider used byMapEntryField.
-
Constructor Summary
Constructors Constructor Description MapEntryField()Creates 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map.Entry<K,V>generateModelValue()<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,K>>
Supplier<C>getKeyComponentSupplier()Returns the current supplier of key components.<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasComponents>
Supplier<C>getLayoutSupplier()Returns the current supplier of layout.<C extends com.vaadin.flow.component.Component & com.vaadin.flow.component.HasValue<?,V>>
Supplier<C>getValueComponentSupplier()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, getErrorMessage, getLabel, isInvalid, onAttach, remove, removeThemeVariants, setErrorMessage, setInvalid, setLabel, updateValue
-
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
-
Methods 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, scrollIntoView, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
-
Methods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperText
-
Methods 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, setWidthFull
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
-
-
-
Field Detail
-
DEFAULT_LAYOUT_PROVIDER
public static final com.vaadin.flow.function.SerializableSupplier<com.vaadin.flow.component.orderedlayout.FlexLayout> DEFAULT_LAYOUT_PROVIDER
Default layout provider used byMapEntryField.
-
-
Constructor Detail
-
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:
setKeyComponentSupplier(SerializableSupplier),setValueComponentSupplier(SerializableSupplier)
-
MapEntryField
public MapEntryField()
Creates aMapEntryFieldthat uses a (non-modifiable via the UI)LabelFieldas key and value component and aDEFAULT_LAYOUT_PROVIDER.
-
-
Method Detail
-
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)
-
-