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.UIMessage; |
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 HtmlMessage extends UIMessage { |
29 | |
|
30 | |
public static final String COMPONENT_TYPE = "javax.faces.HtmlMessage"; |
31 | |
|
32 | |
private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Message"; |
33 | |
|
34 | |
private static final boolean DEFAULT_TOOLTIP = false; |
35 | |
|
36 | 148 | private String errorClass = null; |
37 | |
|
38 | 148 | private String errorStyle = null; |
39 | |
|
40 | 148 | private String fatalClass = null; |
41 | |
|
42 | 148 | private String fatalStyle = null; |
43 | |
|
44 | 148 | private String infoClass = null; |
45 | |
|
46 | 148 | private String infoStyle = null; |
47 | |
|
48 | 148 | private String style = null; |
49 | |
|
50 | 148 | private String styleClass = null; |
51 | |
|
52 | 148 | private String title = null; |
53 | |
|
54 | 148 | private Boolean tooltip = null; |
55 | |
|
56 | 148 | private String warnClass = null; |
57 | |
|
58 | 148 | private String warnStyle = null; |
59 | |
|
60 | |
public HtmlMessage() { |
61 | 148 | super(); |
62 | 148 | setRendererType(DEFAULT_RENDERER_TYPE); |
63 | 148 | } |
64 | |
|
65 | |
public void setErrorClass(String errorClass) { |
66 | 6 | this.errorClass = errorClass; |
67 | 6 | } |
68 | |
|
69 | |
public String getErrorClass() { |
70 | 5 | if (errorClass != null) { |
71 | 3 | return errorClass; |
72 | |
} |
73 | 2 | return ComponentUtil_.getValueBindingValueAsString(this, |
74 | |
JsfConstants.ERROR_CLASS_ATTR); |
75 | |
} |
76 | |
|
77 | |
public void setErrorStyle(String errorStyle) { |
78 | 7 | this.errorStyle = errorStyle; |
79 | 7 | } |
80 | |
|
81 | |
public String getErrorStyle() { |
82 | 5 | if (errorStyle != null) { |
83 | 4 | return errorStyle; |
84 | |
} |
85 | 1 | return ComponentUtil_.getValueBindingValueAsString(this, |
86 | |
JsfConstants.ERROR_STYLE_ATTR); |
87 | |
} |
88 | |
|
89 | |
public void setFatalClass(String fatalClass) { |
90 | 6 | this.fatalClass = fatalClass; |
91 | 6 | } |
92 | |
|
93 | |
public String getFatalClass() { |
94 | 4 | if (fatalClass != null) { |
95 | 3 | return fatalClass; |
96 | |
} |
97 | 1 | return ComponentUtil_.getValueBindingValueAsString(this, |
98 | |
JsfConstants.FATAL_CLASS_ATTR); |
99 | |
} |
100 | |
|
101 | |
public void setFatalStyle(String fatalStyle) { |
102 | 6 | this.fatalStyle = fatalStyle; |
103 | 6 | } |
104 | |
|
105 | |
public String getFatalStyle() { |
106 | 4 | if (fatalStyle != null) { |
107 | 3 | return fatalStyle; |
108 | |
} |
109 | 1 | return ComponentUtil_.getValueBindingValueAsString(this, |
110 | |
JsfConstants.FATAL_STYLE_ATTR); |
111 | |
} |
112 | |
|
113 | |
public void setInfoClass(String infoClass) { |
114 | 7 | this.infoClass = infoClass; |
115 | 7 | } |
116 | |
|
117 | |
public String getInfoClass() { |
118 | 20 | if (infoClass != null) { |
119 | 4 | return infoClass; |
120 | |
} |
121 | 16 | return ComponentUtil_.getValueBindingValueAsString(this, |
122 | |
JsfConstants.INFO_CLASS_ATTR); |
123 | |
} |
124 | |
|
125 | |
public void setInfoStyle(String infoStyle) { |
126 | 7 | this.infoStyle = infoStyle; |
127 | 7 | } |
128 | |
|
129 | |
public String getInfoStyle() { |
130 | 20 | if (infoStyle != null) { |
131 | 4 | return infoStyle; |
132 | |
} |
133 | 16 | return ComponentUtil_.getValueBindingValueAsString(this, |
134 | |
JsfConstants.INFO_STYLE_ATTR); |
135 | |
} |
136 | |
|
137 | |
public void setStyle(String style) { |
138 | 8 | this.style = style; |
139 | 8 | } |
140 | |
|
141 | |
public String getStyle() { |
142 | 19 | if (style != null) { |
143 | 4 | return style; |
144 | |
} |
145 | 15 | return ComponentUtil_.getValueBindingValueAsString(this, |
146 | |
JsfConstants.STYLE_ATTR); |
147 | |
} |
148 | |
|
149 | |
public void setStyleClass(String styleClass) { |
150 | 8 | this.styleClass = styleClass; |
151 | 8 | } |
152 | |
|
153 | |
public String getStyleClass() { |
154 | 19 | if (styleClass != null) { |
155 | 4 | return styleClass; |
156 | |
} |
157 | 15 | return ComponentUtil_.getValueBindingValueAsString(this, |
158 | |
JsfConstants.STYLE_CLASS_ATTR); |
159 | |
} |
160 | |
|
161 | |
public void setTitle(String title) { |
162 | 4 | this.title = title; |
163 | 4 | } |
164 | |
|
165 | |
public String getTitle() { |
166 | 25 | if (title != null) { |
167 | 4 | return title; |
168 | |
} |
169 | 21 | return ComponentUtil_.getValueBindingValueAsString(this, |
170 | |
JsfConstants.TITLE_ATTR); |
171 | |
} |
172 | |
|
173 | |
public void setTooltip(boolean tooltip) { |
174 | 4 | this.tooltip = Boolean.valueOf(tooltip); |
175 | 4 | } |
176 | |
|
177 | |
public boolean isTooltip() { |
178 | 25 | if (tooltip != null) { |
179 | 4 | return tooltip.booleanValue(); |
180 | |
} |
181 | 21 | ValueBinding vb = getValueBinding("tooltip"); |
182 | 21 | Boolean v = vb != null ? (Boolean) vb.getValue(getFacesContext()) |
183 | |
: null; |
184 | 21 | return v != null ? v.booleanValue() : DEFAULT_TOOLTIP; |
185 | |
} |
186 | |
|
187 | |
public void setWarnClass(String warnClass) { |
188 | 7 | this.warnClass = warnClass; |
189 | 7 | } |
190 | |
|
191 | |
public String getWarnClass() { |
192 | 5 | if (warnClass != null) { |
193 | 4 | return warnClass; |
194 | |
} |
195 | 1 | return ComponentUtil_.getValueBindingValueAsString(this, |
196 | |
JsfConstants.WARN_CLASS_ATTR); |
197 | |
} |
198 | |
|
199 | |
public void setWarnStyle(String warnStyle) { |
200 | 6 | this.warnStyle = warnStyle; |
201 | 6 | } |
202 | |
|
203 | |
public String getWarnStyle() { |
204 | 5 | if (warnStyle != null) { |
205 | 3 | return warnStyle; |
206 | |
} |
207 | 2 | return ComponentUtil_.getValueBindingValueAsString(this, |
208 | |
JsfConstants.WARN_STYLE_ATTR); |
209 | |
} |
210 | |
|
211 | |
public Object saveState(FacesContext context) { |
212 | 3 | Object values[] = new Object[13]; |
213 | 3 | values[0] = super.saveState(context); |
214 | 3 | values[1] = errorClass; |
215 | 3 | values[2] = errorStyle; |
216 | 3 | values[3] = fatalClass; |
217 | 3 | values[4] = fatalStyle; |
218 | 3 | values[5] = infoClass; |
219 | 3 | values[6] = infoStyle; |
220 | 3 | values[7] = style; |
221 | 3 | values[8] = styleClass; |
222 | 3 | values[9] = title; |
223 | 3 | values[10] = tooltip; |
224 | 3 | values[11] = warnClass; |
225 | 3 | values[12] = warnStyle; |
226 | 3 | return ((Object) (values)); |
227 | |
} |
228 | |
|
229 | |
public void restoreState(FacesContext context, Object state) { |
230 | 2 | Object values[] = (Object[]) state; |
231 | 2 | super.restoreState(context, values[0]); |
232 | 2 | errorClass = (String) values[1]; |
233 | 2 | errorStyle = (String) values[2]; |
234 | 2 | fatalClass = (String) values[3]; |
235 | 2 | fatalStyle = (String) values[4]; |
236 | 2 | infoClass = (String) values[5]; |
237 | 2 | infoStyle = (String) values[6]; |
238 | 2 | style = (String) values[7]; |
239 | 2 | styleClass = (String) values[8]; |
240 | 2 | title = (String) values[9]; |
241 | 2 | tooltip = (Boolean) values[10]; |
242 | 2 | warnClass = (String) values[11]; |
243 | 2 | warnStyle = (String) values[12]; |
244 | 2 | } |
245 | |
} |