Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
UIText |
|
| 1.6666666666666667;1.667 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, | |
13 | * software distributed under the License is distributed on an | |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | * KIND, either express or implied. See the License for the | |
16 | * specific language governing permissions and limitations | |
17 | * under the License. | |
18 | */ | |
19 | package org.apache.myfaces.view.facelets.compiler; | |
20 | ||
21 | import java.io.IOException; | |
22 | ||
23 | import javax.el.ELException; | |
24 | import javax.faces.context.FacesContext; | |
25 | import javax.faces.context.ResponseWriter; | |
26 | ||
27 | import org.apache.myfaces.view.facelets.el.ELText; | |
28 | ||
29 | /** | |
30 | * @author Jacob Hookom | |
31 | * @version $Id: UIText.java 1187701 2011-10-22 12:21:54Z bommel $ | |
32 | */ | |
33 | final class UIText extends UILeaf | |
34 | { | |
35 | private final String _alias; | |
36 | ||
37 | private final ELText _txt; | |
38 | ||
39 | public UIText(String alias, ELText txt) | |
40 | 0 | { |
41 | 0 | _txt = txt; |
42 | 0 | _alias = alias; |
43 | 0 | } |
44 | ||
45 | @Override | |
46 | public String getFamily() | |
47 | { | |
48 | 0 | return null; |
49 | } | |
50 | ||
51 | @Override | |
52 | public void encodeBegin(FacesContext context) throws IOException | |
53 | { | |
54 | 0 | ResponseWriter out = context.getResponseWriter(); |
55 | try | |
56 | { | |
57 | 0 | _txt.write(out, context.getELContext()); |
58 | } | |
59 | 0 | catch (ELException e) |
60 | { | |
61 | 0 | throw new ELException(_alias + ": " + e.getMessage(), e.getCause()); |
62 | } | |
63 | 0 | catch (Exception e) |
64 | { | |
65 | 0 | throw new ELException(_alias + ": " + e.getMessage(), e); |
66 | 0 | } |
67 | 0 | } |
68 | ||
69 | @Override | |
70 | public String getRendererType() | |
71 | { | |
72 | 0 | return null; |
73 | } | |
74 | ||
75 | @Override | |
76 | public boolean getRendersChildren() | |
77 | { | |
78 | 0 | return true; |
79 | } | |
80 | ||
81 | @Override | |
82 | public String toString() | |
83 | { | |
84 | 0 | return _txt.toString(); |
85 | } | |
86 | } |