Class ElementCollectionField<T>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
org.vaadin.firitin.fields.ElementCollectionField<T>
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>, Serializable

public class ElementCollectionField<T> extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout> implements com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>, com.vaadin.flow.component.HasSize
A field to pick a list of objects from a superset.

Usage example: selecting runners to a relay team.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue

    com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Table
    The table that is used to display the collection.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ElementCollectionField(Class<T> clazz, Class<?> editorClass)
    Creates a new instance of the field.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    hook to overrid delect button columne
    com.vaadin.flow.shared.Registration
    addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>> listener)
     
    protected void
    A hook to override the default column headers.
    protected String
    Translates raw field name to header name.
     
    protected T
     
    boolean
     
    boolean
     
    void
    setReadOnly(boolean readOnly)
     
    void
    setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
     
    void
    setValue(List<T> value)
     
    withEditorInstantiator(com.vaadin.flow.function.SerializableSupplier<Object> editorInstantiator)
    Configures the instance to use given editor instantiator.

    Methods inherited from class com.vaadin.flow.component.Composite

    getChildren, getContent, getElement, initContent

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, 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.AttachNotifier

    addAttachListener

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

    addDetachListener

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

    getElement

    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.HasValue

    clear, getEmptyValue, getOptionalValue, isEmpty
  • Field Details

    • table

      protected Table table
      The table that is used to display the collection.
  • Constructor Details

    • ElementCollectionField

      public ElementCollectionField(Class<T> clazz, Class<?> editorClass)
      Creates a new instance of the field.
      Parameters:
      clazz - the class of the objects in the collection
      editorClass - the class of the editor component
  • Method Details

    • withEditorInstantiator

      public ElementCollectionField<T> withEditorInstantiator(com.vaadin.flow.function.SerializableSupplier<Object> editorInstantiator)
      Configures the instance to use given editor instantiator.
      Parameters:
      editorInstantiator - the instantiator to use
      Returns:
      the instance for further configuration
    • configureColumneHeaders

      protected void configureColumneHeaders()
      A hook to override the default column headers.
    • getHeaderForField

      protected String getHeaderForField(String fieldName)
      Translates raw field name to header name. By default, decamelcases the name. Override for e.g. localization.
      Parameters:
      fieldName - the raw field name of the row property
      Returns:
      a string to be used as a header in the editor
    • addDeleteButtonColumn

      protected void addDeleteButtonColumn(TableRow row, T item)
      hook to overrid delect button columne
      Parameters:
      row - the row to add the button t
      item - the item to delete
    • setValue

      public void setValue(List<T> value)
      Specified by:
      setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>
    • instantiateNewItem

      protected T instantiateNewItem()
    • getValue

      public List<T> getValue()
      Specified by:
      getValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>
    • addValueChangeListener

      public com.vaadin.flow.shared.Registration addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>> listener)
      Specified by:
      addValueChangeListener in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>
    • isReadOnly

      public boolean isReadOnly()
      Specified by:
      isReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>
    • setRequiredIndicatorVisible

      public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>
    • isRequiredIndicatorVisible

      public boolean isRequiredIndicatorVisible()
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.HasValue.ValueChangeEvent<List<T>>,List<T>>