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   * An interface for a component responsible for obtaining a container object.
21   * </p>
22   * <p>
23   * During the execution of a builder script it is often necessary to obtain a
24   * {@link Composite} object in which newly created elements have to be stored.
25   * Per default, these elements are directly added to the enclosing container
26   * tag.
27   * </p>
28   * <p>
29   * In rare cases, however, there is the need to use an alternative
30   * {@link Composite} implementation as storage. This can be achieved with a
31   * special implementation of this interface. An object implementing this
32   * interface is contained in the central {@link ComponentBuilderData} object.
33   * When searching for an enclosing container tag this object is invoked with the
34   * found tag as parameter. The implementation can then decide which
35   * {@code Composite} to use.
36   * </p>
37   *
38   * @author Oliver Heger
39   * @version $Id$
40   * @since 1.3
41   */
42  public interface ContainerSelector
43  {
44      /**
45       * Returns the {@code Composite} to be used for the specified tag
46       * implementing the {@code Composite} interface.
47       *
48       * @param tag the tag implementing {@code Composite}
49       * @return the {@code Composite} to be used for this tag
50       */
51      Composite getComposite(Composite tag);
52  }