KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > jsfext > layout > descriptor > LayoutElement


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.tools.jsfext.layout.descriptor;
24
25 import com.sun.enterprise.tools.jsfext.event.handlers.HandlerContext;
26
27 import java.io.IOException JavaDoc;
28 import java.util.EventObject JavaDoc;
29 import java.util.List JavaDoc;
30
31 import javax.faces.context.FacesContext;
32 import javax.faces.component.UIComponent;
33
34 /**
35  * <p> This interface is declares the methods required to be a
36  * LayoutElement. A LayoutElement is the building block of the tree
37  * structure which defines a layout for a particular component. There are
38  * different implementations of LayoutElement that provide various
39  * different types of functionality and data. Some examples are:</p>
40  *
41  * <ul><li>Conditional ({@link LayoutIf}), this allows portions of the
42  * layout tree to be conditionally rendered.</li>
43  * <li>Iterative ({@link LayoutWhile}), this allows portions of the
44  * layout tree to be iteratively rendered.</li>
45  * <li>UIComponent ({@link LayoutComponent}), this allows concrete
46  * UIComponents to be used. If the component doesn't already exist,
47  * it will be created automatically.</li>
48  * <li>Facet place holders ({@link LayoutFacet}), this provides a means
49  * to specify where a facet should be rendered. It is not a facet
50  * itself but where a facet should be drawn. However, in addition,
51  * it may specify a default value if no facet was provided.</li></ul>
52  *
53  * @author Ken Paulsen (ken.paulsen@sun.com)
54  */

55 public interface LayoutElement extends java.io.Serializable JavaDoc {
56
57     /**
58      * This method is used to add a LayoutElement. LayoutElements should be
59      * added sequentially in the order in which they are to be rendered.
60      */

61     public void addChildLayoutElement(LayoutElement element);
62
63
64     /**
65      * This method returns the child LayoutElements as a List.
66      *
67      * @return List of LayoutElements
68      */

69     public List JavaDoc getChildLayoutElements();
70
71
72     /**
73      * This method returns the parent LayoutElement.
74      *
75      * @return parent LayoutElement
76      */

77     public LayoutElement getParent();
78
79
80     /**
81      * This method returns the LayoutDefinition. If unable to, it will throw
82      * an Exception.
83      *
84      * @return The LayoutDefinition
85      */

86     public LayoutDefinition getLayoutDefinition();
87
88
89     /**
90      * <p> This method retrieves the Handlers for the requested type.</p>
91      *
92      * @param type The type of Handlers to retrieve.
93      *
94      * @return A List of Handlers.
95      */

96     public List JavaDoc getHandlers(String JavaDoc type);
97
98     /**
99      * <p> This method associates 'type' with the given list of Handlers.</p>
100      *
101      * @param type The String type for the List of Handlers
102      * @param handlers The List of Handlers
103      */

104     public void setHandlers(String JavaDoc type, List JavaDoc handlers);
105
106     /**
107      * Accessor method for id. This should always return a non-null value,
108      * it may return "" if id does not apply.
109      *
110      * @return a non-null id
111      */

112     public String JavaDoc getId(FacesContext context, UIComponent parent);
113
114     /**
115      * <p> This method generally should not be used. It does not resolve
116      * expressions. Instead use
117      * {@link #getId(FacesContext, UIComponent)}.</p>
118      *
119      * @return The unevaluated id.
120      */

121     public String JavaDoc getUnevaluatedId();
122
123     /**
124      * This method performs any encode action for this particular
125      * LayoutElement.
126      *
127      * @param context The FacesContext
128      * @param component The UIComponent
129      */

130     public void encode(FacesContext context, UIComponent component) throws IOException JavaDoc;
131
132     /**
133      *
134      */

135     public Object JavaDoc dispatchHandlers(HandlerContext handlerCtx, List JavaDoc handlers);
136
137     /**
138      * <p> This method iterates over the handlers and executes each one. A
139      * HandlerContext will be created to pass to each Handler. The
140      * HandlerContext object is reused across all Handlers that are
141      * invoked; the setHandler(Handler) method is invoked with the
142      * correct Handler descriptor before the handler is executed.</p>
143      *
144      * @param context The FacesContext
145      * @param eventType The event type which is being fired
146      * @param event An optional EventObject providing more detail
147      *
148      * @return By default, (null) is returned. However, if any of the
149      * handlers produce a non-null return value, then the value from
150      * the last handler to produces a non-null return value is
151      * returned.
152      */

153     public Object JavaDoc dispatchHandlers(FacesContext context, String JavaDoc eventType, EventObject JavaDoc event);
154 }
155
Popular Tags