KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > compiler > UIText


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.compiler;
16
17 import java.io.IOException JavaDoc;
18
19 import javax.el.ELException;
20 import javax.faces.component.UIComponentBase;
21 import javax.faces.context.FacesContext;
22 import javax.faces.context.ResponseWriter;
23
24 import com.sun.facelets.el.ELAdaptor;
25 import com.sun.facelets.el.ELText;
26
27 /**
28  * @author Jacob Hookom
29  * @version $Id: UIText.java,v 1.6 2005/09/30 22:20:55 jhook Exp $
30  */

31 final class UIText extends UILeaf {
32
33     private final ELText txt;
34     
35     private final String JavaDoc alias;
36
37     public UIText(String JavaDoc alias, ELText txt) {
38         this.txt = txt;
39         this.alias = alias;
40     }
41
42     public String JavaDoc getFamily() {
43         return null;
44     }
45
46     public void encodeBegin(FacesContext context) throws IOException JavaDoc {
47         ResponseWriter out = context.getResponseWriter();
48         try {
49             txt.write(out, ELAdaptor.getELContext(context));
50         } catch (ELException e) {
51             throw new ELException(this.alias + ": " + e.getMessage(), e.getCause());
52         } catch (Exception JavaDoc e) {
53             throw new ELException(this.alias + ": " + e.getMessage(), e);
54         }
55     }
56
57     public String JavaDoc getRendererType() {
58         return null;
59     }
60
61     public boolean getRendersChildren() {
62         return true;
63     }
64
65     public String JavaDoc toString() {
66         return this.txt.toString();
67     }
68 }
69
Popular Tags