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.apache.commons.logging.LogFactory;
6   import org.rcfaces.core.component.capability.ICloseEventCapability;
7   import javax.faces.context.FacesContext;
8   import org.rcfaces.core.component.capability.IImmediateCapability;
9   import org.apache.commons.logging.Log;
10  import java.util.Set;
11  import org.rcfaces.core.component.capability.IDialogPriorityCapability;
12  import org.rcfaces.core.component.capability.IClosableCapability;
13  import org.rcfaces.core.component.capability.IImageCapability;
14  import org.rcfaces.core.component.familly.IContentAccessors;
15  import java.lang.String;
16  import org.rcfaces.core.component.capability.ILookAndFeelCapability;
17  import org.rcfaces.core.component.capability.IWAIRoleCapability;
18  import org.rcfaces.core.component.capability.IHiddenModeCapability;
19  import org.rcfaces.core.internal.component.CameliaOutputComponent;
20  import org.rcfaces.core.internal.tools.ImageAccessorTools;
21  import org.rcfaces.core.component.capability.ITextDirectionCapability;
22  import javax.el.ValueExpression;
23  import org.rcfaces.core.component.capability.ISizeCapability;
24  import java.util.HashSet;
25  import org.rcfaces.core.component.capability.IStyleClassCapability;
26  import java.util.Arrays;
27  import org.rcfaces.core.internal.converter.HiddenModeConverter;
28  import org.rcfaces.core.internal.capability.IImageAccessorsCapability;
29  import org.rcfaces.core.component.capability.ITextCapability;
30  
31  /**
32   * <p>The viewDialog component represents popup modal view. It is based on the standard HTML tag &lt;IFrame&gt;.  </p>
33   * 
34   * <p>The viewDialog Component has the following capabilities :
35   * <ul>
36   * <li>IImageCapability</li>
37   * <li>IStyleClassCapability</li>
38   * <li>ITextCapability</li>
39   * <li>ITextDirectionCapability</li>
40   * <li>IVisibilityCapability</li>
41   * <li>IDialogPriorityCapability</li>
42   * <li>ISizeCapability</li>
43   * <li>IHiddenModeCapability</li>
44   * <li>ILookAndFeelCapability</li>
45   * <li>IWAIRoleCapability</li>
46   * <li>ICloseEventCapability</li>
47   * <li>IClosableCapability</li>
48   * <li>IImmediateCapability</li>
49   * <li>IImageAccessorsCapability </li>
50   * </ul>
51   * </p>
52   * 
53   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/ViewDialogComponent.html">viewDialog</a> renderer is linked to the <a href="/jsdocs/index.html?f_viewDialog.html" target="_blank">f_viewDialog</a> javascript class. f_viewDialog extends f_dialog, fa_immediate </p>
54   * <p> Table of component style classes: </p>
55   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
56   * <tbody>
57   * 
58   * <tr style="text-align:left">
59   * <th  width="33%">Style Name</th>
60   * <th width="50%">Description</th>
61   * </tr>
62   * 
63   * <tr  style="text-align:left">
64   * <td width="33%">f_viewDialog</td>
65   * <td width="50%">Defines styles for the wrapper FRAME element</td>
66   * </tr>
67   * </tbody>
68   * </table>
69   */
70  public class ViewDialogComponent extends CameliaOutputComponent implements 
71  	IImageCapability,
72  	IStyleClassCapability,
73  	ITextCapability,
74  	ITextDirectionCapability,
75  	IVisibilityCapability,
76  	IDialogPriorityCapability,
77  	ISizeCapability,
78  	IHiddenModeCapability,
79  	ILookAndFeelCapability,
80  	IWAIRoleCapability,
81  	ICloseEventCapability,
82  	IClosableCapability,
83  	IImmediateCapability,
84  	IImageAccessorsCapability {
85  
86  	private static final Log LOG = LogFactory.getLog(ViewDialogComponent.class);
87  
88  	public static final String COMPONENT_TYPE="org.rcfaces.core.viewDialog";
89  
90  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaOutputComponent.CAMELIA_ATTRIBUTES);
91  	static {
92  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"closeListener","lookId","text","shellDecoratorName","visible","styleClass","width","ariaLabel","dialogPriority","textDirection","ariaLevel","immediate","height","closable","hiddenMode","viewURL","imageURL","waiRole"}));
93  	}
94  
95  	public ViewDialogComponent() {
96  		setRendererType(COMPONENT_TYPE);
97  	}
98  
99  	public ViewDialogComponent(String componentId) {
100 		this();
101 		setId(componentId);
102 	}
103 
104 	public IContentAccessors getImageAccessors(FacesContext facesContext) {
105 
106 
107 			return ImageAccessorTools.createImageAccessors(facesContext, this, engine);
108 		
109 	}
110 
111 	public void setHiddenMode(String hiddenMode) {
112 
113 
114 			setHiddenMode(((Integer)HiddenModeConverter.SINGLETON.getAsObject(null, this, hiddenMode)).intValue());
115 		
116 	}
117 
118 	public Boolean getVisibleState(FacesContext facesContext) {
119 
120 
121 			if (engine.isPropertySetted(Properties.VISIBLE)==false) {
122 				return null;
123 			}
124 			
125 			return Boolean.valueOf(isVisible(facesContext));
126 		
127 	}
128 
129 	public java.lang.String getImageURL() {
130 		return getImageURL(null);
131 	}
132 
133 	/**
134 	 * See {@link #getImageURL() getImageURL()} for more details
135 	 */
136 	public java.lang.String getImageURL(javax.faces.context.FacesContext facesContext) {
137 		return engine.getStringProperty(Properties.IMAGE_URL, facesContext);
138 	}
139 
140 	/**
141 	 * Returns <code>true</code> if the attribute "imageURL" is set.
142 	 * @return <code>true</code> if the attribute is set.
143 	 */
144 	public final boolean isImageURLSetted() {
145 		return engine.isPropertySetted(Properties.IMAGE_URL);
146 	}
147 
148 	public void setImageURL(java.lang.String imageURL) {
149 		engine.setProperty(Properties.IMAGE_URL, imageURL);
150 	}
151 
152 	public IContentAccessors getImageAccessors() {
153 
154 
155 			return getImageAccessors(null);
156 		
157 	}
158 
159 	public java.lang.String getStyleClass() {
160 		return getStyleClass(null);
161 	}
162 
163 	/**
164 	 * See {@link #getStyleClass() getStyleClass()} for more details
165 	 */
166 	public java.lang.String getStyleClass(javax.faces.context.FacesContext facesContext) {
167 		return engine.getStringProperty(Properties.STYLE_CLASS, facesContext);
168 	}
169 
170 	/**
171 	 * Returns <code>true</code> if the attribute "styleClass" is set.
172 	 * @return <code>true</code> if the attribute is set.
173 	 */
174 	public final boolean isStyleClassSetted() {
175 		return engine.isPropertySetted(Properties.STYLE_CLASS);
176 	}
177 
178 	public void setStyleClass(java.lang.String styleClass) {
179 		engine.setProperty(Properties.STYLE_CLASS, styleClass);
180 	}
181 
182 	public java.lang.String getText() {
183 		return getText(null);
184 	}
185 
186 	/**
187 	 * See {@link #getText() getText()} for more details
188 	 */
189 	public java.lang.String getText(javax.faces.context.FacesContext facesContext) {
190 		return engine.getStringProperty(Properties.TEXT, facesContext);
191 	}
192 
193 	/**
194 	 * Returns <code>true</code> if the attribute "text" is set.
195 	 * @return <code>true</code> if the attribute is set.
196 	 */
197 	public final boolean isTextSetted() {
198 		return engine.isPropertySetted(Properties.TEXT);
199 	}
200 
201 	public void setText(java.lang.String text) {
202 		engine.setProperty(Properties.TEXT, text);
203 	}
204 
205 	public int getTextDirection() {
206 		return getTextDirection(null);
207 	}
208 
209 	/**
210 	 * See {@link #getTextDirection() getTextDirection()} for more details
211 	 */
212 	public int getTextDirection(javax.faces.context.FacesContext facesContext) {
213 		return engine.getIntProperty(Properties.TEXT_DIRECTION,0, facesContext);
214 	}
215 
216 	/**
217 	 * Returns <code>true</code> if the attribute "textDirection" is set.
218 	 * @return <code>true</code> if the attribute is set.
219 	 */
220 	public final boolean isTextDirectionSetted() {
221 		return engine.isPropertySetted(Properties.TEXT_DIRECTION);
222 	}
223 
224 	public void setTextDirection(int textDirection) {
225 		engine.setProperty(Properties.TEXT_DIRECTION, textDirection);
226 	}
227 
228 	public boolean isVisible() {
229 		return isVisible(null);
230 	}
231 
232 	/**
233 	 * See {@link #isVisible() isVisible()} for more details
234 	 */
235 	public boolean isVisible(javax.faces.context.FacesContext facesContext) {
236 		return engine.getBoolProperty(Properties.VISIBLE, true, facesContext);
237 	}
238 
239 	/**
240 	 * Returns <code>true</code> if the attribute "visible" is set.
241 	 * @return <code>true</code> if the attribute is set.
242 	 */
243 	public final boolean isVisibleSetted() {
244 		return engine.isPropertySetted(Properties.VISIBLE);
245 	}
246 
247 	public void setVisible(boolean visible) {
248 		engine.setProperty(Properties.VISIBLE, visible);
249 	}
250 
251 	public Boolean getVisibleState() {
252 
253 
254 			return getVisibleState(null);
255 		
256 	}
257 
258 	public int getDialogPriority() {
259 		return getDialogPriority(null);
260 	}
261 
262 	/**
263 	 * See {@link #getDialogPriority() getDialogPriority()} for more details
264 	 */
265 	public int getDialogPriority(javax.faces.context.FacesContext facesContext) {
266 		return engine.getIntProperty(Properties.DIALOG_PRIORITY,0, facesContext);
267 	}
268 
269 	/**
270 	 * Returns <code>true</code> if the attribute "dialogPriority" is set.
271 	 * @return <code>true</code> if the attribute is set.
272 	 */
273 	public final boolean isDialogPrioritySetted() {
274 		return engine.isPropertySetted(Properties.DIALOG_PRIORITY);
275 	}
276 
277 	public void setDialogPriority(int dialogPriority) {
278 		engine.setProperty(Properties.DIALOG_PRIORITY, dialogPriority);
279 	}
280 
281 	public java.lang.String getWidth() {
282 		return getWidth(null);
283 	}
284 
285 	/**
286 	 * See {@link #getWidth() getWidth()} for more details
287 	 */
288 	public java.lang.String getWidth(javax.faces.context.FacesContext facesContext) {
289 		return engine.getStringProperty(Properties.WIDTH, facesContext);
290 	}
291 
292 	/**
293 	 * Returns <code>true</code> if the attribute "width" is set.
294 	 * @return <code>true</code> if the attribute is set.
295 	 */
296 	public final boolean isWidthSetted() {
297 		return engine.isPropertySetted(Properties.WIDTH);
298 	}
299 
300 	public void setWidth(java.lang.String width) {
301 		engine.setProperty(Properties.WIDTH, width);
302 	}
303 
304 	public java.lang.String getHeight() {
305 		return getHeight(null);
306 	}
307 
308 	/**
309 	 * See {@link #getHeight() getHeight()} for more details
310 	 */
311 	public java.lang.String getHeight(javax.faces.context.FacesContext facesContext) {
312 		return engine.getStringProperty(Properties.HEIGHT, facesContext);
313 	}
314 
315 	/**
316 	 * Returns <code>true</code> if the attribute "height" is set.
317 	 * @return <code>true</code> if the attribute is set.
318 	 */
319 	public final boolean isHeightSetted() {
320 		return engine.isPropertySetted(Properties.HEIGHT);
321 	}
322 
323 	public void setHeight(java.lang.String height) {
324 		engine.setProperty(Properties.HEIGHT, height);
325 	}
326 
327 	public int getHiddenMode() {
328 		return getHiddenMode(null);
329 	}
330 
331 	/**
332 	 * See {@link #getHiddenMode() getHiddenMode()} for more details
333 	 */
334 	public int getHiddenMode(javax.faces.context.FacesContext facesContext) {
335 		return engine.getIntProperty(Properties.HIDDEN_MODE,IHiddenModeCapability.DEFAULT_HIDDEN_MODE, facesContext);
336 	}
337 
338 	/**
339 	 * Returns <code>true</code> if the attribute "hiddenMode" is set.
340 	 * @return <code>true</code> if the attribute is set.
341 	 */
342 	public final boolean isHiddenModeSetted() {
343 		return engine.isPropertySetted(Properties.HIDDEN_MODE);
344 	}
345 
346 	public void setHiddenMode(int hiddenMode) {
347 		engine.setProperty(Properties.HIDDEN_MODE, hiddenMode);
348 	}
349 
350 	public java.lang.String getLookId() {
351 		return getLookId(null);
352 	}
353 
354 	/**
355 	 * See {@link #getLookId() getLookId()} for more details
356 	 */
357 	public java.lang.String getLookId(javax.faces.context.FacesContext facesContext) {
358 		return engine.getStringProperty(Properties.LOOK_ID, facesContext);
359 	}
360 
361 	/**
362 	 * Returns <code>true</code> if the attribute "lookId" is set.
363 	 * @return <code>true</code> if the attribute is set.
364 	 */
365 	public final boolean isLookIdSetted() {
366 		return engine.isPropertySetted(Properties.LOOK_ID);
367 	}
368 
369 	public void setLookId(java.lang.String lookId) {
370 		engine.setProperty(Properties.LOOK_ID, lookId);
371 	}
372 
373 	public java.lang.String getAriaLabel() {
374 		return getAriaLabel(null);
375 	}
376 
377 	/**
378 	 * See {@link #getAriaLabel() getAriaLabel()} for more details
379 	 */
380 	public java.lang.String getAriaLabel(javax.faces.context.FacesContext facesContext) {
381 		return engine.getStringProperty(Properties.ARIA_LABEL, facesContext);
382 	}
383 
384 	/**
385 	 * Returns <code>true</code> if the attribute "ariaLabel" is set.
386 	 * @return <code>true</code> if the attribute is set.
387 	 */
388 	public final boolean isAriaLabelSetted() {
389 		return engine.isPropertySetted(Properties.ARIA_LABEL);
390 	}
391 
392 	public void setAriaLabel(java.lang.String ariaLabel) {
393 		engine.setProperty(Properties.ARIA_LABEL, ariaLabel);
394 	}
395 
396 	public int getAriaLevel() {
397 		return getAriaLevel(null);
398 	}
399 
400 	/**
401 	 * See {@link #getAriaLevel() getAriaLevel()} for more details
402 	 */
403 	public int getAriaLevel(javax.faces.context.FacesContext facesContext) {
404 		return engine.getIntProperty(Properties.ARIA_LEVEL,0, facesContext);
405 	}
406 
407 	/**
408 	 * Returns <code>true</code> if the attribute "ariaLevel" is set.
409 	 * @return <code>true</code> if the attribute is set.
410 	 */
411 	public final boolean isAriaLevelSetted() {
412 		return engine.isPropertySetted(Properties.ARIA_LEVEL);
413 	}
414 
415 	public void setAriaLevel(int ariaLevel) {
416 		engine.setProperty(Properties.ARIA_LEVEL, ariaLevel);
417 	}
418 
419 	public java.lang.String getWaiRole() {
420 		return getWaiRole(null);
421 	}
422 
423 	/**
424 	 * See {@link #getWaiRole() getWaiRole()} for more details
425 	 */
426 	public java.lang.String getWaiRole(javax.faces.context.FacesContext facesContext) {
427 		return engine.getStringProperty(Properties.WAI_ROLE, facesContext);
428 	}
429 
430 	/**
431 	 * Returns <code>true</code> if the attribute "waiRole" is set.
432 	 * @return <code>true</code> if the attribute is set.
433 	 */
434 	public final boolean isWaiRoleSetted() {
435 		return engine.isPropertySetted(Properties.WAI_ROLE);
436 	}
437 
438 	public void setWaiRole(java.lang.String waiRole) {
439 		engine.setProperty(Properties.WAI_ROLE, waiRole);
440 	}
441 
442 	public final void addCloseListener(org.rcfaces.core.event.ICloseListener listener) {
443 		addFacesListener(listener);
444 	}
445 
446 	public final void removeCloseListener(org.rcfaces.core.event.ICloseListener listener) {
447 		removeFacesListener(listener);
448 	}
449 
450 	public final javax.faces.event.FacesListener [] listCloseListeners() {
451 		return getFacesListeners(org.rcfaces.core.event.ICloseListener.class);
452 	}
453 
454 	public boolean isClosable() {
455 		return isClosable(null);
456 	}
457 
458 	/**
459 	 * See {@link #isClosable() isClosable()} for more details
460 	 */
461 	public boolean isClosable(javax.faces.context.FacesContext facesContext) {
462 		return engine.getBoolProperty(Properties.CLOSABLE, false, facesContext);
463 	}
464 
465 	/**
466 	 * Returns <code>true</code> if the attribute "closable" is set.
467 	 * @return <code>true</code> if the attribute is set.
468 	 */
469 	public final boolean isClosableSetted() {
470 		return engine.isPropertySetted(Properties.CLOSABLE);
471 	}
472 
473 	public void setClosable(boolean closable) {
474 		engine.setProperty(Properties.CLOSABLE, closable);
475 	}
476 
477 	public boolean isImmediate() {
478 		return isImmediate(null);
479 	}
480 
481 	/**
482 	 * See {@link #isImmediate() isImmediate()} for more details
483 	 */
484 	public boolean isImmediate(javax.faces.context.FacesContext facesContext) {
485 		return engine.getBoolProperty(Properties.IMMEDIATE, false, facesContext);
486 	}
487 
488 	/**
489 	 * Returns <code>true</code> if the attribute "immediate" is set.
490 	 * @return <code>true</code> if the attribute is set.
491 	 */
492 	public final boolean isImmediateSetted() {
493 		return engine.isPropertySetted(Properties.IMMEDIATE);
494 	}
495 
496 	public void setImmediate(boolean immediate) {
497 		engine.setProperty(Properties.IMMEDIATE, immediate);
498 	}
499 
500 	public String getViewURL() {
501 		return getViewURL(null);
502 	}
503 
504 	public String getViewURL(javax.faces.context.FacesContext facesContext) {
505 		return engine.getStringProperty(Properties.VIEW_URL, facesContext);
506 	}
507 
508 	public void setViewURL(String viewURL) {
509 		engine.setProperty(Properties.VIEW_URL, viewURL);
510 	}
511 
512 	/**
513 	 * Returns <code>true</code> if the attribute "viewURL" is set.
514 	 * @return <code>true</code> if the attribute is set.
515 	 */
516 	public boolean isViewURLSetted() {
517 		return engine.isPropertySetted(Properties.VIEW_URL);
518 	}
519 
520 	public String getShellDecoratorName() {
521 		return getShellDecoratorName(null);
522 	}
523 
524 	public String getShellDecoratorName(javax.faces.context.FacesContext facesContext) {
525 		return engine.getStringProperty(Properties.SHELL_DECORATOR_NAME, facesContext);
526 	}
527 
528 	public void setShellDecoratorName(String shellDecoratorName) {
529 		engine.setProperty(Properties.SHELL_DECORATOR_NAME, shellDecoratorName);
530 	}
531 
532 	/**
533 	 * Returns <code>true</code> if the attribute "shellDecoratorName" is set.
534 	 * @return <code>true</code> if the attribute is set.
535 	 */
536 	public boolean isShellDecoratorNameSetted() {
537 		return engine.isPropertySetted(Properties.SHELL_DECORATOR_NAME);
538 	}
539 
540 	protected Set getCameliaFields() {
541 		return CAMELIA_ATTRIBUTES;
542 	}
543 }