KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > tag > CompositeFaceletHandler


1 /**
2  * Licensed under the Common Development and Distribution License,
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://www.sun.com/cddl/
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11  * implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */

14
15 package com.sun.facelets.tag;
16
17 import java.io.IOException JavaDoc;
18
19 import javax.el.ELException;
20 import javax.faces.FacesException;
21 import javax.faces.component.UIComponent;
22
23 import com.sun.facelets.FaceletContext;
24 import com.sun.facelets.FaceletException;
25 import com.sun.facelets.FaceletHandler;
26
27 /**
28  * A FaceletHandler that is derived of 1 or more, inner FaceletHandlers. This
29  * class would be found if the next FaceletHandler is structually, a body
30  * with multiple child elements as defined in XML.
31  *
32  * @author Jacob Hookom
33  * @version $Id: CompositeFaceletHandler.java,v 1.4 2005/08/24 04:38:46 jhook Exp $
34  */

35 public final class CompositeFaceletHandler implements FaceletHandler {
36
37     private final FaceletHandler[] children;
38     private final int len;
39     
40     public CompositeFaceletHandler(FaceletHandler[] children) {
41         this.children = children;
42         this.len = children.length;
43     }
44     
45     public void apply(FaceletContext ctx, UIComponent parent) throws IOException JavaDoc, FacesException, FaceletException, ELException {
46         for (int i = 0; i < len; i++) {
47             this.children[i].apply(ctx, parent);
48         }
49     }
50     
51     public FaceletHandler[] getHandlers() {
52         return this.children;
53     }
54 }
55
Popular Tags