View Javadoc

1   /*
2    * Copyright 2006-2016 The JGUIraffe Team.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License")
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.jguiraffe.gui.builder.components;
17  
18  /**
19   * <p>
20   * Definition of an interface for components that can contain other components.
21   * </p>
22   * <p>
23   * This interface is used during the process of constructing the GUI. Some
24   * container tags exists whose content is defined by nested tags. These nested
25   * tags created concrete GUI elements and then ensure that the newly created
26   * elements are added to the container. To support this a <code>Composite</code>
27   * must define a method for adding sub components.
28   * </p>
29   * <p>
30   * Another important point is that containers are typically associated with a
31   * layout. This interface supports layouts by defining a method for setting such
32   * an object.
33   * </p>
34   * <p>
35   * In the form builder framework not only specific container tags implement this
36   * interface. There is also a special implementation for the top level or root
37   * container (which is the container object to which all components created by
38   * the builder are added). All tags that are not nested inside a container tag
39   * will be added to this root container.
40   * </p>
41   *
42   * @author Oliver Heger
43   * @version $Id: Composite.java 205 2012-01-29 18:29:57Z oheger $
44   */
45  public interface Composite
46  {
47      /**
48       * Adds the specified component to this container using the given
49       * constraints.
50       *
51       * @param comp the component to add
52       * @param constraints the constraints (may be <b>null </b>)
53       */
54      void addComponent(Object comp, Object constraints);
55  
56      /**
57       * Sets the layout object for this container.
58       *
59       * @param layout the layout object
60       */
61      void setLayout(Object layout);
62  
63      /**
64       * Returns the concrete container component that is wrapped by this object.
65       * The returned container will be specific for the used GUI library.
66       *
67       * @return the GUI library specific container
68       */
69      Object getContainer();
70  }