View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.component.capability.IVisibilityCapability;
4   import org.rcfaces.core.internal.component.Properties;
5   import org.rcfaces.core.component.capability.IUserEventCapability;
6   import org.apache.commons.logging.LogFactory;
7   import org.rcfaces.core.component.capability.IValidationEventCapability;
8   import javax.faces.context.FacesContext;
9   import org.rcfaces.core.component.capability.IImmediateCapability;
10  import org.apache.commons.logging.Log;
11  import java.util.Set;
12  import org.rcfaces.core.component.capability.IDialogPriorityCapability;
13  import org.rcfaces.core.internal.component.CameliaInputComponent;
14  import org.rcfaces.core.component.capability.ISelectionEventCapability;
15  import org.rcfaces.core.component.capability.IImageCapability;
16  import org.rcfaces.core.component.familly.IContentAccessors;
17  import java.lang.String;
18  import org.rcfaces.core.component.capability.ILookAndFeelCapability;
19  import org.rcfaces.core.component.capability.IWAIRoleCapability;
20  import org.rcfaces.core.component.capability.IHiddenModeCapability;
21  import org.rcfaces.core.internal.tools.ImageAccessorTools;
22  import org.rcfaces.core.component.capability.ITextDirectionCapability;
23  import javax.el.ValueExpression;
24  import org.rcfaces.core.component.capability.ISizeCapability;
25  import java.util.HashSet;
26  import org.rcfaces.core.component.capability.IStyleClassCapability;
27  import java.util.Arrays;
28  import org.rcfaces.core.internal.converter.HiddenModeConverter;
29  import org.rcfaces.core.internal.capability.IImageAccessorsCapability;
30  import org.rcfaces.core.component.capability.ITextCapability;
31  
32  public class MessageDialogComponent extends CameliaInputComponent implements 
33  	IImageCapability,
34  	IStyleClassCapability,
35  	ITextCapability,
36  	ITextDirectionCapability,
37  	IVisibilityCapability,
38  	IDialogPriorityCapability,
39  	IImmediateCapability,
40  	IValidationEventCapability,
41  	ISizeCapability,
42  	IHiddenModeCapability,
43  	ILookAndFeelCapability,
44  	IWAIRoleCapability,
45  	ISelectionEventCapability,
46  	IUserEventCapability,
47  	IImageAccessorsCapability {
48  
49  	private static final Log LOG = LogFactory.getLog(MessageDialogComponent.class);
50  
51  	public static final String COMPONENT_TYPE="org.rcfaces.core.messageDialog";
52  
53  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaInputComponent.CAMELIA_ATTRIBUTES);
54  	static {
55  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"lookId","text","userEventListener","visible","styleClass","width","ariaLabel","dialogPriority","textDirection","ariaLevel","selectionListener","immediate","title","height","hiddenMode","defaultValue","waiRole","imageURL","validationListener"}));
56  	}
57  
58  	public MessageDialogComponent() {
59  		setRendererType(COMPONENT_TYPE);
60  	}
61  
62  	public MessageDialogComponent(String componentId) {
63  		this();
64  		setId(componentId);
65  	}
66  
67  	public IContentAccessors getImageAccessors(FacesContext facesContext) {
68  
69  
70  			return ImageAccessorTools.createImageAccessors(facesContext, this, engine);
71  		
72  	}
73  
74  	public void setHiddenMode(String hiddenMode) {
75  
76  
77  			setHiddenMode(((Integer)HiddenModeConverter.SINGLETON.getAsObject(null, this, hiddenMode)).intValue());
78  		
79  	}
80  
81  	public Boolean getVisibleState(FacesContext facesContext) {
82  
83  
84  			if (engine.isPropertySetted(Properties.VISIBLE)==false) {
85  				return null;
86  			}
87  			
88  			return Boolean.valueOf(isVisible(facesContext));
89  		
90  	}
91  
92  	public java.lang.String getImageURL() {
93  		return getImageURL(null);
94  	}
95  
96  	/**
97  	 * See {@link #getImageURL() getImageURL()} for more details
98  	 */
99  	public java.lang.String getImageURL(javax.faces.context.FacesContext facesContext) {
100 		return engine.getStringProperty(Properties.IMAGE_URL, facesContext);
101 	}
102 
103 	/**
104 	 * Returns <code>true</code> if the attribute "imageURL" is set.
105 	 * @return <code>true</code> if the attribute is set.
106 	 */
107 	public final boolean isImageURLSetted() {
108 		return engine.isPropertySetted(Properties.IMAGE_URL);
109 	}
110 
111 	public void setImageURL(java.lang.String imageURL) {
112 		engine.setProperty(Properties.IMAGE_URL, imageURL);
113 	}
114 
115 	public IContentAccessors getImageAccessors() {
116 
117 
118 			return getImageAccessors(null);
119 		
120 	}
121 
122 	public java.lang.String getStyleClass() {
123 		return getStyleClass(null);
124 	}
125 
126 	/**
127 	 * See {@link #getStyleClass() getStyleClass()} for more details
128 	 */
129 	public java.lang.String getStyleClass(javax.faces.context.FacesContext facesContext) {
130 		return engine.getStringProperty(Properties.STYLE_CLASS, facesContext);
131 	}
132 
133 	/**
134 	 * Returns <code>true</code> if the attribute "styleClass" is set.
135 	 * @return <code>true</code> if the attribute is set.
136 	 */
137 	public final boolean isStyleClassSetted() {
138 		return engine.isPropertySetted(Properties.STYLE_CLASS);
139 	}
140 
141 	public void setStyleClass(java.lang.String styleClass) {
142 		engine.setProperty(Properties.STYLE_CLASS, styleClass);
143 	}
144 
145 	public java.lang.String getText() {
146 		return getText(null);
147 	}
148 
149 	/**
150 	 * See {@link #getText() getText()} for more details
151 	 */
152 	public java.lang.String getText(javax.faces.context.FacesContext facesContext) {
153 		return engine.getStringProperty(Properties.TEXT, facesContext);
154 	}
155 
156 	/**
157 	 * Returns <code>true</code> if the attribute "text" is set.
158 	 * @return <code>true</code> if the attribute is set.
159 	 */
160 	public final boolean isTextSetted() {
161 		return engine.isPropertySetted(Properties.TEXT);
162 	}
163 
164 	public void setText(java.lang.String text) {
165 		engine.setProperty(Properties.TEXT, text);
166 	}
167 
168 	public int getTextDirection() {
169 		return getTextDirection(null);
170 	}
171 
172 	/**
173 	 * See {@link #getTextDirection() getTextDirection()} for more details
174 	 */
175 	public int getTextDirection(javax.faces.context.FacesContext facesContext) {
176 		return engine.getIntProperty(Properties.TEXT_DIRECTION,0, facesContext);
177 	}
178 
179 	/**
180 	 * Returns <code>true</code> if the attribute "textDirection" is set.
181 	 * @return <code>true</code> if the attribute is set.
182 	 */
183 	public final boolean isTextDirectionSetted() {
184 		return engine.isPropertySetted(Properties.TEXT_DIRECTION);
185 	}
186 
187 	public void setTextDirection(int textDirection) {
188 		engine.setProperty(Properties.TEXT_DIRECTION, textDirection);
189 	}
190 
191 	public boolean isVisible() {
192 		return isVisible(null);
193 	}
194 
195 	/**
196 	 * See {@link #isVisible() isVisible()} for more details
197 	 */
198 	public boolean isVisible(javax.faces.context.FacesContext facesContext) {
199 		return engine.getBoolProperty(Properties.VISIBLE, true, facesContext);
200 	}
201 
202 	/**
203 	 * Returns <code>true</code> if the attribute "visible" is set.
204 	 * @return <code>true</code> if the attribute is set.
205 	 */
206 	public final boolean isVisibleSetted() {
207 		return engine.isPropertySetted(Properties.VISIBLE);
208 	}
209 
210 	public void setVisible(boolean visible) {
211 		engine.setProperty(Properties.VISIBLE, visible);
212 	}
213 
214 	public Boolean getVisibleState() {
215 
216 
217 			return getVisibleState(null);
218 		
219 	}
220 
221 	public int getDialogPriority() {
222 		return getDialogPriority(null);
223 	}
224 
225 	/**
226 	 * See {@link #getDialogPriority() getDialogPriority()} for more details
227 	 */
228 	public int getDialogPriority(javax.faces.context.FacesContext facesContext) {
229 		return engine.getIntProperty(Properties.DIALOG_PRIORITY,0, facesContext);
230 	}
231 
232 	/**
233 	 * Returns <code>true</code> if the attribute "dialogPriority" is set.
234 	 * @return <code>true</code> if the attribute is set.
235 	 */
236 	public final boolean isDialogPrioritySetted() {
237 		return engine.isPropertySetted(Properties.DIALOG_PRIORITY);
238 	}
239 
240 	public void setDialogPriority(int dialogPriority) {
241 		engine.setProperty(Properties.DIALOG_PRIORITY, dialogPriority);
242 	}
243 
244 	public final void addValidationListener(org.rcfaces.core.event.IValidationListener listener) {
245 		addFacesListener(listener);
246 	}
247 
248 	public final void removeValidationListener(org.rcfaces.core.event.IValidationListener listener) {
249 		removeFacesListener(listener);
250 	}
251 
252 	public final javax.faces.event.FacesListener [] listValidationListeners() {
253 		return getFacesListeners(org.rcfaces.core.event.IValidationListener.class);
254 	}
255 
256 	public java.lang.String getWidth() {
257 		return getWidth(null);
258 	}
259 
260 	/**
261 	 * See {@link #getWidth() getWidth()} for more details
262 	 */
263 	public java.lang.String getWidth(javax.faces.context.FacesContext facesContext) {
264 		return engine.getStringProperty(Properties.WIDTH, facesContext);
265 	}
266 
267 	/**
268 	 * Returns <code>true</code> if the attribute "width" is set.
269 	 * @return <code>true</code> if the attribute is set.
270 	 */
271 	public final boolean isWidthSetted() {
272 		return engine.isPropertySetted(Properties.WIDTH);
273 	}
274 
275 	public void setWidth(java.lang.String width) {
276 		engine.setProperty(Properties.WIDTH, width);
277 	}
278 
279 	public java.lang.String getHeight() {
280 		return getHeight(null);
281 	}
282 
283 	/**
284 	 * See {@link #getHeight() getHeight()} for more details
285 	 */
286 	public java.lang.String getHeight(javax.faces.context.FacesContext facesContext) {
287 		return engine.getStringProperty(Properties.HEIGHT, facesContext);
288 	}
289 
290 	/**
291 	 * Returns <code>true</code> if the attribute "height" is set.
292 	 * @return <code>true</code> if the attribute is set.
293 	 */
294 	public final boolean isHeightSetted() {
295 		return engine.isPropertySetted(Properties.HEIGHT);
296 	}
297 
298 	public void setHeight(java.lang.String height) {
299 		engine.setProperty(Properties.HEIGHT, height);
300 	}
301 
302 	public int getHiddenMode() {
303 		return getHiddenMode(null);
304 	}
305 
306 	/**
307 	 * See {@link #getHiddenMode() getHiddenMode()} for more details
308 	 */
309 	public int getHiddenMode(javax.faces.context.FacesContext facesContext) {
310 		return engine.getIntProperty(Properties.HIDDEN_MODE,IHiddenModeCapability.DEFAULT_HIDDEN_MODE, facesContext);
311 	}
312 
313 	/**
314 	 * Returns <code>true</code> if the attribute "hiddenMode" is set.
315 	 * @return <code>true</code> if the attribute is set.
316 	 */
317 	public final boolean isHiddenModeSetted() {
318 		return engine.isPropertySetted(Properties.HIDDEN_MODE);
319 	}
320 
321 	public void setHiddenMode(int hiddenMode) {
322 		engine.setProperty(Properties.HIDDEN_MODE, hiddenMode);
323 	}
324 
325 	public java.lang.String getLookId() {
326 		return getLookId(null);
327 	}
328 
329 	/**
330 	 * See {@link #getLookId() getLookId()} for more details
331 	 */
332 	public java.lang.String getLookId(javax.faces.context.FacesContext facesContext) {
333 		return engine.getStringProperty(Properties.LOOK_ID, facesContext);
334 	}
335 
336 	/**
337 	 * Returns <code>true</code> if the attribute "lookId" is set.
338 	 * @return <code>true</code> if the attribute is set.
339 	 */
340 	public final boolean isLookIdSetted() {
341 		return engine.isPropertySetted(Properties.LOOK_ID);
342 	}
343 
344 	public void setLookId(java.lang.String lookId) {
345 		engine.setProperty(Properties.LOOK_ID, lookId);
346 	}
347 
348 	public java.lang.String getAriaLabel() {
349 		return getAriaLabel(null);
350 	}
351 
352 	/**
353 	 * See {@link #getAriaLabel() getAriaLabel()} for more details
354 	 */
355 	public java.lang.String getAriaLabel(javax.faces.context.FacesContext facesContext) {
356 		return engine.getStringProperty(Properties.ARIA_LABEL, facesContext);
357 	}
358 
359 	/**
360 	 * Returns <code>true</code> if the attribute "ariaLabel" is set.
361 	 * @return <code>true</code> if the attribute is set.
362 	 */
363 	public final boolean isAriaLabelSetted() {
364 		return engine.isPropertySetted(Properties.ARIA_LABEL);
365 	}
366 
367 	public void setAriaLabel(java.lang.String ariaLabel) {
368 		engine.setProperty(Properties.ARIA_LABEL, ariaLabel);
369 	}
370 
371 	public int getAriaLevel() {
372 		return getAriaLevel(null);
373 	}
374 
375 	/**
376 	 * See {@link #getAriaLevel() getAriaLevel()} for more details
377 	 */
378 	public int getAriaLevel(javax.faces.context.FacesContext facesContext) {
379 		return engine.getIntProperty(Properties.ARIA_LEVEL,0, facesContext);
380 	}
381 
382 	/**
383 	 * Returns <code>true</code> if the attribute "ariaLevel" is set.
384 	 * @return <code>true</code> if the attribute is set.
385 	 */
386 	public final boolean isAriaLevelSetted() {
387 		return engine.isPropertySetted(Properties.ARIA_LEVEL);
388 	}
389 
390 	public void setAriaLevel(int ariaLevel) {
391 		engine.setProperty(Properties.ARIA_LEVEL, ariaLevel);
392 	}
393 
394 	public java.lang.String getWaiRole() {
395 		return getWaiRole(null);
396 	}
397 
398 	/**
399 	 * See {@link #getWaiRole() getWaiRole()} for more details
400 	 */
401 	public java.lang.String getWaiRole(javax.faces.context.FacesContext facesContext) {
402 		return engine.getStringProperty(Properties.WAI_ROLE, facesContext);
403 	}
404 
405 	/**
406 	 * Returns <code>true</code> if the attribute "waiRole" is set.
407 	 * @return <code>true</code> if the attribute is set.
408 	 */
409 	public final boolean isWaiRoleSetted() {
410 		return engine.isPropertySetted(Properties.WAI_ROLE);
411 	}
412 
413 	public void setWaiRole(java.lang.String waiRole) {
414 		engine.setProperty(Properties.WAI_ROLE, waiRole);
415 	}
416 
417 	public final void addSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
418 		addFacesListener(listener);
419 	}
420 
421 	public final void removeSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
422 		removeFacesListener(listener);
423 	}
424 
425 	public final javax.faces.event.FacesListener [] listSelectionListeners() {
426 		return getFacesListeners(org.rcfaces.core.event.ISelectionListener.class);
427 	}
428 
429 	public final void addUserEventListener(org.rcfaces.core.event.IUserEventListener listener) {
430 		addFacesListener(listener);
431 	}
432 
433 	public final void removeUserEventListener(org.rcfaces.core.event.IUserEventListener listener) {
434 		removeFacesListener(listener);
435 	}
436 
437 	public final javax.faces.event.FacesListener [] listUserEventListeners() {
438 		return getFacesListeners(org.rcfaces.core.event.IUserEventListener.class);
439 	}
440 
441 	/**
442 	 * Returns a string value specifying the title for the document.
443 	 * @return title
444 	 */
445 	public String getTitle() {
446 		return getTitle(null);
447 	}
448 
449 	/**
450 	 * Returns a string value specifying the title for the document.
451 	 * @return title
452 	 */
453 	public String getTitle(javax.faces.context.FacesContext facesContext) {
454 		return engine.getStringProperty(Properties.TITLE, facesContext);
455 	}
456 
457 	/**
458 	 * Sets a string value specifying the title for the document.
459 	 * @param title title
460 	 */
461 	public void setTitle(String title) {
462 		engine.setProperty(Properties.TITLE, title);
463 	}
464 
465 	/**
466 	 * Sets a string value specifying the title for the document.
467 	 * @param title title
468 	 */
469 	/**
470 	 * Returns <code>true</code> if the attribute "title" is set.
471 	 * @return <code>true</code> if the attribute is set.
472 	 */
473 	public boolean isTitleSetted() {
474 		return engine.isPropertySetted(Properties.TITLE);
475 	}
476 
477 	public String getDefaultValue() {
478 		return getDefaultValue(null);
479 	}
480 
481 	public String getDefaultValue(javax.faces.context.FacesContext facesContext) {
482 		return engine.getStringProperty(Properties.DEFAULT_VALUE, facesContext);
483 	}
484 
485 	public void setDefaultValue(String defaultValue) {
486 		engine.setProperty(Properties.DEFAULT_VALUE, defaultValue);
487 	}
488 
489 	/**
490 	 * Returns <code>true</code> if the attribute "defaultValue" is set.
491 	 * @return <code>true</code> if the attribute is set.
492 	 */
493 	public boolean isDefaultValueSetted() {
494 		return engine.isPropertySetted(Properties.DEFAULT_VALUE);
495 	}
496 
497 	protected Set getCameliaFields() {
498 		return CAMELIA_ATTRIBUTES;
499 	}
500 }