Class CompositeImpl

  • All Implemented Interfaces:
    AccessibleComposite, Composite

    public class CompositeImpl
    extends Object
    implements AccessibleComposite

    A straight-forward implementation of the Composite interface.

    This implementation uses member fields to store and expose the data required by the Composite interface. It can be used by other implementations as delegate. This implementation is not thread-safe.

    Since:
    1.3
    Version:
    $Id$
    Author:
    Oliver Heger
    • Constructor Detail

      • CompositeImpl

        public CompositeImpl()
    • Method Detail

      • addComponent

        public void addComponent​(Object comp,
                                 Object constraints)
        Adds the specified component to this container using the given constraints. This implementation adds the specified component and constraints object to an internal collection. This information can be queried using the getComponents() method.
        Specified by:
        addComponent in interface Composite
        Parameters:
        comp - the component to add
        constraints - the constraints (may be null )
      • getLayout

        public Object getLayout()
        Returns the layout object passed to this instance. This implementation returns the object which has been set using the setLayout(Object) method.
        Specified by:
        getLayout in interface AccessibleComposite
        Returns:
        the layout object
      • setLayout

        public void setLayout​(Object layout)
        Sets the layout object for this container. This implementation stores the passed in layout object in an internal field.
        Specified by:
        setLayout in interface Composite
        Parameters:
        layout - the layout object
      • getContainer

        public Object getContainer()
        Returns the concrete container component that is wrapped by this object. The returned container will be specific for the used GUI library. This implementation returns the container object set by the setContainer(Object) method.
        Specified by:
        getContainer in interface Composite
        Returns:
        the GUI library specific container
      • setContainer

        public void setContainer​(Object container)
        Sets the container represented by this object. The object passed to this method is directly returned by getContainer().
        Parameters:
        container - the container
      • getComponents

        public Collection<Object[]> getComponents()
        Returns an unmodifiable collection with the components and constraints that have been added to this object. Each element of the collection is an array of size 0. Index 0 contains the component, index 1 contains the constraints object. This implementation returns a collection with the data set by all previous addComponent(Object, Object) calls.
        Specified by:
        getComponents in interface AccessibleComposite
        Returns:
        a collection with the components and constraints added to this object