View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.component.iterator.IMenuIterator;
4   import org.rcfaces.core.internal.component.Properties;
5   import org.rcfaces.core.component.capability.IOverStyleClassCapability;
6   import org.rcfaces.core.component.capability.ILayoutManagerCapability;
7   import org.rcfaces.core.internal.capability.IAsyncRenderComponent;
8   import org.apache.commons.logging.LogFactory;
9   import org.rcfaces.core.component.AbstractBasicComponent;
10  import org.rcfaces.core.component.capability.ILoadEventCapability;
11  import org.rcfaces.core.component.capability.IBorderCapability;
12  import org.rcfaces.core.component.IMenuComponent;
13  import org.rcfaces.core.component.capability.IAsyncRenderModeCapability;
14  import org.rcfaces.core.internal.converter.AsyncDecodeModeConverter;
15  import org.apache.commons.logging.Log;
16  import java.util.Set;
17  import org.rcfaces.core.component.capability.IInitEventCapability;
18  import org.rcfaces.core.component.capability.IAsyncDecodeModeCapability;
19  import org.rcfaces.core.component.capability.ITypedComponentCapability;
20  import org.rcfaces.core.component.capability.IBackgroundImageCapability;
21  import java.lang.String;
22  import org.rcfaces.core.internal.tools.MenuTools;
23  import org.rcfaces.core.internal.converter.AsyncRenderModeConverter;
24  import org.rcfaces.core.component.capability.IMouseEventCapability;
25  import javax.el.ValueExpression;
26  import java.util.HashSet;
27  import org.rcfaces.core.internal.converter.LayoutManagerTypeConverter;
28  import java.util.Arrays;
29  import org.rcfaces.core.internal.capability.IVariableScopeCapability;
30  import org.rcfaces.core.component.capability.IMenuCapability;
31  
32  /**
33   * <p>The Box Component is a container.</p>
34   * <p>It can have a graphical representation or not; But it is mainly used to apply a collective treatment to a set of component, for example show or hide a group of component.</p>
35   * <p>The Box Component has the following capabilities :
36   * <ul>
37   * <li>IBackgroundImageCapability</li>
38   * <li>IBorderCapability</li>
39   * <li>IMouseEventCapability</li>
40   * <li>IInitEventCapability</li>
41   * <li>ILoadEventCapability</li>
42   * <li>IMenuCapability</li>
43   * <li>IAsyncRenderModeCapability</li>
44   * <li>IAsyncDecodeModeCapability</li>
45   * <li>ITypedComponentCapability</li>
46   * <li>IOverStyleClassCapability</li>
47   * <li>IScrollableCapability</li>
48   * </ul>
49   * </p>
50   * 
51   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/BoxComponent.html">box</a> renderer is linked to the <a href="/jsdocs/index.html?f_box.html" target="_blank">f_box</a> javascript class. f_box extends f_component, fa_asyncRender, fa_subMenu</p>
52   * 
53   * <p>Table of component style classes : </p>
54   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
55   * <tbody>
56   * <tr style="text-align:left">
57   * <th  width="33%">Style Name</th>
58   * <th  width="50%">Description</th>
59   * </tr>
60   * <tr style="text-align:left">
61   * <td width="33%">f_box</td>
62   * <td width="50%">Defines styles for the wrapper element of the component</td>
63   * </tr>
64   * </tbody>
65   * </table>
66   */
67  public class BoxComponent extends AbstractBasicComponent implements 
68  	IBackgroundImageCapability,
69  	IBorderCapability,
70  	IMouseEventCapability,
71  	IInitEventCapability,
72  	ILoadEventCapability,
73  	ILayoutManagerCapability,
74  	IMenuCapability,
75  	IAsyncRenderModeCapability,
76  	IAsyncDecodeModeCapability,
77  	IVariableScopeCapability,
78  	ITypedComponentCapability,
79  	IOverStyleClassCapability,
80  	IAsyncRenderComponent {
81  
82  	private static final Log LOG = LogFactory.getLog(BoxComponent.class);
83  
84  	public static final String COMPONENT_TYPE="org.rcfaces.core.box";
85  
86  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractBasicComponent.CAMELIA_ATTRIBUTES);
87  	static {
88  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"backgroundImageVerticalRepeat","horizontalScroll","backgroundImageVerticalPosition","backgroundImageHorizontalRepeat","overStyleClass","type","asyncDecodeMode","backgroundImageHorizontalPosition","loadListener","asyncRenderMode","initListener","scopeSaveValue","scopeVar","mouseOverListener","verticalScroll","scopeValue","backgroundImageURL","border","mouseOutListener","layoutType"}));
89  	}
90  
91  	public BoxComponent() {
92  		setRendererType(COMPONENT_TYPE);
93  	}
94  
95  	public BoxComponent(String componentId) {
96  		this();
97  		setId(componentId);
98  	}
99  
100 	public void setAsyncRenderMode(String asyncRenderMode) {
101 
102 
103 			setAsyncRenderMode(((Integer)AsyncRenderModeConverter.SINGLETON.getAsObject(null, this, asyncRenderMode)).intValue());
104 		
105 	}
106 
107 	public void setAsyncDecodeMode(String asyncDecodeMode) {
108 
109 
110 			setAsyncDecodeMode(((Integer)AsyncDecodeModeConverter.SINGLETON.getAsObject(null, this, asyncDecodeMode)).intValue());
111 		
112 	}
113 
114 	public void setLayoutType(String type) {
115 
116 
117 			setLayoutType(((Integer)LayoutManagerTypeConverter.SINGLETON.getAsObject(null, this, type)).intValue());
118 		
119 	}
120 
121 	public java.lang.String getBackgroundImageHorizontalPosition() {
122 		return getBackgroundImageHorizontalPosition(null);
123 	}
124 
125 	/**
126 	 * See {@link #getBackgroundImageHorizontalPosition() getBackgroundImageHorizontalPosition()} for more details
127 	 */
128 	public java.lang.String getBackgroundImageHorizontalPosition(javax.faces.context.FacesContext facesContext) {
129 		return engine.getStringProperty(Properties.BACKGROUND_IMAGE_HORIZONTAL_POSITION, facesContext);
130 	}
131 
132 	/**
133 	 * Returns <code>true</code> if the attribute "backgroundImageHorizontalPosition" is set.
134 	 * @return <code>true</code> if the attribute is set.
135 	 */
136 	public final boolean isBackgroundImageHorizontalPositionSetted() {
137 		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_HORIZONTAL_POSITION);
138 	}
139 
140 	public void setBackgroundImageHorizontalPosition(java.lang.String backgroundImageHorizontalPosition) {
141 		engine.setProperty(Properties.BACKGROUND_IMAGE_HORIZONTAL_POSITION, backgroundImageHorizontalPosition);
142 	}
143 
144 	public boolean isBackgroundImageHorizontalRepeat() {
145 		return isBackgroundImageHorizontalRepeat(null);
146 	}
147 
148 	/**
149 	 * See {@link #isBackgroundImageHorizontalRepeat() isBackgroundImageHorizontalRepeat()} for more details
150 	 */
151 	public boolean isBackgroundImageHorizontalRepeat(javax.faces.context.FacesContext facesContext) {
152 		return engine.getBoolProperty(Properties.BACKGROUND_IMAGE_HORIZONTAL_REPEAT, false, facesContext);
153 	}
154 
155 	/**
156 	 * Returns <code>true</code> if the attribute "backgroundImageHorizontalRepeat" is set.
157 	 * @return <code>true</code> if the attribute is set.
158 	 */
159 	public final boolean isBackgroundImageHorizontalRepeatSetted() {
160 		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_HORIZONTAL_REPEAT);
161 	}
162 
163 	public void setBackgroundImageHorizontalRepeat(boolean backgroundImageHorizontalRepeat) {
164 		engine.setProperty(Properties.BACKGROUND_IMAGE_HORIZONTAL_REPEAT, backgroundImageHorizontalRepeat);
165 	}
166 
167 	public java.lang.String getBackgroundImageURL() {
168 		return getBackgroundImageURL(null);
169 	}
170 
171 	/**
172 	 * See {@link #getBackgroundImageURL() getBackgroundImageURL()} for more details
173 	 */
174 	public java.lang.String getBackgroundImageURL(javax.faces.context.FacesContext facesContext) {
175 		return engine.getStringProperty(Properties.BACKGROUND_IMAGE_URL, facesContext);
176 	}
177 
178 	/**
179 	 * Returns <code>true</code> if the attribute "backgroundImageURL" is set.
180 	 * @return <code>true</code> if the attribute is set.
181 	 */
182 	public final boolean isBackgroundImageURLSetted() {
183 		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_URL);
184 	}
185 
186 	public void setBackgroundImageURL(java.lang.String backgroundImageURL) {
187 		engine.setProperty(Properties.BACKGROUND_IMAGE_URL, backgroundImageURL);
188 	}
189 
190 	public java.lang.String getBackgroundImageVerticalPosition() {
191 		return getBackgroundImageVerticalPosition(null);
192 	}
193 
194 	/**
195 	 * See {@link #getBackgroundImageVerticalPosition() getBackgroundImageVerticalPosition()} for more details
196 	 */
197 	public java.lang.String getBackgroundImageVerticalPosition(javax.faces.context.FacesContext facesContext) {
198 		return engine.getStringProperty(Properties.BACKGROUND_IMAGE_VERTICAL_POSITION, facesContext);
199 	}
200 
201 	/**
202 	 * Returns <code>true</code> if the attribute "backgroundImageVerticalPosition" is set.
203 	 * @return <code>true</code> if the attribute is set.
204 	 */
205 	public final boolean isBackgroundImageVerticalPositionSetted() {
206 		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_VERTICAL_POSITION);
207 	}
208 
209 	public void setBackgroundImageVerticalPosition(java.lang.String backgroundImageVerticalPosition) {
210 		engine.setProperty(Properties.BACKGROUND_IMAGE_VERTICAL_POSITION, backgroundImageVerticalPosition);
211 	}
212 
213 	public boolean isBackgroundImageVerticalRepeat() {
214 		return isBackgroundImageVerticalRepeat(null);
215 	}
216 
217 	/**
218 	 * See {@link #isBackgroundImageVerticalRepeat() isBackgroundImageVerticalRepeat()} for more details
219 	 */
220 	public boolean isBackgroundImageVerticalRepeat(javax.faces.context.FacesContext facesContext) {
221 		return engine.getBoolProperty(Properties.BACKGROUND_IMAGE_VERTICAL_REPEAT, false, facesContext);
222 	}
223 
224 	/**
225 	 * Returns <code>true</code> if the attribute "backgroundImageVerticalRepeat" is set.
226 	 * @return <code>true</code> if the attribute is set.
227 	 */
228 	public final boolean isBackgroundImageVerticalRepeatSetted() {
229 		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_VERTICAL_REPEAT);
230 	}
231 
232 	public void setBackgroundImageVerticalRepeat(boolean backgroundImageVerticalRepeat) {
233 		engine.setProperty(Properties.BACKGROUND_IMAGE_VERTICAL_REPEAT, backgroundImageVerticalRepeat);
234 	}
235 
236 	public boolean isBorder() {
237 		return isBorder(null);
238 	}
239 
240 	/**
241 	 * See {@link #isBorder() isBorder()} for more details
242 	 */
243 	public boolean isBorder(javax.faces.context.FacesContext facesContext) {
244 		return engine.getBoolProperty(Properties.BORDER, true, facesContext);
245 	}
246 
247 	/**
248 	 * Returns <code>true</code> if the attribute "border" is set.
249 	 * @return <code>true</code> if the attribute is set.
250 	 */
251 	public final boolean isBorderSetted() {
252 		return engine.isPropertySetted(Properties.BORDER);
253 	}
254 
255 	public void setBorder(boolean border) {
256 		engine.setProperty(Properties.BORDER, border);
257 	}
258 
259 	public final void addMouseOutListener(org.rcfaces.core.event.IMouseOutListener listener) {
260 		addFacesListener(listener);
261 	}
262 
263 	public final void removeMouseOutListener(org.rcfaces.core.event.IMouseOutListener listener) {
264 		removeFacesListener(listener);
265 	}
266 
267 	public final javax.faces.event.FacesListener [] listMouseOutListeners() {
268 		return getFacesListeners(org.rcfaces.core.event.IMouseOutListener.class);
269 	}
270 
271 	public final void addMouseOverListener(org.rcfaces.core.event.IMouseOverListener listener) {
272 		addFacesListener(listener);
273 	}
274 
275 	public final void removeMouseOverListener(org.rcfaces.core.event.IMouseOverListener listener) {
276 		removeFacesListener(listener);
277 	}
278 
279 	public final javax.faces.event.FacesListener [] listMouseOverListeners() {
280 		return getFacesListeners(org.rcfaces.core.event.IMouseOverListener.class);
281 	}
282 
283 	public final void addInitListener(org.rcfaces.core.event.IInitListener listener) {
284 		addFacesListener(listener);
285 	}
286 
287 	public final void removeInitListener(org.rcfaces.core.event.IInitListener listener) {
288 		removeFacesListener(listener);
289 	}
290 
291 	public final javax.faces.event.FacesListener [] listInitListeners() {
292 		return getFacesListeners(org.rcfaces.core.event.IInitListener.class);
293 	}
294 
295 	public final void addLoadListener(org.rcfaces.core.event.ILoadListener listener) {
296 		addFacesListener(listener);
297 	}
298 
299 	public final void removeLoadListener(org.rcfaces.core.event.ILoadListener listener) {
300 		removeFacesListener(listener);
301 	}
302 
303 	public final javax.faces.event.FacesListener [] listLoadListeners() {
304 		return getFacesListeners(org.rcfaces.core.event.ILoadListener.class);
305 	}
306 
307 	public int getLayoutType() {
308 		return getLayoutType(null);
309 	}
310 
311 	/**
312 	 * See {@link #getLayoutType() getLayoutType()} for more details
313 	 */
314 	public int getLayoutType(javax.faces.context.FacesContext facesContext) {
315 		return engine.getIntProperty(Properties.LAYOUT_TYPE,0, facesContext);
316 	}
317 
318 	/**
319 	 * Returns <code>true</code> if the attribute "layoutType" is set.
320 	 * @return <code>true</code> if the attribute is set.
321 	 */
322 	public final boolean isLayoutTypeSetted() {
323 		return engine.isPropertySetted(Properties.LAYOUT_TYPE);
324 	}
325 
326 	public void setLayoutType(int layoutType) {
327 		engine.setProperty(Properties.LAYOUT_TYPE, layoutType);
328 	}
329 
330 	public IMenuComponent getMenu() {
331 
332 
333 		return MenuTools.getMenu(this);
334 		
335 	}
336 
337 	public IMenuComponent getMenu(String menuId) {
338 
339 
340 		return MenuTools.getMenu(this, menuId);
341 		
342 	}
343 
344 	public IMenuIterator listMenus() {
345 
346 
347 		return MenuTools.listMenus(this);
348 		
349 	}
350 
351 	public int getAsyncRenderMode() {
352 		return getAsyncRenderMode(null);
353 	}
354 
355 	/**
356 	 * See {@link #getAsyncRenderMode() getAsyncRenderMode()} for more details
357 	 */
358 	public int getAsyncRenderMode(javax.faces.context.FacesContext facesContext) {
359 		return engine.getIntProperty(Properties.ASYNC_RENDER_MODE,0, facesContext);
360 	}
361 
362 	/**
363 	 * Returns <code>true</code> if the attribute "asyncRenderMode" is set.
364 	 * @return <code>true</code> if the attribute is set.
365 	 */
366 	public final boolean isAsyncRenderModeSetted() {
367 		return engine.isPropertySetted(Properties.ASYNC_RENDER_MODE);
368 	}
369 
370 	public void setAsyncRenderMode(int asyncRenderMode) {
371 		engine.setProperty(Properties.ASYNC_RENDER_MODE, asyncRenderMode);
372 	}
373 
374 	public int getAsyncDecodeMode() {
375 		return getAsyncDecodeMode(null);
376 	}
377 
378 	/**
379 	 * See {@link #getAsyncDecodeMode() getAsyncDecodeMode()} for more details
380 	 */
381 	public int getAsyncDecodeMode(javax.faces.context.FacesContext facesContext) {
382 		return engine.getIntProperty(Properties.ASYNC_DECODE_MODE,0, facesContext);
383 	}
384 
385 	/**
386 	 * Returns <code>true</code> if the attribute "asyncDecodeMode" is set.
387 	 * @return <code>true</code> if the attribute is set.
388 	 */
389 	public final boolean isAsyncDecodeModeSetted() {
390 		return engine.isPropertySetted(Properties.ASYNC_DECODE_MODE);
391 	}
392 
393 	public void setAsyncDecodeMode(int asyncDecodeMode) {
394 		engine.setProperty(Properties.ASYNC_DECODE_MODE, asyncDecodeMode);
395 	}
396 
397 	public boolean isScopeSaveValue() {
398 		return isScopeSaveValue(null);
399 	}
400 
401 	/**
402 	 * See {@link #isScopeSaveValue() isScopeSaveValue()} for more details
403 	 */
404 	public boolean isScopeSaveValue(javax.faces.context.FacesContext facesContext) {
405 		return engine.getBoolProperty(Properties.SCOPE_SAVE_VALUE, false, facesContext);
406 	}
407 
408 	/**
409 	 * Returns <code>true</code> if the attribute "scopeSaveValue" is set.
410 	 * @return <code>true</code> if the attribute is set.
411 	 */
412 	public final boolean isScopeSaveValueSetted() {
413 		return engine.isPropertySetted(Properties.SCOPE_SAVE_VALUE);
414 	}
415 
416 	public void setScopeSaveValue(boolean scopeSaveValue) {
417 		engine.setProperty(Properties.SCOPE_SAVE_VALUE, scopeSaveValue);
418 	}
419 
420 	public java.lang.Object getScopeValue() {
421 		return getScopeValue(null);
422 	}
423 
424 	/**
425 	 * See {@link #getScopeValue() getScopeValue()} for more details
426 	 */
427 	public java.lang.Object getScopeValue(javax.faces.context.FacesContext facesContext) {
428 		return engine.getProperty(Properties.SCOPE_VALUE, facesContext);
429 	}
430 
431 	/**
432 	 * Returns <code>true</code> if the attribute "scopeValue" is set.
433 	 * @return <code>true</code> if the attribute is set.
434 	 */
435 	public final boolean isScopeValueSetted() {
436 		return engine.isPropertySetted(Properties.SCOPE_VALUE);
437 	}
438 
439 	public void setScopeValue(java.lang.Object scopeValue) {
440 		engine.setProperty(Properties.SCOPE_VALUE, scopeValue);
441 	}
442 
443 	public java.lang.String getScopeVar() {
444 		return getScopeVar(null);
445 	}
446 
447 	/**
448 	 * See {@link #getScopeVar() getScopeVar()} for more details
449 	 */
450 	public java.lang.String getScopeVar(javax.faces.context.FacesContext facesContext) {
451 		return engine.getStringProperty(Properties.SCOPE_VAR, facesContext);
452 	}
453 
454 	/**
455 	 * Returns <code>true</code> if the attribute "scopeVar" is set.
456 	 * @return <code>true</code> if the attribute is set.
457 	 */
458 	public final boolean isScopeVarSetted() {
459 		return engine.isPropertySetted(Properties.SCOPE_VAR);
460 	}
461 
462 	public void setScopeVar(java.lang.String scopeVar) {
463 		engine.setProperty(Properties.SCOPE_VAR, scopeVar);
464 	}
465 
466 	public java.lang.String getType() {
467 		return getType(null);
468 	}
469 
470 	/**
471 	 * See {@link #getType() getType()} for more details
472 	 */
473 	public java.lang.String getType(javax.faces.context.FacesContext facesContext) {
474 		return engine.getStringProperty(Properties.TYPE, facesContext);
475 	}
476 
477 	/**
478 	 * Returns <code>true</code> if the attribute "type" is set.
479 	 * @return <code>true</code> if the attribute is set.
480 	 */
481 	public final boolean isTypeSetted() {
482 		return engine.isPropertySetted(Properties.TYPE);
483 	}
484 
485 	public void setType(java.lang.String type) {
486 		engine.setProperty(Properties.TYPE, type);
487 	}
488 
489 	public java.lang.String getOverStyleClass() {
490 		return getOverStyleClass(null);
491 	}
492 
493 	/**
494 	 * See {@link #getOverStyleClass() getOverStyleClass()} for more details
495 	 */
496 	public java.lang.String getOverStyleClass(javax.faces.context.FacesContext facesContext) {
497 		return engine.getStringProperty(Properties.OVER_STYLE_CLASS, facesContext);
498 	}
499 
500 	/**
501 	 * Returns <code>true</code> if the attribute "overStyleClass" is set.
502 	 * @return <code>true</code> if the attribute is set.
503 	 */
504 	public final boolean isOverStyleClassSetted() {
505 		return engine.isPropertySetted(Properties.OVER_STYLE_CLASS);
506 	}
507 
508 	public void setOverStyleClass(java.lang.String overStyleClass) {
509 		engine.setProperty(Properties.OVER_STYLE_CLASS, overStyleClass);
510 	}
511 
512 	/**
513 	 * Returns a boolean value indicating wether the horizontal scroll is shown.
514 	 * @return true if the horizontal scrollbar is shown
515 	 */
516 	public boolean isHorizontalScroll() {
517 		return isHorizontalScroll(null);
518 	}
519 
520 	/**
521 	 * Returns a boolean value indicating wether the horizontal scroll is shown.
522 	 * @return true if the horizontal scrollbar is shown
523 	 */
524 	public boolean isHorizontalScroll(javax.faces.context.FacesContext facesContext) {
525 		return engine.getBoolProperty(Properties.HORIZONTAL_SCROLL, false, facesContext);
526 	}
527 
528 	/**
529 	 * Sets a boolean value indicating wether the horizontal scroll is shown.
530 	 * @param horizontalScroll true if the horizontal scrollbar is to be shown
531 	 */
532 	public void setHorizontalScroll(boolean horizontalScroll) {
533 		engine.setProperty(Properties.HORIZONTAL_SCROLL, horizontalScroll);
534 	}
535 
536 	/**
537 	 * Sets a boolean value indicating wether the horizontal scroll is shown.
538 	 * @param horizontalScroll true if the horizontal scrollbar is to be shown
539 	 */
540 	/**
541 	 * Returns <code>true</code> if the attribute "horizontalScroll" is set.
542 	 * @return <code>true</code> if the attribute is set.
543 	 */
544 	public boolean isHorizontalScrollSetted() {
545 		return engine.isPropertySetted(Properties.HORIZONTAL_SCROLL);
546 	}
547 
548 	/**
549 	 * Returns a boolean value indicating wether the vertical scroll is shown.
550 	 * @return true if vertical scrollbar is shown
551 	 */
552 	public boolean isVerticalScroll() {
553 		return isVerticalScroll(null);
554 	}
555 
556 	/**
557 	 * Returns a boolean value indicating wether the vertical scroll is shown.
558 	 * @return true if vertical scrollbar is shown
559 	 */
560 	public boolean isVerticalScroll(javax.faces.context.FacesContext facesContext) {
561 		return engine.getBoolProperty(Properties.VERTICAL_SCROLL, false, facesContext);
562 	}
563 
564 	/**
565 	 * Sets a boolean value indicating wether the vertical scroll is shown.
566 	 * @param verticalScroll true if vertical scrollbar is to be shown
567 	 */
568 	public void setVerticalScroll(boolean verticalScroll) {
569 		engine.setProperty(Properties.VERTICAL_SCROLL, verticalScroll);
570 	}
571 
572 	/**
573 	 * Sets a boolean value indicating wether the vertical scroll is shown.
574 	 * @param verticalScroll true if vertical scrollbar is to be shown
575 	 */
576 	/**
577 	 * Returns <code>true</code> if the attribute "verticalScroll" is set.
578 	 * @return <code>true</code> if the attribute is set.
579 	 */
580 	public boolean isVerticalScrollSetted() {
581 		return engine.isPropertySetted(Properties.VERTICAL_SCROLL);
582 	}
583 
584 	protected Set getCameliaFields() {
585 		return CAMELIA_ATTRIBUTES;
586 	}
587 }