1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.internal.component.Properties;
4 import org.rcfaces.core.component.capability.ITypedComponentCapability;
5 import org.apache.commons.logging.LogFactory;
6 import org.rcfaces.core.component.capability.IAccessKeyCapability;
7 import org.rcfaces.core.component.capability.IForCapability;
8 import org.rcfaces.core.component.capability.ITextDirectionCapability;
9 import javax.el.ValueExpression;
10 import org.rcfaces.core.component.capability.ITextAlignmentCapability;
11 import java.util.HashSet;
12 import org.apache.commons.logging.Log;
13 import org.rcfaces.core.component.AbstractOutputComponent;
14 import java.util.Set;
15 import java.util.Arrays;
16 import org.rcfaces.core.component.capability.ITextCapability;
17 import org.rcfaces.core.component.capability.IFontCapability;
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 public class TextComponent extends AbstractOutputComponent implements
53 ITextCapability,
54 ITextDirectionCapability,
55 IFontCapability,
56 ITextAlignmentCapability,
57 IAccessKeyCapability,
58 IForCapability,
59 ITypedComponentCapability {
60
61 private static final Log LOG = LogFactory.getLog(TextComponent.class);
62
63 public static final String COMPONENT_TYPE="org.rcfaces.core.text";
64
65 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractOutputComponent.CAMELIA_ATTRIBUTES);
66 static {
67 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"accessKey","fontName","fontItalic","text","fontUnderline","for","textAlignment","fontBold","type","fontSize","textDirection"}));
68 }
69 protected static final String CAMELIA_VALUE_ALIAS="text";
70
71 public TextComponent() {
72 setRendererType(COMPONENT_TYPE);
73 }
74
75 public TextComponent(String componentId) {
76 this();
77 setId(componentId);
78 }
79
80 public java.lang.String getText() {
81 return getText(null);
82 }
83
84
85
86
87 public java.lang.String getText(javax.faces.context.FacesContext facesContext) {
88 return org.rcfaces.core.internal.tools.ValuesTools.valueToString(this, facesContext);
89 }
90
91
92
93
94
95 public final boolean isTextSetted() {
96 return engine.isPropertySetted(Properties.TEXT);
97 }
98
99 public void setText(java.lang.String text) {
100 setValue(text);
101 }
102
103 public int getTextDirection() {
104 return getTextDirection(null);
105 }
106
107
108
109
110 public int getTextDirection(javax.faces.context.FacesContext facesContext) {
111 return engine.getIntProperty(Properties.TEXT_DIRECTION,0, facesContext);
112 }
113
114
115
116
117
118 public final boolean isTextDirectionSetted() {
119 return engine.isPropertySetted(Properties.TEXT_DIRECTION);
120 }
121
122 public void setTextDirection(int textDirection) {
123 engine.setProperty(Properties.TEXT_DIRECTION, textDirection);
124 }
125
126 public java.lang.Boolean getFontBold() {
127 return getFontBold(null);
128 }
129
130
131
132
133 public java.lang.Boolean getFontBold(javax.faces.context.FacesContext facesContext) {
134 return engine.getBooleanProperty(Properties.FONT_BOLD, facesContext);
135 }
136
137
138
139
140
141 public final boolean isFontBoldSetted() {
142 return engine.isPropertySetted(Properties.FONT_BOLD);
143 }
144
145 public void setFontBold(java.lang.Boolean fontBold) {
146 engine.setProperty(Properties.FONT_BOLD, fontBold);
147 }
148
149 public java.lang.Boolean getFontItalic() {
150 return getFontItalic(null);
151 }
152
153
154
155
156 public java.lang.Boolean getFontItalic(javax.faces.context.FacesContext facesContext) {
157 return engine.getBooleanProperty(Properties.FONT_ITALIC, facesContext);
158 }
159
160
161
162
163
164 public final boolean isFontItalicSetted() {
165 return engine.isPropertySetted(Properties.FONT_ITALIC);
166 }
167
168 public void setFontItalic(java.lang.Boolean fontItalic) {
169 engine.setProperty(Properties.FONT_ITALIC, fontItalic);
170 }
171
172 public java.lang.String getFontName() {
173 return getFontName(null);
174 }
175
176
177
178
179 public java.lang.String getFontName(javax.faces.context.FacesContext facesContext) {
180 return engine.getStringProperty(Properties.FONT_NAME, facesContext);
181 }
182
183
184
185
186
187 public final boolean isFontNameSetted() {
188 return engine.isPropertySetted(Properties.FONT_NAME);
189 }
190
191 public void setFontName(java.lang.String fontName) {
192 engine.setProperty(Properties.FONT_NAME, fontName);
193 }
194
195 public java.lang.String getFontSize() {
196 return getFontSize(null);
197 }
198
199
200
201
202 public java.lang.String getFontSize(javax.faces.context.FacesContext facesContext) {
203 return engine.getStringProperty(Properties.FONT_SIZE, facesContext);
204 }
205
206
207
208
209
210 public final boolean isFontSizeSetted() {
211 return engine.isPropertySetted(Properties.FONT_SIZE);
212 }
213
214 public void setFontSize(java.lang.String fontSize) {
215 engine.setProperty(Properties.FONT_SIZE, fontSize);
216 }
217
218 public java.lang.Boolean getFontUnderline() {
219 return getFontUnderline(null);
220 }
221
222
223
224
225 public java.lang.Boolean getFontUnderline(javax.faces.context.FacesContext facesContext) {
226 return engine.getBooleanProperty(Properties.FONT_UNDERLINE, facesContext);
227 }
228
229
230
231
232
233 public final boolean isFontUnderlineSetted() {
234 return engine.isPropertySetted(Properties.FONT_UNDERLINE);
235 }
236
237 public void setFontUnderline(java.lang.Boolean fontUnderline) {
238 engine.setProperty(Properties.FONT_UNDERLINE, fontUnderline);
239 }
240
241 public java.lang.String getTextAlignment() {
242 return getTextAlignment(null);
243 }
244
245
246
247
248 public java.lang.String getTextAlignment(javax.faces.context.FacesContext facesContext) {
249 return engine.getStringProperty(Properties.TEXT_ALIGNMENT, facesContext);
250 }
251
252
253
254
255
256 public final boolean isTextAlignmentSetted() {
257 return engine.isPropertySetted(Properties.TEXT_ALIGNMENT);
258 }
259
260 public void setTextAlignment(java.lang.String textAlignment) {
261 engine.setProperty(Properties.TEXT_ALIGNMENT, textAlignment);
262 }
263
264 public java.lang.String getAccessKey() {
265 return getAccessKey(null);
266 }
267
268
269
270
271 public java.lang.String getAccessKey(javax.faces.context.FacesContext facesContext) {
272 return engine.getStringProperty(Properties.ACCESS_KEY, facesContext);
273 }
274
275
276
277
278
279 public final boolean isAccessKeySetted() {
280 return engine.isPropertySetted(Properties.ACCESS_KEY);
281 }
282
283 public void setAccessKey(java.lang.String accessKey) {
284 engine.setProperty(Properties.ACCESS_KEY, accessKey);
285 }
286
287 public java.lang.String getFor() {
288 return getFor(null);
289 }
290
291
292
293
294 public java.lang.String getFor(javax.faces.context.FacesContext facesContext) {
295 return engine.getStringProperty(Properties.FOR, facesContext);
296 }
297
298
299
300
301
302 public final boolean isForSetted() {
303 return engine.isPropertySetted(Properties.FOR);
304 }
305
306 public void setFor(java.lang.String forValue) {
307 engine.setProperty(Properties.FOR, forValue);
308 }
309
310 public java.lang.String getType() {
311 return getType(null);
312 }
313
314
315
316
317 public java.lang.String getType(javax.faces.context.FacesContext facesContext) {
318 return engine.getStringProperty(Properties.TYPE, facesContext);
319 }
320
321
322
323
324
325 public final boolean isTypeSetted() {
326 return engine.isPropertySetted(Properties.TYPE);
327 }
328
329 public void setType(java.lang.String type) {
330 engine.setProperty(Properties.TYPE, type);
331 }
332
333 protected Set getCameliaFields() {
334 return CAMELIA_ATTRIBUTES;
335 }
336
337 protected String getCameliaValueAlias() {
338 return CAMELIA_VALUE_ALIAS;
339 }
340 }