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 java.util.Set;
20 import java.util.Arrays;
21 import org.rcfaces.core.component.capability.IValueChangeEventCapability;
22 import org.rcfaces.core.component.AbstractInputComponent;
23 import org.rcfaces.core.component.capability.IMenuCapability;
24 import org.rcfaces.core.component.capability.ISeverityStyleClassCapability;
25 import org.rcfaces.core.component.capability.ITextCapability;
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
53
54
55
56
57
58
59
60
61
62
63 public class TextEditorComponent extends AbstractInputComponent implements
64 IRequiredCapability,
65 ITextCapability,
66 ITextDirectionCapability,
67 IEmptyMessageCapability,
68 IReadOnlyCapability,
69 IValueChangeEventCapability,
70 IMenuCapability,
71 IFocusStyleClassCapability,
72 ISeverityStyleClassCapability,
73 ISelectionEventCapability,
74 IAlternateTextCapability {
75
76 private static final Log LOG = LogFactory.getLog(TextEditorComponent.class);
77
78 public static final String COMPONENT_TYPE="org.rcfaces.core.textEditor";
79
80 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractInputComponent.CAMELIA_ATTRIBUTES);
81 static {
82 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"focusStyleClass","text","fatalStyleClass","styleClass","textDirection","emptyMessage","selectionListener","valueChangeListener","readOnly","errorStyleClass","warnStyleClass","alternateText","infoStyleClass","valueMimeType","required"}));
83 }
84 protected static final String CAMELIA_VALUE_ALIAS="text";
85
86 public TextEditorComponent() {
87 setRendererType(COMPONENT_TYPE);
88 }
89
90 public TextEditorComponent(String componentId) {
91 this();
92 setId(componentId);
93 }
94
95 public java.lang.String getText() {
96 return getText(null);
97 }
98
99
100
101
102 public java.lang.String getText(javax.faces.context.FacesContext facesContext) {
103 return org.rcfaces.core.internal.tools.ValuesTools.valueToString(this, facesContext);
104 }
105
106
107
108
109
110 public final boolean isTextSetted() {
111 return engine.isPropertySetted(Properties.TEXT);
112 }
113
114 public void setText(java.lang.String text) {
115 if (org.rcfaces.core.internal.listener.CameliaPhaseListener.isApplyingRequestValues()) {
116 setSubmittedExternalValue(text);
117 } else {
118 setValue(text);
119 }
120 }
121
122 public int getTextDirection() {
123 return getTextDirection(null);
124 }
125
126
127
128
129 public int getTextDirection(javax.faces.context.FacesContext facesContext) {
130 return engine.getIntProperty(Properties.TEXT_DIRECTION,0, facesContext);
131 }
132
133
134
135
136
137 public final boolean isTextDirectionSetted() {
138 return engine.isPropertySetted(Properties.TEXT_DIRECTION);
139 }
140
141 public void setTextDirection(int textDirection) {
142 engine.setProperty(Properties.TEXT_DIRECTION, textDirection);
143 }
144
145 public java.lang.String getEmptyMessage() {
146 return getEmptyMessage(null);
147 }
148
149
150
151
152 public java.lang.String getEmptyMessage(javax.faces.context.FacesContext facesContext) {
153 return engine.getStringProperty(Properties.EMPTY_MESSAGE, facesContext);
154 }
155
156
157
158
159
160 public final boolean isEmptyMessageSetted() {
161 return engine.isPropertySetted(Properties.EMPTY_MESSAGE);
162 }
163
164 public void setEmptyMessage(java.lang.String emptyMessage) {
165 engine.setProperty(Properties.EMPTY_MESSAGE, emptyMessage);
166 }
167
168 public boolean isReadOnly() {
169 return isReadOnly(null);
170 }
171
172
173
174
175 public boolean isReadOnly(javax.faces.context.FacesContext facesContext) {
176 return engine.getBoolProperty(Properties.READ_ONLY, false, facesContext);
177 }
178
179
180
181
182
183 public final boolean isReadOnlySetted() {
184 return engine.isPropertySetted(Properties.READ_ONLY);
185 }
186
187 public void setReadOnly(boolean readOnly) {
188 engine.setProperty(Properties.READ_ONLY, readOnly);
189 }
190
191 public final void addValueChangeListener(javax.faces.event.ValueChangeListener listener) {
192 addFacesListener(listener);
193 }
194
195 public final void removeValueChangeListener(javax.faces.event.ValueChangeListener listener) {
196 removeFacesListener(listener);
197 }
198
199 public final javax.faces.event.FacesListener [] listValueChangeListeners() {
200 return getFacesListeners(javax.faces.event.ValueChangeListener.class);
201 }
202
203 public IMenuComponent getMenu() {
204
205
206 return MenuTools.getMenu(this);
207
208 }
209
210 public IMenuComponent getMenu(String menuId) {
211
212
213 return MenuTools.getMenu(this, menuId);
214
215 }
216
217 public IMenuIterator listMenus() {
218
219
220 return MenuTools.listMenus(this);
221
222 }
223
224 public java.lang.String getFocusStyleClass() {
225 return getFocusStyleClass(null);
226 }
227
228
229
230
231 public java.lang.String getFocusStyleClass(javax.faces.context.FacesContext facesContext) {
232 return engine.getStringProperty(Properties.FOCUS_STYLE_CLASS, facesContext);
233 }
234
235
236
237
238
239 public final boolean isFocusStyleClassSetted() {
240 return engine.isPropertySetted(Properties.FOCUS_STYLE_CLASS);
241 }
242
243 public void setFocusStyleClass(java.lang.String focusStyleClass) {
244 engine.setProperty(Properties.FOCUS_STYLE_CLASS, focusStyleClass);
245 }
246
247 public java.lang.String getErrorStyleClass() {
248 return getErrorStyleClass(null);
249 }
250
251
252
253
254 public java.lang.String getErrorStyleClass(javax.faces.context.FacesContext facesContext) {
255 return engine.getStringProperty(Properties.ERROR_STYLE_CLASS, facesContext);
256 }
257
258
259
260
261
262 public final boolean isErrorStyleClassSetted() {
263 return engine.isPropertySetted(Properties.ERROR_STYLE_CLASS);
264 }
265
266 public void setErrorStyleClass(java.lang.String errorStyleClass) {
267 engine.setProperty(Properties.ERROR_STYLE_CLASS, errorStyleClass);
268 }
269
270 public java.lang.String getFatalStyleClass() {
271 return getFatalStyleClass(null);
272 }
273
274
275
276
277 public java.lang.String getFatalStyleClass(javax.faces.context.FacesContext facesContext) {
278 return engine.getStringProperty(Properties.FATAL_STYLE_CLASS, facesContext);
279 }
280
281
282
283
284
285 public final boolean isFatalStyleClassSetted() {
286 return engine.isPropertySetted(Properties.FATAL_STYLE_CLASS);
287 }
288
289 public void setFatalStyleClass(java.lang.String fatalStyleClass) {
290 engine.setProperty(Properties.FATAL_STYLE_CLASS, fatalStyleClass);
291 }
292
293 public java.lang.String getInfoStyleClass() {
294 return getInfoStyleClass(null);
295 }
296
297
298
299
300 public java.lang.String getInfoStyleClass(javax.faces.context.FacesContext facesContext) {
301 return engine.getStringProperty(Properties.INFO_STYLE_CLASS, facesContext);
302 }
303
304
305
306
307
308 public final boolean isInfoStyleClassSetted() {
309 return engine.isPropertySetted(Properties.INFO_STYLE_CLASS);
310 }
311
312 public void setInfoStyleClass(java.lang.String infoStyleClass) {
313 engine.setProperty(Properties.INFO_STYLE_CLASS, infoStyleClass);
314 }
315
316 public java.lang.String getWarnStyleClass() {
317 return getWarnStyleClass(null);
318 }
319
320
321
322
323 public java.lang.String getWarnStyleClass(javax.faces.context.FacesContext facesContext) {
324 return engine.getStringProperty(Properties.WARN_STYLE_CLASS, facesContext);
325 }
326
327
328
329
330
331 public final boolean isWarnStyleClassSetted() {
332 return engine.isPropertySetted(Properties.WARN_STYLE_CLASS);
333 }
334
335 public void setWarnStyleClass(java.lang.String warnStyleClass) {
336 engine.setProperty(Properties.WARN_STYLE_CLASS, warnStyleClass);
337 }
338
339 public final void addSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
340 addFacesListener(listener);
341 }
342
343 public final void removeSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
344 removeFacesListener(listener);
345 }
346
347 public final javax.faces.event.FacesListener [] listSelectionListeners() {
348 return getFacesListeners(org.rcfaces.core.event.ISelectionListener.class);
349 }
350
351 public java.lang.String getAlternateText() {
352 return getAlternateText(null);
353 }
354
355
356
357
358 public java.lang.String getAlternateText(javax.faces.context.FacesContext facesContext) {
359 return engine.getStringProperty(Properties.ALTERNATE_TEXT, facesContext);
360 }
361
362
363
364
365
366 public final boolean isAlternateTextSetted() {
367 return engine.isPropertySetted(Properties.ALTERNATE_TEXT);
368 }
369
370 public void setAlternateText(java.lang.String alternateText) {
371 engine.setProperty(Properties.ALTERNATE_TEXT, alternateText);
372 }
373
374 public String getValueMimeType() {
375 return getValueMimeType(null);
376 }
377
378 public String getValueMimeType(javax.faces.context.FacesContext facesContext) {
379 return engine.getStringProperty(Properties.VALUE_MIME_TYPE, facesContext);
380 }
381
382 public void setValueMimeType(String valueMimeType) {
383 engine.setProperty(Properties.VALUE_MIME_TYPE, valueMimeType);
384 }
385
386
387
388
389
390 public boolean isValueMimeTypeSetted() {
391 return engine.isPropertySetted(Properties.VALUE_MIME_TYPE);
392 }
393
394 protected Set getCameliaFields() {
395 return CAMELIA_ATTRIBUTES;
396 }
397
398 protected String getCameliaValueAlias() {
399 return CAMELIA_VALUE_ALIAS;
400 }
401 }