01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: **/package org.araneaframework;
16:
17: import java.io.Serializable;
18: import java.util.Map;
19:
20: /**
21: * Composite is a component with a set of child components. In a Composite
22: * children can form a hierarchially having composites as children and so on.
23: * <br><br>
24: * This class should not be directly implemented, but {@link CompositeComponent},
25: * {@link CompositeService} or {@link CompositeWidget} instead.
26: * <br><br>
27: * The Component follows the template pattern by defining <code>_getComposite</code> which returns the
28: * implementation.
29: *
30: * @author "Toomas Römer" <toomas@webmedia.ee>
31: * @author Jevgeni Kabanov (ekabanov <i>at</i> araneaframework <i>dot</i> org)
32: */
33: public interface Composite extends Serializable {
34:
35: /**
36: * The factory method returning the implementation of the Composite.
37: * @return the Composite implementation
38: */
39: public Composite.Interface _getComposite();
40:
41: /**
42: * The interface which takes care of calling the hooks in the template.
43: */
44: public interface Interface extends Serializable {
45: /**
46: * Returns an unmodifiable map of all the child components.
47: * @return a map of child components
48: */
49: public Map getChildren();
50:
51: /**
52: * Attaches a component as a child of this component. No initialization of the
53: * child takes place.
54: *
55: * @param key of the added component
56: * @param comp the component being attached
57: */
58: public void attach(Object key, Component comp);
59:
60: /**
61: * Detaches a child component with the specified key from this component. Child
62: * will not be destroyed, just removed.
63: *
64: * @param key of the child getting detached
65: * @return the removed component
66: */
67: public Component detach(Object key);
68: }
69:
70: /**
71: * A composite component.
72: */
73: public interface CompositeComponent extends Composite, Component,
74: Serializable {
75: }
76:
77: /**
78: * A composite service.
79: */
80: public interface CompositeService extends CompositeComponent,
81: Service, Serializable {
82: }
83:
84: /**
85: * A composite widget.
86: */
87: public interface CompositeWidget extends CompositeService, Widget,
88: Serializable {
89: }
90: }
|