1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.component.iterator.IMenuIterator;
4 import org.rcfaces.core.component.capability.ISelectionEventCapability;
5 import org.rcfaces.core.internal.component.Properties;
6 import java.lang.String;
7 import org.apache.commons.logging.LogFactory;
8 import org.rcfaces.core.internal.tools.MenuTools;
9 import org.rcfaces.core.component.capability.IRequiredCapability;
10 import org.rcfaces.core.component.capability.IAlternateTextCapability;
11 import org.rcfaces.core.component.capability.IEmptyMessageCapability;
12 import org.rcfaces.core.component.capability.IFocusStyleClassCapability;
13 import org.rcfaces.core.component.IMenuComponent;
14 import org.rcfaces.core.component.capability.ITextDirectionCapability;
15 import org.rcfaces.core.component.capability.IReadOnlyCapability;
16 import javax.el.ValueExpression;
17 import java.util.HashSet;
18 import org.apache.commons.logging.Log;
19 import org.rcfaces.core.component.capability.IMaxTextLengthCapability;
20 import java.util.Set;
21 import java.util.Arrays;
22 import org.rcfaces.core.component.capability.IValueChangeEventCapability;
23 import org.rcfaces.core.component.AbstractInputComponent;
24 import org.rcfaces.core.component.capability.IMenuCapability;
25 import org.rcfaces.core.component.capability.ISeverityStyleClassCapability;
26 import org.rcfaces.core.component.capability.ITextCapability;
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66 public class TextAreaComponent extends AbstractInputComponent implements
67 IRequiredCapability,
68 ITextCapability,
69 ITextDirectionCapability,
70 IEmptyMessageCapability,
71 IReadOnlyCapability,
72 IValueChangeEventCapability,
73 IMenuCapability,
74 IFocusStyleClassCapability,
75 ISeverityStyleClassCapability,
76 ISelectionEventCapability,
77 IAlternateTextCapability,
78 IMaxTextLengthCapability {
79
80 private static final Log LOG = LogFactory.getLog(TextAreaComponent.class);
81
82 public static final String COMPONENT_TYPE="org.rcfaces.core.textArea";
83
84 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractInputComponent.CAMELIA_ATTRIBUTES);
85 static {
86 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"focusStyleClass","text","fatalStyleClass","styleClass","rowNumber","columnNumber","textDirection","emptyMessage","selectionListener","maxTextLength","valueChangeListener","readOnly","errorStyleClass","warnStyleClass","alternateText","infoStyleClass","ignoreWhenFull","required"}));
87 }
88 protected static final String CAMELIA_VALUE_ALIAS="text";
89
90 public TextAreaComponent() {
91 setRendererType(COMPONENT_TYPE);
92 }
93
94 public TextAreaComponent(String componentId) {
95 this();
96 setId(componentId);
97 }
98
99 public java.lang.String getText() {
100 return getText(null);
101 }
102
103
104
105
106 public java.lang.String getText(javax.faces.context.FacesContext facesContext) {
107 return org.rcfaces.core.internal.tools.ValuesTools.valueToString(this, facesContext);
108 }
109
110
111
112
113
114 public final boolean isTextSetted() {
115 return engine.isPropertySetted(Properties.TEXT);
116 }
117
118 public void setText(java.lang.String text) {
119 if (org.rcfaces.core.internal.listener.CameliaPhaseListener.isApplyingRequestValues()) {
120 setSubmittedExternalValue(text);
121 } else {
122 setValue(text);
123 }
124 }
125
126 public int getTextDirection() {
127 return getTextDirection(null);
128 }
129
130
131
132
133 public int getTextDirection(javax.faces.context.FacesContext facesContext) {
134 return engine.getIntProperty(Properties.TEXT_DIRECTION,0, facesContext);
135 }
136
137
138
139
140
141 public final boolean isTextDirectionSetted() {
142 return engine.isPropertySetted(Properties.TEXT_DIRECTION);
143 }
144
145 public void setTextDirection(int textDirection) {
146 engine.setProperty(Properties.TEXT_DIRECTION, textDirection);
147 }
148
149 public java.lang.String getEmptyMessage() {
150 return getEmptyMessage(null);
151 }
152
153
154
155
156 public java.lang.String getEmptyMessage(javax.faces.context.FacesContext facesContext) {
157 return engine.getStringProperty(Properties.EMPTY_MESSAGE, facesContext);
158 }
159
160
161
162
163
164 public final boolean isEmptyMessageSetted() {
165 return engine.isPropertySetted(Properties.EMPTY_MESSAGE);
166 }
167
168 public void setEmptyMessage(java.lang.String emptyMessage) {
169 engine.setProperty(Properties.EMPTY_MESSAGE, emptyMessage);
170 }
171
172 public boolean isReadOnly() {
173 return isReadOnly(null);
174 }
175
176
177
178
179 public boolean isReadOnly(javax.faces.context.FacesContext facesContext) {
180 return engine.getBoolProperty(Properties.READ_ONLY, false, facesContext);
181 }
182
183
184
185
186
187 public final boolean isReadOnlySetted() {
188 return engine.isPropertySetted(Properties.READ_ONLY);
189 }
190
191 public void setReadOnly(boolean readOnly) {
192 engine.setProperty(Properties.READ_ONLY, readOnly);
193 }
194
195 public final void addValueChangeListener(javax.faces.event.ValueChangeListener listener) {
196 addFacesListener(listener);
197 }
198
199 public final void removeValueChangeListener(javax.faces.event.ValueChangeListener listener) {
200 removeFacesListener(listener);
201 }
202
203 public final javax.faces.event.FacesListener [] listValueChangeListeners() {
204 return getFacesListeners(javax.faces.event.ValueChangeListener.class);
205 }
206
207 public IMenuComponent getMenu() {
208
209
210 return MenuTools.getMenu(this);
211
212 }
213
214 public IMenuComponent getMenu(String menuId) {
215
216
217 return MenuTools.getMenu(this, menuId);
218
219 }
220
221 public IMenuIterator listMenus() {
222
223
224 return MenuTools.listMenus(this);
225
226 }
227
228 public java.lang.String getFocusStyleClass() {
229 return getFocusStyleClass(null);
230 }
231
232
233
234
235 public java.lang.String getFocusStyleClass(javax.faces.context.FacesContext facesContext) {
236 return engine.getStringProperty(Properties.FOCUS_STYLE_CLASS, facesContext);
237 }
238
239
240
241
242
243 public final boolean isFocusStyleClassSetted() {
244 return engine.isPropertySetted(Properties.FOCUS_STYLE_CLASS);
245 }
246
247 public void setFocusStyleClass(java.lang.String focusStyleClass) {
248 engine.setProperty(Properties.FOCUS_STYLE_CLASS, focusStyleClass);
249 }
250
251 public java.lang.String getErrorStyleClass() {
252 return getErrorStyleClass(null);
253 }
254
255
256
257
258 public java.lang.String getErrorStyleClass(javax.faces.context.FacesContext facesContext) {
259 return engine.getStringProperty(Properties.ERROR_STYLE_CLASS, facesContext);
260 }
261
262
263
264
265
266 public final boolean isErrorStyleClassSetted() {
267 return engine.isPropertySetted(Properties.ERROR_STYLE_CLASS);
268 }
269
270 public void setErrorStyleClass(java.lang.String errorStyleClass) {
271 engine.setProperty(Properties.ERROR_STYLE_CLASS, errorStyleClass);
272 }
273
274 public java.lang.String getFatalStyleClass() {
275 return getFatalStyleClass(null);
276 }
277
278
279
280
281 public java.lang.String getFatalStyleClass(javax.faces.context.FacesContext facesContext) {
282 return engine.getStringProperty(Properties.FATAL_STYLE_CLASS, facesContext);
283 }
284
285
286
287
288
289 public final boolean isFatalStyleClassSetted() {
290 return engine.isPropertySetted(Properties.FATAL_STYLE_CLASS);
291 }
292
293 public void setFatalStyleClass(java.lang.String fatalStyleClass) {
294 engine.setProperty(Properties.FATAL_STYLE_CLASS, fatalStyleClass);
295 }
296
297 public java.lang.String getInfoStyleClass() {
298 return getInfoStyleClass(null);
299 }
300
301
302
303
304 public java.lang.String getInfoStyleClass(javax.faces.context.FacesContext facesContext) {
305 return engine.getStringProperty(Properties.INFO_STYLE_CLASS, facesContext);
306 }
307
308
309
310
311
312 public final boolean isInfoStyleClassSetted() {
313 return engine.isPropertySetted(Properties.INFO_STYLE_CLASS);
314 }
315
316 public void setInfoStyleClass(java.lang.String infoStyleClass) {
317 engine.setProperty(Properties.INFO_STYLE_CLASS, infoStyleClass);
318 }
319
320 public java.lang.String getWarnStyleClass() {
321 return getWarnStyleClass(null);
322 }
323
324
325
326
327 public java.lang.String getWarnStyleClass(javax.faces.context.FacesContext facesContext) {
328 return engine.getStringProperty(Properties.WARN_STYLE_CLASS, facesContext);
329 }
330
331
332
333
334
335 public final boolean isWarnStyleClassSetted() {
336 return engine.isPropertySetted(Properties.WARN_STYLE_CLASS);
337 }
338
339 public void setWarnStyleClass(java.lang.String warnStyleClass) {
340 engine.setProperty(Properties.WARN_STYLE_CLASS, warnStyleClass);
341 }
342
343 public final void addSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
344 addFacesListener(listener);
345 }
346
347 public final void removeSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
348 removeFacesListener(listener);
349 }
350
351 public final javax.faces.event.FacesListener [] listSelectionListeners() {
352 return getFacesListeners(org.rcfaces.core.event.ISelectionListener.class);
353 }
354
355 public java.lang.String getAlternateText() {
356 return getAlternateText(null);
357 }
358
359
360
361
362 public java.lang.String getAlternateText(javax.faces.context.FacesContext facesContext) {
363 return engine.getStringProperty(Properties.ALTERNATE_TEXT, facesContext);
364 }
365
366
367
368
369
370 public final boolean isAlternateTextSetted() {
371 return engine.isPropertySetted(Properties.ALTERNATE_TEXT);
372 }
373
374 public void setAlternateText(java.lang.String alternateText) {
375 engine.setProperty(Properties.ALTERNATE_TEXT, alternateText);
376 }
377
378 public int getMaxTextLength() {
379 return getMaxTextLength(null);
380 }
381
382
383
384
385 public int getMaxTextLength(javax.faces.context.FacesContext facesContext) {
386 return engine.getIntProperty(Properties.MAX_TEXT_LENGTH,0, facesContext);
387 }
388
389
390
391
392
393 public final boolean isMaxTextLengthSetted() {
394 return engine.isPropertySetted(Properties.MAX_TEXT_LENGTH);
395 }
396
397 public void setMaxTextLength(int maxTextLength) {
398 engine.setProperty(Properties.MAX_TEXT_LENGTH, maxTextLength);
399 }
400
401
402
403
404
405 public int getColumnNumber() {
406 return getColumnNumber(null);
407 }
408
409
410
411
412
413 public int getColumnNumber(javax.faces.context.FacesContext facesContext) {
414 return engine.getIntProperty(Properties.COLUMN_NUMBER, 0, facesContext);
415 }
416
417
418
419
420
421 public void setColumnNumber(int columnNumber) {
422 engine.setProperty(Properties.COLUMN_NUMBER, columnNumber);
423 }
424
425
426
427
428
429
430
431
432
433 public boolean isColumnNumberSetted() {
434 return engine.isPropertySetted(Properties.COLUMN_NUMBER);
435 }
436
437
438
439
440
441 public int getRowNumber() {
442 return getRowNumber(null);
443 }
444
445
446
447
448
449 public int getRowNumber(javax.faces.context.FacesContext facesContext) {
450 return engine.getIntProperty(Properties.ROW_NUMBER, 0, facesContext);
451 }
452
453
454
455
456
457 public void setRowNumber(int rowNumber) {
458 engine.setProperty(Properties.ROW_NUMBER, rowNumber);
459 }
460
461
462
463
464
465
466
467
468
469 public boolean isRowNumberSetted() {
470 return engine.isPropertySetted(Properties.ROW_NUMBER);
471 }
472
473 public boolean isIgnoreWhenFull() {
474 return isIgnoreWhenFull(null);
475 }
476
477 public boolean isIgnoreWhenFull(javax.faces.context.FacesContext facesContext) {
478 return engine.getBoolProperty(Properties.IGNORE_WHEN_FULL, false, facesContext);
479 }
480
481 public void setIgnoreWhenFull(boolean ignoreWhenFull) {
482 engine.setProperty(Properties.IGNORE_WHEN_FULL, ignoreWhenFull);
483 }
484
485
486
487
488
489 public boolean isIgnoreWhenFullSetted() {
490 return engine.isPropertySetted(Properties.IGNORE_WHEN_FULL);
491 }
492
493 protected Set getCameliaFields() {
494 return CAMELIA_ATTRIBUTES;
495 }
496
497 protected String getCameliaValueAlias() {
498 return CAMELIA_VALUE_ALIAS;
499 }
500 }