1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package javax.faces.component.html; |
17 | |
|
18 | |
import javax.faces.component.ComponentUtil_; |
19 | |
import javax.faces.component.UIOutput; |
20 | |
import javax.faces.context.FacesContext; |
21 | |
import javax.faces.el.ValueBinding; |
22 | |
|
23 | |
import org.seasar.teeda.core.JsfConstants; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
public class HtmlOutputText extends UIOutput { |
29 | |
|
30 | |
public static final String COMPONENT_TYPE = "javax.faces.HtmlOutputText"; |
31 | |
|
32 | |
private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Text"; |
33 | |
|
34 | |
private static final boolean DEFAULT_ESCAPE = true; |
35 | |
|
36 | 233 | private Boolean escape = null; |
37 | |
|
38 | 233 | private String style = null; |
39 | |
|
40 | 233 | private String styleClass = null; |
41 | |
|
42 | 233 | private String title = null; |
43 | |
|
44 | |
public HtmlOutputText() { |
45 | 233 | super(); |
46 | 233 | setRendererType(DEFAULT_RENDERER_TYPE); |
47 | 233 | } |
48 | |
|
49 | |
public void setEscape(boolean escape) { |
50 | 5 | this.escape = Boolean.valueOf(escape); |
51 | 5 | } |
52 | |
|
53 | |
public boolean isEscape() { |
54 | 151 | if (escape != null) { |
55 | 6 | return escape.booleanValue(); |
56 | |
} |
57 | 145 | ValueBinding vb = getValueBinding("escape"); |
58 | 145 | Boolean v = vb != null ? (Boolean) vb.getValue(getFacesContext()) |
59 | |
: null; |
60 | 145 | return v != null ? v.booleanValue() : DEFAULT_ESCAPE; |
61 | |
} |
62 | |
|
63 | |
public void setStyle(String style) { |
64 | 5 | this.style = style; |
65 | 5 | } |
66 | |
|
67 | |
public String getStyle() { |
68 | 294 | if (style != null) { |
69 | 8 | return style; |
70 | |
} |
71 | 286 | return ComponentUtil_.getValueBindingValueAsString(this, |
72 | |
JsfConstants.STYLE_ATTR); |
73 | |
} |
74 | |
|
75 | |
public void setStyleClass(String styleClass) { |
76 | 5 | this.styleClass = styleClass; |
77 | 5 | } |
78 | |
|
79 | |
public String getStyleClass() { |
80 | 295 | if (styleClass != null) { |
81 | 8 | return styleClass; |
82 | |
} |
83 | 287 | return ComponentUtil_.getValueBindingValueAsString(this, |
84 | |
JsfConstants.STYLE_CLASS_ATTR); |
85 | |
} |
86 | |
|
87 | |
public void setTitle(String title) { |
88 | 4 | this.title = title; |
89 | 4 | } |
90 | |
|
91 | |
public String getTitle() { |
92 | 295 | if (title != null) { |
93 | 5 | return title; |
94 | |
} |
95 | 290 | return ComponentUtil_.getValueBindingValueAsString(this, |
96 | |
JsfConstants.TITLE_ATTR); |
97 | |
} |
98 | |
|
99 | |
public Object saveState(FacesContext context) { |
100 | 5 | Object values[] = new Object[5]; |
101 | 5 | values[0] = super.saveState(context); |
102 | 5 | values[1] = escape; |
103 | 5 | values[2] = style; |
104 | 5 | values[3] = styleClass; |
105 | 5 | values[4] = title; |
106 | 5 | return ((Object) (values)); |
107 | |
} |
108 | |
|
109 | |
public void restoreState(FacesContext context, Object state) { |
110 | 4 | Object values[] = (Object[]) state; |
111 | 4 | super.restoreState(context, values[0]); |
112 | 4 | escape = (Boolean) values[1]; |
113 | 4 | style = (String) values[2]; |
114 | 4 | styleClass = (String) values[3]; |
115 | 4 | title = (String) values[4]; |
116 | 4 | } |
117 | |
} |