1 package org.rcfaces.core.internal.taglib;
2
3 import javax.faces.application.Application;
4 import javax.faces.component.UIComponent;
5 import org.rcfaces.core.internal.component.Properties;
6 import javax.el.ValueExpression;
7 import javax.faces.component.UIViewRoot;
8 import org.apache.commons.logging.Log;
9 import javax.servlet.jsp.tagext.Tag;
10 import org.apache.commons.logging.LogFactory;
11 import org.rcfaces.core.internal.tools.ListenersTools1_2;
12 import org.rcfaces.core.component.ComponentsColumnComponent;
13 import org.rcfaces.core.internal.tools.ListenersTools;
14 import javax.faces.context.FacesContext;
15
16 public class ComponentsColumnTag extends CameliaTag implements Tag {
17
18
19 private static final Log LOG=LogFactory.getLog(ComponentsColumnTag.class);
20
21 private ValueExpression visible;
22 private ValueExpression hiddenMode;
23 private ValueExpression text;
24 private ValueExpression textDirection;
25 private ValueExpression toolTipText;
26 private ValueExpression alignment;
27 private ValueExpression backgroundColor;
28 private ValueExpression foregroundColor;
29 private ValueExpression sortListeners;
30 private ValueExpression styleClass;
31 private ValueExpression ascending;
32 private ValueExpression sortComparator;
33 private ValueExpression resizable;
34 private ValueExpression disabledImageURL;
35 private ValueExpression hoverImageURL;
36 private ValueExpression selectedImageURL;
37 private ValueExpression imageURL;
38 private ValueExpression imageHeight;
39 private ValueExpression imageWidth;
40 private ValueExpression menuPopupId;
41 private ValueExpression maxWidth;
42 private ValueExpression minWidth;
43 private ValueExpression width;
44 private ValueExpression verticalAlignment;
45 private ValueExpression cellStyleClass;
46 private ValueExpression defaultCellStyleClass;
47 private ValueExpression cellDefaultToolTipText;
48 private ValueExpression cellToolTipText;
49 private ValueExpression selectionListeners;
50 private ValueExpression doubleClickListeners;
51 private ValueExpression userEventListeners;
52 private ValueExpression initListeners;
53 public String getComponentType() {
54 return ComponentsColumnComponent.COMPONENT_TYPE;
55 }
56
57 public final void setVisible(ValueExpression visible) {
58 this.visible = visible;
59 }
60
61 public final void setHiddenMode(ValueExpression hiddenMode) {
62 this.hiddenMode = hiddenMode;
63 }
64
65 public final void setText(ValueExpression text) {
66 this.text = text;
67 }
68
69 public final void setTextDirection(ValueExpression textDirection) {
70 this.textDirection = textDirection;
71 }
72
73 public final void setToolTipText(ValueExpression toolTipText) {
74 this.toolTipText = toolTipText;
75 }
76
77 public final void setAlignment(ValueExpression alignment) {
78 this.alignment = alignment;
79 }
80
81 public final void setBackgroundColor(ValueExpression backgroundColor) {
82 this.backgroundColor = backgroundColor;
83 }
84
85 public final void setForegroundColor(ValueExpression foregroundColor) {
86 this.foregroundColor = foregroundColor;
87 }
88
89 public final void setSortListener(ValueExpression sortListeners) {
90 this.sortListeners = sortListeners;
91 }
92
93 public final void setStyleClass(ValueExpression styleClass) {
94 this.styleClass = styleClass;
95 }
96
97 public final void setAscending(ValueExpression ascending) {
98 this.ascending = ascending;
99 }
100
101 public final void setSortComparator(ValueExpression sortComparator) {
102 this.sortComparator = sortComparator;
103 }
104
105 public final void setResizable(ValueExpression resizable) {
106 this.resizable = resizable;
107 }
108
109 public final void setDisabledImageURL(ValueExpression disabledImageURL) {
110 this.disabledImageURL = disabledImageURL;
111 }
112
113 public final void setHoverImageURL(ValueExpression hoverImageURL) {
114 this.hoverImageURL = hoverImageURL;
115 }
116
117 public final void setSelectedImageURL(ValueExpression selectedImageURL) {
118 this.selectedImageURL = selectedImageURL;
119 }
120
121 public final void setImageURL(ValueExpression imageURL) {
122 this.imageURL = imageURL;
123 }
124
125 public final void setImageHeight(ValueExpression imageHeight) {
126 this.imageHeight = imageHeight;
127 }
128
129 public final void setImageWidth(ValueExpression imageWidth) {
130 this.imageWidth = imageWidth;
131 }
132
133 public final void setMenuPopupId(ValueExpression menuPopupId) {
134 this.menuPopupId = menuPopupId;
135 }
136
137 public final void setMaxWidth(ValueExpression maxWidth) {
138 this.maxWidth = maxWidth;
139 }
140
141 public final void setMinWidth(ValueExpression minWidth) {
142 this.minWidth = minWidth;
143 }
144
145 public final void setWidth(ValueExpression width) {
146 this.width = width;
147 }
148
149 public final void setVerticalAlignment(ValueExpression verticalAlignment) {
150 this.verticalAlignment = verticalAlignment;
151 }
152
153 public final void setCellStyleClass(ValueExpression cellStyleClass) {
154 this.cellStyleClass = cellStyleClass;
155 }
156
157 public final void setDefaultCellStyleClass(ValueExpression defaultCellStyleClass) {
158 this.defaultCellStyleClass = defaultCellStyleClass;
159 }
160
161 public final void setCellDefaultToolTipText(ValueExpression cellDefaultToolTipText) {
162 this.cellDefaultToolTipText = cellDefaultToolTipText;
163 }
164
165 public final void setCellToolTipText(ValueExpression cellToolTipText) {
166 this.cellToolTipText = cellToolTipText;
167 }
168
169 public final void setSelectionListener(ValueExpression selectionListeners) {
170 this.selectionListeners = selectionListeners;
171 }
172
173 public final void setDoubleClickListener(ValueExpression doubleClickListeners) {
174 this.doubleClickListeners = doubleClickListeners;
175 }
176
177 public final void setUserEventListener(ValueExpression userEventListeners) {
178 this.userEventListeners = userEventListeners;
179 }
180
181 public final void setInitListener(ValueExpression initListeners) {
182 this.initListeners = initListeners;
183 }
184
185 protected void setProperties(UIComponent uiComponent) {
186 if (LOG.isDebugEnabled()) {
187 if (ComponentsColumnComponent.COMPONENT_TYPE==getComponentType()) {
188 LOG.debug("Component id='"+getId()+"' type='"+getComponentType()+"'.");
189 }
190 LOG.debug(" visible='"+visible+"'");
191 LOG.debug(" hiddenMode='"+hiddenMode+"'");
192 LOG.debug(" text='"+text+"'");
193 LOG.debug(" textDirection='"+textDirection+"'");
194 LOG.debug(" toolTipText='"+toolTipText+"'");
195 LOG.debug(" alignment='"+alignment+"'");
196 LOG.debug(" backgroundColor='"+backgroundColor+"'");
197 LOG.debug(" foregroundColor='"+foregroundColor+"'");
198 LOG.debug(" styleClass='"+styleClass+"'");
199 LOG.debug(" ascending='"+ascending+"'");
200 LOG.debug(" sortComparator='"+sortComparator+"'");
201 LOG.debug(" resizable='"+resizable+"'");
202 LOG.debug(" disabledImageURL='"+disabledImageURL+"'");
203 LOG.debug(" hoverImageURL='"+hoverImageURL+"'");
204 LOG.debug(" selectedImageURL='"+selectedImageURL+"'");
205 LOG.debug(" imageURL='"+imageURL+"'");
206 LOG.debug(" imageHeight='"+imageHeight+"'");
207 LOG.debug(" imageWidth='"+imageWidth+"'");
208 LOG.debug(" menuPopupId='"+menuPopupId+"'");
209 LOG.debug(" maxWidth='"+maxWidth+"'");
210 LOG.debug(" minWidth='"+minWidth+"'");
211 LOG.debug(" width='"+width+"'");
212 LOG.debug(" verticalAlignment='"+verticalAlignment+"'");
213 LOG.debug(" cellStyleClass='"+cellStyleClass+"'");
214 LOG.debug(" defaultCellStyleClass='"+defaultCellStyleClass+"'");
215 LOG.debug(" cellDefaultToolTipText='"+cellDefaultToolTipText+"'");
216 LOG.debug(" cellToolTipText='"+cellToolTipText+"'");
217 }
218 if ((uiComponent instanceof ComponentsColumnComponent)==false) {
219 if (uiComponent instanceof UIViewRoot) {
220 throw new IllegalStateException("The first component of the page must be a UIViewRoot component !");
221 }
222 throw new IllegalStateException("Component specified by tag is not instanceof of 'ComponentsColumnComponent'.");
223 }
224
225 super.setProperties(uiComponent);
226
227 ComponentsColumnComponent component = (ComponentsColumnComponent) uiComponent;
228 FacesContext facesContext = getFacesContext();
229
230 if (visible != null) {
231 if (visible.isLiteralText()==false) {
232 component.setValueExpression(Properties.VISIBLE, visible);
233
234 } else {
235 component.setVisible(getBool(visible.getExpressionString()));
236 }
237 }
238
239 if (hiddenMode != null) {
240 if (hiddenMode.isLiteralText()==false) {
241 component.setValueExpression(Properties.HIDDEN_MODE, hiddenMode);
242
243 } else {
244 component.setHiddenMode(hiddenMode.getExpressionString());
245 }
246 }
247
248 if (text != null) {
249 if (text.isLiteralText()==false) {
250 component.setValueExpression(Properties.TEXT, text);
251
252 } else {
253 component.setText(text.getExpressionString());
254 }
255 }
256
257 if (textDirection != null) {
258 if (textDirection.isLiteralText()==false) {
259 component.setValueExpression(Properties.TEXT_DIRECTION, textDirection);
260
261 } else {
262 component.setTextDirection(getInt(textDirection.getExpressionString()));
263 }
264 }
265
266 if (toolTipText != null) {
267 if (toolTipText.isLiteralText()==false) {
268 component.setValueExpression(Properties.TOOL_TIP_TEXT, toolTipText);
269
270 } else {
271 component.setToolTipText(toolTipText.getExpressionString());
272 }
273 }
274
275 if (alignment != null) {
276 if (alignment.isLiteralText()==false) {
277 component.setValueExpression(Properties.ALIGNMENT, alignment);
278
279 } else {
280 component.setAlignment(alignment.getExpressionString());
281 }
282 }
283
284 if (backgroundColor != null) {
285 if (backgroundColor.isLiteralText()==false) {
286 component.setValueExpression(Properties.BACKGROUND_COLOR, backgroundColor);
287
288 } else {
289 component.setBackgroundColor(backgroundColor.getExpressionString());
290 }
291 }
292
293 if (foregroundColor != null) {
294 if (foregroundColor.isLiteralText()==false) {
295 component.setValueExpression(Properties.FOREGROUND_COLOR, foregroundColor);
296
297 } else {
298 component.setForegroundColor(foregroundColor.getExpressionString());
299 }
300 }
301
302 if (sortListeners != null) {
303 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.SORT_LISTENER_TYPE, sortListeners);
304 }
305
306 if (styleClass != null) {
307 if (styleClass.isLiteralText()==false) {
308 component.setValueExpression(Properties.STYLE_CLASS, styleClass);
309
310 } else {
311 component.setStyleClass(styleClass.getExpressionString());
312 }
313 }
314
315 if (ascending != null) {
316 if (ascending.isLiteralText()==false) {
317 component.setValueExpression(Properties.ASCENDING, ascending);
318
319 } else {
320 component.setAscending(getBool(ascending.getExpressionString()));
321 }
322 }
323
324 if (sortComparator != null) {
325 component.setValueExpression(Properties.SORT_COMPARATOR, sortComparator);
326 }
327
328 if (resizable != null) {
329 if (resizable.isLiteralText()==false) {
330 component.setValueExpression(Properties.RESIZABLE, resizable);
331
332 } else {
333 component.setResizable(getBool(resizable.getExpressionString()));
334 }
335 }
336
337 if (disabledImageURL != null) {
338 if (disabledImageURL.isLiteralText()==false) {
339 component.setValueExpression(Properties.DISABLED_IMAGE_URL, disabledImageURL);
340
341 } else {
342 component.setDisabledImageURL(disabledImageURL.getExpressionString());
343 }
344 }
345
346 if (hoverImageURL != null) {
347 if (hoverImageURL.isLiteralText()==false) {
348 component.setValueExpression(Properties.HOVER_IMAGE_URL, hoverImageURL);
349
350 } else {
351 component.setHoverImageURL(hoverImageURL.getExpressionString());
352 }
353 }
354
355 if (selectedImageURL != null) {
356 if (selectedImageURL.isLiteralText()==false) {
357 component.setValueExpression(Properties.SELECTED_IMAGE_URL, selectedImageURL);
358
359 } else {
360 component.setSelectedImageURL(selectedImageURL.getExpressionString());
361 }
362 }
363
364 if (imageURL != null) {
365 if (imageURL.isLiteralText()==false) {
366 component.setValueExpression(Properties.IMAGE_URL, imageURL);
367
368 } else {
369 component.setImageURL(imageURL.getExpressionString());
370 }
371 }
372
373 if (imageHeight != null) {
374 if (imageHeight.isLiteralText()==false) {
375 component.setValueExpression(Properties.IMAGE_HEIGHT, imageHeight);
376
377 } else {
378 component.setImageHeight(getInt(imageHeight.getExpressionString()));
379 }
380 }
381
382 if (imageWidth != null) {
383 if (imageWidth.isLiteralText()==false) {
384 component.setValueExpression(Properties.IMAGE_WIDTH, imageWidth);
385
386 } else {
387 component.setImageWidth(getInt(imageWidth.getExpressionString()));
388 }
389 }
390
391 if (menuPopupId != null) {
392 if (menuPopupId.isLiteralText()==false) {
393 component.setValueExpression(Properties.MENU_POPUP_ID, menuPopupId);
394
395 } else {
396 component.setMenuPopupId(menuPopupId.getExpressionString());
397 }
398 }
399
400 if (maxWidth != null) {
401 if (maxWidth.isLiteralText()==false) {
402 component.setValueExpression(Properties.MAX_WIDTH, maxWidth);
403
404 } else {
405 component.setMaxWidth(getInt(maxWidth.getExpressionString()));
406 }
407 }
408
409 if (minWidth != null) {
410 if (minWidth.isLiteralText()==false) {
411 component.setValueExpression(Properties.MIN_WIDTH, minWidth);
412
413 } else {
414 component.setMinWidth(getInt(minWidth.getExpressionString()));
415 }
416 }
417
418 if (width != null) {
419 if (width.isLiteralText()==false) {
420 component.setValueExpression(Properties.WIDTH, width);
421
422 } else {
423 component.setWidth(width.getExpressionString());
424 }
425 }
426
427 if (verticalAlignment != null) {
428 if (verticalAlignment.isLiteralText()==false) {
429 component.setValueExpression(Properties.VERTICAL_ALIGNMENT, verticalAlignment);
430
431 } else {
432 component.setVerticalAlignment(verticalAlignment.getExpressionString());
433 }
434 }
435
436 if (cellStyleClass != null) {
437 if (cellStyleClass.isLiteralText()==false) {
438 component.setValueExpression(Properties.CELL_STYLE_CLASS, cellStyleClass);
439
440 } else {
441 component.setCellStyleClass(cellStyleClass.getExpressionString());
442 }
443 }
444
445 if (defaultCellStyleClass != null) {
446 if (defaultCellStyleClass.isLiteralText()==false) {
447 component.setValueExpression(Properties.DEFAULT_CELL_STYLE_CLASS, defaultCellStyleClass);
448
449 } else {
450 component.setDefaultCellStyleClass(defaultCellStyleClass.getExpressionString());
451 }
452 }
453
454 if (cellDefaultToolTipText != null) {
455 if (cellDefaultToolTipText.isLiteralText()==false) {
456 component.setValueExpression(Properties.CELL_DEFAULT_TOOL_TIP_TEXT, cellDefaultToolTipText);
457
458 } else {
459 component.setCellDefaultToolTipText(cellDefaultToolTipText.getExpressionString());
460 }
461 }
462
463 if (cellToolTipText != null) {
464 if (cellToolTipText.isLiteralText()==false) {
465 component.setValueExpression(Properties.CELL_TOOL_TIP_TEXT, cellToolTipText);
466
467 } else {
468 component.setCellToolTipText(cellToolTipText.getExpressionString());
469 }
470 }
471
472 if (selectionListeners != null) {
473 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.SELECTION_LISTENER_TYPE, selectionListeners);
474 }
475
476 if (doubleClickListeners != null) {
477 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.DOUBLE_CLICK_LISTENER_TYPE, doubleClickListeners);
478 }
479
480 if (userEventListeners != null) {
481 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.USER_EVENT_LISTENER_TYPE, userEventListeners);
482 }
483
484 if (initListeners != null) {
485 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.INIT_LISTENER_TYPE, initListeners);
486 }
487 }
488
489 public void release() {
490 visible = null;
491 hiddenMode = null;
492 text = null;
493 textDirection = null;
494 toolTipText = null;
495 alignment = null;
496 backgroundColor = null;
497 foregroundColor = null;
498 sortListeners = null;
499 styleClass = null;
500 ascending = null;
501 sortComparator = null;
502 resizable = null;
503 disabledImageURL = null;
504 hoverImageURL = null;
505 selectedImageURL = null;
506 imageURL = null;
507 imageHeight = null;
508 imageWidth = null;
509 menuPopupId = null;
510 maxWidth = null;
511 minWidth = null;
512 width = null;
513 verticalAlignment = null;
514 cellStyleClass = null;
515 defaultCellStyleClass = null;
516 cellDefaultToolTipText = null;
517 cellToolTipText = null;
518 selectionListeners = null;
519 doubleClickListeners = null;
520 userEventListeners = null;
521 initListeners = null;
522
523 super.release();
524 }
525
526 }