Class AbstractContainer

    • Constructor Detail

      • AbstractContainer

        public AbstractContainer​(Layout<? extends Constraints> layout)
        Layout constructor with a default info model.
        Parameters:
        layout - The layout definition for the container.
        Throws:
        java.lang.NullPointerException - if the given layout is null.
      • AbstractContainer

        public AbstractContainer​(InfoModel infoModel,
                                 Layout<? extends Constraints> layout)
        Info model and layout constructor.
        Parameters:
        infoModel - The component info model.
        layout - The layout definition for the container.
        Throws:
        java.lang.NullPointerException - if the given info model and/or layout is null.
    • Method Detail

      • indexOf

        public int indexOf​(java.lang.Object component)
        Description copied from class: AbstractListCompositeComponent
        Returns the index in the component of the first occurrence of the specified component.
        Specified by:
        indexOf in interface Container
        Overrides:
        indexOf in class AbstractListCompositeComponent
        Parameters:
        component - The component the index of which should be returned.
        Returns:
        The index in this component of the first occurrence of the specified component, or -1 if this component does not contain the given component.
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object component)
        Description copied from class: AbstractListCompositeComponent
        Returns the index in this component of the last occurrence of the specified component.
        Specified by:
        lastIndexOf in interface Container
        Overrides:
        lastIndexOf in class AbstractListCompositeComponent
        Parameters:
        component - The component the last index of which should be returned.
        Returns:
        The index in this component of the last occurrence of the specified component, or -1 if this component does not contain the given component.
      • add

        public void add​(int index,
                        Component component)
        Adds a child component with default constraints to the container at the specified index.
        Parameters:
        index - The index at which the component should be added.
        component - The component to add to this container.
        Throws:
        java.lang.IllegalArgumentException - if the component already has a parent.
        java.lang.IllegalStateException - if the installed layout does not support default constraints.
        java.lang.IndexOutOfBoundsException - if the index is less than zero or greater than the number of child components.
      • add

        public boolean add​(Component component)
        Description copied from interface: Container
        Adds a component with default constraints to the container.
        Specified by:
        add in interface Container
        Parameters:
        component - The component to add to this container.
        Returns:
        true if this container changed as a result of the operation.
      • add

        public void add​(int index,
                        Component component,
                        Constraints constraints)
        Description copied from interface: Container
        Adds a component along with constraints to the container at the specified index. This is a convenience method that first sets the constraints of the component.
        Specified by:
        add in interface Container
        Parameters:
        index - The index at which the component should be added.
        component - The component to add to this container.
        constraints - The constraints for the layout, or null if default constraints should be used.
      • add

        public boolean add​(Component component,
                           Constraints constraints)
        Description copied from interface: Container
        Adds a component along with constraints to the container. This is a convenience method that first sets the constraints of the component.
        Specified by:
        add in interface Container
        Parameters:
        component - The component to add to this container.
        constraints - The constraints for the layout, or null if default constraints should be used.
        Returns:
        true if this container changed as a result of the operation.
      • add

        public Component add​(int index,
                             Prototype prototype)
        Adds a component based upon the given prototype to the container with default constraints at the specified index.

        This implementation delegates to add(int, Component).

        Specified by:
        add in interface Container
        Parameters:
        index - The index at which the component should be added.
        prototype - The prototype of the component to add.
        Returns:
        The component created to represent the given prototype.
        See Also:
        createComponent(Prototype)
      • add

        public Component add​(Prototype prototype)
        Adds a component based upon the given prototype to the container with default constraints.

        This implementation delegates to add(Component).

        Specified by:
        add in interface Container
        Parameters:
        prototype - The prototype of the component to add.
        Returns:
        The component created to represent the given prototype.
        See Also:
        createComponent(Prototype)
      • add

        public Component add​(int index,
                             Prototype prototype,
                             Constraints constraints)
        Adds a component based upon the given prototype to the container along with constraints at the specified index.

        This implementation delegates to add(int, Component, Constraints).

        Specified by:
        add in interface Container
        Parameters:
        index - The index at which the component should be added.
        prototype - The prototype of the component to add.
        constraints - The constraints for the layout, or null if default constraints should be used.
        Returns:
        The component created to represent the given prototype.
        See Also:
        createComponent(Prototype)
      • add

        public Component add​(Prototype prototype,
                             Constraints constraints)
        Adds a component based upon the given prototype to the container along with constraints.

        This implementation delegates to add(Component, Constraints).

        Specified by:
        add in interface Container
        Parameters:
        prototype - The prototype of the component to add.
        constraints - The constraints for the layout, or null if default constraints should be used.
        Returns:
        The component created to represent the given prototype.
      • remove

        public boolean remove​(java.lang.Object componentObject)
        Description copied from interface: Container
        Removes a component from the container.
        Specified by:
        remove in interface Container
        Parameters:
        componentObject - The component to remove.
        Returns:
        true if this collection changed as a result of the operation.
      • remove

        public Component remove​(int index)
        Description copied from interface: Container
        Removes the child component at the specified position in this container.
        Specified by:
        remove in interface Container
        Parameters:
        index - The index of the component to removed.
        Returns:
        The value previously at the specified position.
      • clear

        public void clear()
        Description copied from interface: Container
        Removes all of the components from this container.
        Specified by:
        clear in interface Container
      • iterator

        public java.util.Iterator<Component> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Component>
      • setChildren

        public void setChildren​(java.util.List<Component> children)
        Sets the children in this container. This method along with getChildComponents() provides a children property for alternate children access.
        Parameters:
        children - The new children for this container in order.
        See Also:
        clear(), add(Component)
      • setLayout

        public <T extends Constraints> void setLayout​(Layout<T> newLayout)
        Description copied from class: AbstractLayoutComponent
        Sets the layout definition for the component. This is a bound property. The layout is marked as not yet having a theme applied, as the specific theme rules applied to the layout may depend on the layout's owner.
        Specified by:
        setLayout in interface Container
        Overrides:
        setLayout in class AbstractLayoutComponent
        Type Parameters:
        T - The type of the constraints.
        Parameters:
        newLayout - The new layout definition for the container.
        See Also:
        LayoutComponent.LAYOUT_PROPERTY