Class AbstractComponentContainer

  • All Implemented Interfaces:
    ClientConnector, Sizeable, ComponentContainer, HasComponents, HasComponents.ComponentAttachDetachNotifier, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, java.io.Serializable, java.lang.Iterable<com.vaadin.flow.component.Component>
    Direct Known Subclasses:
    AbstractLayout

    public abstract class AbstractComponentContainer
    extends AbstractComponent
    implements ComponentContainer
    Legacy version of AbstractComponentContainer that resembles Vaadin 7/8's AbstractComponentContainer API as closely as possible in order to facilitate migration to newer versions of Vaadin.

    Extension to AbstractComponent that defines the default implementation for the methods in ComponentContainer. Basic UI components that need to contain other components inherit this class to easily qualify as a component container.

    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractComponentContainer

        public AbstractComponentContainer()
    • Method Detail

      • addComponent

        public void addComponent​(com.vaadin.flow.component.Component component)
        Description copied from interface: ComponentContainer
        Adds the component into this container.
        Specified by:
        addComponent in interface ComponentContainer
        Parameters:
        component - the component to be added.
      • addComponents

        public void addComponents​(com.vaadin.flow.component.Component... components)
        Description copied from interface: ComponentContainer
        Adds the components in the given order to this component container.
        Specified by:
        addComponents in interface ComponentContainer
        Parameters:
        components - The components to add.
      • add

        public void add​(com.vaadin.flow.component.Component... components)
        Specified by:
        add in interface com.vaadin.flow.component.HasComponents
      • moveComponentsFrom

        public void moveComponentsFrom​(ComponentContainer source)
        Moves all components from another container into this container. The components are removed from source.

        Note that only components are moved from source into this container. If an element in the source does not have a component, it will remain in the source.

        Specified by:
        moveComponentsFrom in interface ComponentContainer
        Parameters:
        source - the container which contains the components that are to be moved to this container.
      • removeAll

        public void removeAll()
        Specified by:
        removeAll in interface com.vaadin.flow.component.HasComponents
      • removeComponent

        public void removeComponent​(com.vaadin.flow.component.Component component)
        Description copied from interface: ComponentContainer
        Removes the component from this container.
        Specified by:
        removeComponent in interface ComponentContainer
        Parameters:
        component - the component to be removed.
      • remove

        public void remove​(com.vaadin.flow.component.Component... components)
        Specified by:
        remove in interface com.vaadin.flow.component.HasComponents
      • iterator

        public java.util.Iterator<com.vaadin.flow.component.Component> iterator()
        Gets the component container iterator for going through all the components in the container.
        Specified by:
        iterator in interface HasComponents
        Specified by:
        iterator in interface java.lang.Iterable<com.vaadin.flow.component.Component>
        Returns:
        the Iterator of the components inside the container.
      • setHeight

        public void setHeight​(float height,
                              Sizeable.Unit unit)
        Description copied from interface: Sizeable
        Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).
        Specified by:
        setHeight in interface Sizeable
        Overrides:
        setHeight in class AbstractComponent
        Parameters:
        height - the height of the object.
        unit - the unit used for the width.
      • setWidth

        public void setWidth​(float width,
                             Sizeable.Unit unit)
        Description copied from interface: Sizeable
        Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).
        Specified by:
        setWidth in interface Sizeable
        Overrides:
        setWidth in class AbstractComponent
        Parameters:
        width - the width of the object.
        unit - the unit used for the width.
      • fireComponentAttachEvent

        protected void fireComponentAttachEvent​(com.vaadin.flow.component.Component component)
        Fires the component attached event. This should be called by the addComponent methods after the component have been added to this container.
        Parameters:
        component - the component that has been added to this container.
      • fireComponentDetachEvent

        protected void fireComponentDetachEvent​(com.vaadin.flow.component.Component component)
        Fires the component detached event. This should be called by the removeComponent methods after the component have been removed from this container.
        Parameters:
        component - the component that has been removed from this container.