Class 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 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:
    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_PROVIDER
      Default layout provider used by MapEntryField.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapEntryField()
      Creates a MapEntryField that uses a (non-modifiable via the UI) LabelField as key and value component and a DEFAULT_LAYOUT_PROVIDER.
      MapEntryField​(com.vaadin.flow.function.SerializableSupplier<KC> keyComponentSupplier, com.vaadin.flow.function.SerializableSupplier<VC> valueComponentSupplier)
      Creates a MapEntryField with given providers for key and value component, and with DEFAULT_LAYOUT_PROVIDER.
      MapEntryField​(com.vaadin.flow.function.SerializableSupplier<L> layoutSupplier)
      Creates a MapEntryField that uses a (non-modifiable via the UI) LabelField as 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 a MapEntryField with 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>>
      void
      setKeyComponentSupplier​(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>
      void
      setLayoutSupplier​(com.vaadin.flow.function.SerializableSupplier<C> layoutSupplier)
      Sets a new supplier of layout.
      protected void setPresentationValue​(Map.Entry<K,​V> entry)  
      void setReadOnly​(boolean readOnly)  
      <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.
      • 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 interface com.vaadin.flow.component.AttachNotifier

        addAttachListener
      • Methods inherited from interface com.vaadin.flow.component.BlurNotifier

        addBlurListener
      • Methods inherited from interface com.vaadin.flow.component.DetachNotifier

        addDetachListener
      • Methods inherited from interface com.vaadin.flow.component.Focusable

        addFocusShortcut, blur, focus, getTabIndex, setTabIndex
      • Methods inherited from interface com.vaadin.flow.component.FocusNotifier

        addFocusListener
      • Methods inherited from interface com.vaadin.flow.component.HasElement

        getElement
      • Methods inherited from interface com.vaadin.flow.component.HasEnabled

        isEnabled, setEnabled
      • 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
      • Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip

        getTooltip, setTooltipText
      • Methods inherited from interface com.vaadin.flow.component.HasValue

        clear, getOptionalValue
      • Methods inherited from interface com.vaadin.flow.component.HasValueAndElement

        isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible
    • 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 by MapEntryField.
    • 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 a MapEntryField with given providers for layout, key component and value component.
        Type Parameters:
        L - Ensures layout provider is both a Component and HasComponents.
        KC - Ensures key component provider is both a Component and HasValue of type K.
        VC - Ensures value component provider is both a Component and HasValue of type V.
        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 a MapEntryField with given providers for key and value component, and with DEFAULT_LAYOUT_PROVIDER.
        Type Parameters:
        KC - Ensures key component provider is both a Component and HasValue of type K.
        VC - Ensures value component provider is both a Component and HasValue of type V.
        Parameters:
        keyComponentSupplier - Provides a field to display a key of the entry.
        valueComponentSupplier - Provides a field to display a value of the entry.
    • Method Detail

      • generateModelValue

        protected Map.Entry<K,​V> generateModelValue()
        Specified by:
        generateModelValue in class com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,​V>>
      • setPresentationValue

        protected void setPresentationValue​(Map.Entry<K,​V> entry)
        Specified by:
        setPresentationValue in class com.vaadin.flow.component.customfield.CustomField<Map.Entry<K,​V>>
      • 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 a Component that HasValue of type K.
        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 a Component that HasValue of type K.
        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 a Component that HasValue of type V.
        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 a Component that HasValue of type V.
        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 a Component that HasComponents.
        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 a Component that HasComponents.
        Parameters:
        layoutSupplier - A supplier to use. Key component will be added first, followed by the value component.
      • setReadOnly

        public void setReadOnly​(boolean readOnly)