Package com.vaadin.ui

Class AbstractSingleComponentContainer

    • Constructor Detail

      • AbstractSingleComponentContainer

        public AbstractSingleComponentContainer()
    • Method Detail

      • iterator

        public Iterator<Component> iterator()
        Description copied from interface: HasComponents
        Gets an iterator to the collection of contained components. Using this iterator it is possible to step through all components contained in this container.
        Specified by:
        iterator in interface HasComponents
        Specified by:
        iterator in interface Iterable<Component>
        Returns:
        the component iterator.
      • fireComponentAttachEvent

        protected void fireComponentAttachEvent​(Component component)
        Fires the component attached event. This is called by the setContent(Component) method after the component has been set as the content.
        Parameters:
        component - the component that has been added to this container.
      • fireComponentDetachEvent

        protected void fireComponentDetachEvent​(Component component)
        Fires the component detached event. This is called by the setContent(Component) method after the content component has been replaced by other content.
        Parameters:
        component - the component that has been removed from this container.
      • setContent

        public void setContent​(Component content)
        Sets the content of this container. The content is a component that serves as the outermost item of the visual contents. The content must always be set, either with a constructor parameter or by calling this method. Previous versions of Vaadin used a VerticalLayout with margins enabled as the default content but that is no longer the case.
        Specified by:
        setContent in interface SingleComponentContainer
        Parameters:
        content - a component (typically a layout) to use as content
      • 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.
      • 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.
      • readDesign

        public void readDesign​(org.jsoup.nodes.Element design,
                               DesignContext designContext)
        Description copied from interface: Component
        Reads the component state from the given design.

        The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.

        It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.

        This method must not modify the design.

        Specified by:
        readDesign in interface Component
        Overrides:
        readDesign in class AbstractComponent
        Parameters:
        design - The element to obtain the state from
        designContext - The DesignContext instance used for parsing the design
      • readDesignChildren

        protected void readDesignChildren​(org.jsoup.select.Elements children,
                                          DesignContext context)
        Reads the content component from the list of child elements of a design. The list must be empty or contain a single element; if the design contains multiple child elements, a DesignException is thrown. This method should be overridden by subclasses whose design may contain non-content child elements.
        Parameters:
        children - the child elements of the design that is being read
        context - the DesignContext instance used to parse the design
        Throws:
        DesignException - if there are multiple child elements
        DesignException - if a child element could not be parsed as a Component
        Since:
        7.5.0
      • writeDesign

        public void writeDesign​(org.jsoup.nodes.Element design,
                                DesignContext designContext)
        Description copied from interface: Component
        Writes the component state to the given design.

        The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.

        This method must not modify the component state.

        Specified by:
        writeDesign in interface Component
        Overrides:
        writeDesign in class AbstractComponent
        Parameters:
        design - The element to write the component state to. Any previous attributes or child nodes are not cleared.
        designContext - The DesignContext instance used for writing the design