KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > tag > jsf > core > VerbatimHandler


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.jsf.core;
16
17 import java.io.IOException JavaDoc;
18 import java.util.Iterator JavaDoc;
19
20 import javax.el.ELException;
21 import javax.faces.component.UIComponent;
22
23 import com.sun.facelets.FaceletContext;
24 import com.sun.facelets.tag.TextHandler;
25 import com.sun.facelets.tag.jsf.ComponentConfig;
26 import com.sun.facelets.tag.jsf.ComponentHandler;
27
28 /**
29  * Handler for f:verbatim
30  *
31  * @author Adam Winer
32  * @version $Id: VerbatimHandler.java,v 1.2 2006/03/29 04:10:09 jhook Exp $
33  */

34 public final class VerbatimHandler extends ComponentHandler {
35     public VerbatimHandler(ComponentConfig config) {
36         super(config);
37     }
38
39     protected void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent) {
40         StringBuffer JavaDoc content = new StringBuffer JavaDoc();
41         Iterator JavaDoc iter = findNextByType(TextHandler.class);
42         while (iter.hasNext()) {
43             TextHandler text = (TextHandler) iter.next();
44             content.append(text.getText(ctx));
45         }
46
47         c.getAttributes().put("value", content.toString());
48         c.getAttributes().put("escape", Boolean.FALSE);
49         c.setTransient(true);
50     }
51
52     protected void applyNextHandler(FaceletContext ctx, UIComponent c) {
53     }
54 }
55
Popular Tags