1 package org.rcfaces.core.internal.taglib;
2
3 import javax.faces.application.Application;
4 import org.rcfaces.core.component.AdditionalInformationComponent;
5 import javax.faces.component.UIComponent;
6 import org.rcfaces.core.internal.component.Properties;
7 import javax.el.ValueExpression;
8 import javax.faces.component.UIViewRoot;
9 import org.apache.commons.logging.Log;
10 import javax.servlet.jsp.tagext.Tag;
11 import org.apache.commons.logging.LogFactory;
12 import org.rcfaces.core.internal.tools.ListenersTools1_2;
13 import org.rcfaces.core.internal.tools.ListenersTools;
14 import javax.faces.context.FacesContext;
15
16 public class AdditionalInformationTag extends CameliaTag implements Tag {
17
18
19 private static final Log LOG=LogFactory.getLog(AdditionalInformationTag.class);
20
21 private ValueExpression propertyChangeListeners;
22 private ValueExpression userEventListeners;
23 private ValueExpression errorListeners;
24 private ValueExpression ariaLabel;
25 private ValueExpression ariaLevel;
26 private ValueExpression waiRole;
27 private ValueExpression marginBottom;
28 private ValueExpression marginLeft;
29 private ValueExpression marginRight;
30 private ValueExpression marginTop;
31 private ValueExpression backgroundColor;
32 private ValueExpression foregroundColor;
33 private ValueExpression backgroundImageHorizontalPosition;
34 private ValueExpression backgroundImageHorizontalRepeat;
35 private ValueExpression backgroundImageURL;
36 private ValueExpression backgroundImageVerticalPosition;
37 private ValueExpression backgroundImageVerticalRepeat;
38 private ValueExpression lookId;
39 private ValueExpression styleClass;
40 private ValueExpression height;
41 private ValueExpression mouseOutListeners;
42 private ValueExpression mouseOverListeners;
43 private ValueExpression initListeners;
44 private ValueExpression loadListeners;
45 private ValueExpression scopeSaveValue;
46 private ValueExpression scopeValue;
47 private ValueExpression scopeVar;
48 private ValueExpression margins;
49 public String getComponentType() {
50 return AdditionalInformationComponent.COMPONENT_TYPE;
51 }
52
53 public final void setPropertyChangeListener(ValueExpression propertyChangeListeners) {
54 this.propertyChangeListeners = propertyChangeListeners;
55 }
56
57 public final void setUserEventListener(ValueExpression userEventListeners) {
58 this.userEventListeners = userEventListeners;
59 }
60
61 public final void setErrorListener(ValueExpression errorListeners) {
62 this.errorListeners = errorListeners;
63 }
64
65 public final void setAriaLabel(ValueExpression ariaLabel) {
66 this.ariaLabel = ariaLabel;
67 }
68
69 public final void setAriaLevel(ValueExpression ariaLevel) {
70 this.ariaLevel = ariaLevel;
71 }
72
73 public final void setWaiRole(ValueExpression waiRole) {
74 this.waiRole = waiRole;
75 }
76
77 public final void setMarginBottom(ValueExpression marginBottom) {
78 this.marginBottom = marginBottom;
79 }
80
81 public final void setMarginLeft(ValueExpression marginLeft) {
82 this.marginLeft = marginLeft;
83 }
84
85 public final void setMarginRight(ValueExpression marginRight) {
86 this.marginRight = marginRight;
87 }
88
89 public final void setMarginTop(ValueExpression marginTop) {
90 this.marginTop = marginTop;
91 }
92
93 public final void setBackgroundColor(ValueExpression backgroundColor) {
94 this.backgroundColor = backgroundColor;
95 }
96
97 public final void setForegroundColor(ValueExpression foregroundColor) {
98 this.foregroundColor = foregroundColor;
99 }
100
101 public final void setBackgroundImageHorizontalPosition(ValueExpression backgroundImageHorizontalPosition) {
102 this.backgroundImageHorizontalPosition = backgroundImageHorizontalPosition;
103 }
104
105 public final void setBackgroundImageHorizontalRepeat(ValueExpression backgroundImageHorizontalRepeat) {
106 this.backgroundImageHorizontalRepeat = backgroundImageHorizontalRepeat;
107 }
108
109 public final void setBackgroundImageURL(ValueExpression backgroundImageURL) {
110 this.backgroundImageURL = backgroundImageURL;
111 }
112
113 public final void setBackgroundImageVerticalPosition(ValueExpression backgroundImageVerticalPosition) {
114 this.backgroundImageVerticalPosition = backgroundImageVerticalPosition;
115 }
116
117 public final void setBackgroundImageVerticalRepeat(ValueExpression backgroundImageVerticalRepeat) {
118 this.backgroundImageVerticalRepeat = backgroundImageVerticalRepeat;
119 }
120
121 public final void setLookId(ValueExpression lookId) {
122 this.lookId = lookId;
123 }
124
125 public final void setStyleClass(ValueExpression styleClass) {
126 this.styleClass = styleClass;
127 }
128
129 public final void setHeight(ValueExpression height) {
130 this.height = height;
131 }
132
133 public final void setMouseOutListener(ValueExpression mouseOutListeners) {
134 this.mouseOutListeners = mouseOutListeners;
135 }
136
137 public final void setMouseOverListener(ValueExpression mouseOverListeners) {
138 this.mouseOverListeners = mouseOverListeners;
139 }
140
141 public final void setInitListener(ValueExpression initListeners) {
142 this.initListeners = initListeners;
143 }
144
145 public final void setLoadListener(ValueExpression loadListeners) {
146 this.loadListeners = loadListeners;
147 }
148
149 public final void setScopeSaveValue(ValueExpression scopeSaveValue) {
150 this.scopeSaveValue = scopeSaveValue;
151 }
152
153 public final void setScopeValue(ValueExpression scopeValue) {
154 this.scopeValue = scopeValue;
155 }
156
157 public final void setScopeVar(ValueExpression scopeVar) {
158 this.scopeVar = scopeVar;
159 }
160
161 public final void setMargins(ValueExpression margins) {
162 this.margins = margins;
163 }
164
165 protected void setProperties(UIComponent uiComponent) {
166 if (LOG.isDebugEnabled()) {
167 if (AdditionalInformationComponent.COMPONENT_TYPE==getComponentType()) {
168 LOG.debug("Component id='"+getId()+"' type='"+getComponentType()+"'.");
169 }
170 LOG.debug(" ariaLabel='"+ariaLabel+"'");
171 LOG.debug(" ariaLevel='"+ariaLevel+"'");
172 LOG.debug(" waiRole='"+waiRole+"'");
173 LOG.debug(" marginBottom='"+marginBottom+"'");
174 LOG.debug(" marginLeft='"+marginLeft+"'");
175 LOG.debug(" marginRight='"+marginRight+"'");
176 LOG.debug(" marginTop='"+marginTop+"'");
177 LOG.debug(" backgroundColor='"+backgroundColor+"'");
178 LOG.debug(" foregroundColor='"+foregroundColor+"'");
179 LOG.debug(" backgroundImageHorizontalPosition='"+backgroundImageHorizontalPosition+"'");
180 LOG.debug(" backgroundImageHorizontalRepeat='"+backgroundImageHorizontalRepeat+"'");
181 LOG.debug(" backgroundImageURL='"+backgroundImageURL+"'");
182 LOG.debug(" backgroundImageVerticalPosition='"+backgroundImageVerticalPosition+"'");
183 LOG.debug(" backgroundImageVerticalRepeat='"+backgroundImageVerticalRepeat+"'");
184 LOG.debug(" lookId='"+lookId+"'");
185 LOG.debug(" styleClass='"+styleClass+"'");
186 LOG.debug(" height='"+height+"'");
187 LOG.debug(" scopeSaveValue='"+scopeSaveValue+"'");
188 LOG.debug(" scopeValue='"+scopeValue+"'");
189 LOG.debug(" scopeVar='"+scopeVar+"'");
190 LOG.debug(" margins='"+margins+"'");
191 }
192 if ((uiComponent instanceof AdditionalInformationComponent)==false) {
193 if (uiComponent instanceof UIViewRoot) {
194 throw new IllegalStateException("The first component of the page must be a UIViewRoot component !");
195 }
196 throw new IllegalStateException("Component specified by tag is not instanceof of 'AdditionalInformationComponent'.");
197 }
198
199 super.setProperties(uiComponent);
200
201 AdditionalInformationComponent component = (AdditionalInformationComponent) uiComponent;
202 FacesContext facesContext = getFacesContext();
203
204 if (propertyChangeListeners != null) {
205 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.PROPERTY_CHANGE_LISTENER_TYPE, propertyChangeListeners);
206 }
207
208 if (userEventListeners != null) {
209 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.USER_EVENT_LISTENER_TYPE, userEventListeners);
210 }
211
212 if (errorListeners != null) {
213 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.ERROR_LISTENER_TYPE, errorListeners);
214 }
215
216 if (ariaLabel != null) {
217 if (ariaLabel.isLiteralText()==false) {
218 component.setValueExpression(Properties.ARIA_LABEL, ariaLabel);
219
220 } else {
221 component.setAriaLabel(ariaLabel.getExpressionString());
222 }
223 }
224
225 if (ariaLevel != null) {
226 if (ariaLevel.isLiteralText()==false) {
227 component.setValueExpression(Properties.ARIA_LEVEL, ariaLevel);
228
229 } else {
230 component.setAriaLevel(getInt(ariaLevel.getExpressionString()));
231 }
232 }
233
234 if (waiRole != null) {
235 if (waiRole.isLiteralText()==false) {
236 component.setValueExpression(Properties.WAI_ROLE, waiRole);
237
238 } else {
239 component.setWaiRole(waiRole.getExpressionString());
240 }
241 }
242
243 if (marginBottom != null) {
244 if (marginBottom.isLiteralText()==false) {
245 component.setValueExpression(Properties.MARGIN_BOTTOM, marginBottom);
246
247 } else {
248 component.setMarginBottom(marginBottom.getExpressionString());
249 }
250 }
251
252 if (marginLeft != null) {
253 if (marginLeft.isLiteralText()==false) {
254 component.setValueExpression(Properties.MARGIN_LEFT, marginLeft);
255
256 } else {
257 component.setMarginLeft(marginLeft.getExpressionString());
258 }
259 }
260
261 if (marginRight != null) {
262 if (marginRight.isLiteralText()==false) {
263 component.setValueExpression(Properties.MARGIN_RIGHT, marginRight);
264
265 } else {
266 component.setMarginRight(marginRight.getExpressionString());
267 }
268 }
269
270 if (marginTop != null) {
271 if (marginTop.isLiteralText()==false) {
272 component.setValueExpression(Properties.MARGIN_TOP, marginTop);
273
274 } else {
275 component.setMarginTop(marginTop.getExpressionString());
276 }
277 }
278
279 if (backgroundColor != null) {
280 if (backgroundColor.isLiteralText()==false) {
281 component.setValueExpression(Properties.BACKGROUND_COLOR, backgroundColor);
282
283 } else {
284 component.setBackgroundColor(backgroundColor.getExpressionString());
285 }
286 }
287
288 if (foregroundColor != null) {
289 if (foregroundColor.isLiteralText()==false) {
290 component.setValueExpression(Properties.FOREGROUND_COLOR, foregroundColor);
291
292 } else {
293 component.setForegroundColor(foregroundColor.getExpressionString());
294 }
295 }
296
297 if (backgroundImageHorizontalPosition != null) {
298 if (backgroundImageHorizontalPosition.isLiteralText()==false) {
299 component.setValueExpression(Properties.BACKGROUND_IMAGE_HORIZONTAL_POSITION, backgroundImageHorizontalPosition);
300
301 } else {
302 component.setBackgroundImageHorizontalPosition(backgroundImageHorizontalPosition.getExpressionString());
303 }
304 }
305
306 if (backgroundImageHorizontalRepeat != null) {
307 if (backgroundImageHorizontalRepeat.isLiteralText()==false) {
308 component.setValueExpression(Properties.BACKGROUND_IMAGE_HORIZONTAL_REPEAT, backgroundImageHorizontalRepeat);
309
310 } else {
311 component.setBackgroundImageHorizontalRepeat(getBool(backgroundImageHorizontalRepeat.getExpressionString()));
312 }
313 }
314
315 if (backgroundImageURL != null) {
316 if (backgroundImageURL.isLiteralText()==false) {
317 component.setValueExpression(Properties.BACKGROUND_IMAGE_URL, backgroundImageURL);
318
319 } else {
320 component.setBackgroundImageURL(backgroundImageURL.getExpressionString());
321 }
322 }
323
324 if (backgroundImageVerticalPosition != null) {
325 if (backgroundImageVerticalPosition.isLiteralText()==false) {
326 component.setValueExpression(Properties.BACKGROUND_IMAGE_VERTICAL_POSITION, backgroundImageVerticalPosition);
327
328 } else {
329 component.setBackgroundImageVerticalPosition(backgroundImageVerticalPosition.getExpressionString());
330 }
331 }
332
333 if (backgroundImageVerticalRepeat != null) {
334 if (backgroundImageVerticalRepeat.isLiteralText()==false) {
335 component.setValueExpression(Properties.BACKGROUND_IMAGE_VERTICAL_REPEAT, backgroundImageVerticalRepeat);
336
337 } else {
338 component.setBackgroundImageVerticalRepeat(getBool(backgroundImageVerticalRepeat.getExpressionString()));
339 }
340 }
341
342 if (lookId != null) {
343 if (lookId.isLiteralText()==false) {
344 component.setValueExpression(Properties.LOOK_ID, lookId);
345
346 } else {
347 component.setLookId(lookId.getExpressionString());
348 }
349 }
350
351 if (styleClass != null) {
352 if (styleClass.isLiteralText()==false) {
353 component.setValueExpression(Properties.STYLE_CLASS, styleClass);
354
355 } else {
356 component.setStyleClass(styleClass.getExpressionString());
357 }
358 }
359
360 if (height != null) {
361 if (height.isLiteralText()==false) {
362 component.setValueExpression(Properties.HEIGHT, height);
363
364 } else {
365 component.setHeight(height.getExpressionString());
366 }
367 }
368
369 if (mouseOutListeners != null) {
370 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.MOUSE_OUT_LISTENER_TYPE, mouseOutListeners);
371 }
372
373 if (mouseOverListeners != null) {
374 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.MOUSE_OVER_LISTENER_TYPE, mouseOverListeners);
375 }
376
377 if (initListeners != null) {
378 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.INIT_LISTENER_TYPE, initListeners);
379 }
380
381 if (loadListeners != null) {
382 ListenersTools1_2.parseListener(facesContext, component, ListenersTools.LOAD_LISTENER_TYPE, loadListeners);
383 }
384
385 if (scopeSaveValue != null) {
386 if (scopeSaveValue.isLiteralText()==false) {
387 component.setValueExpression(Properties.SCOPE_SAVE_VALUE, scopeSaveValue);
388
389 } else {
390 component.setScopeSaveValue(getBool(scopeSaveValue.getExpressionString()));
391 }
392 }
393
394 if (scopeValue != null) {
395 if (scopeValue.isLiteralText()==false) {
396 component.setValueExpression(Properties.SCOPE_VALUE, scopeValue);
397
398 } else {
399 component.setScopeValue(scopeValue.getExpressionString());
400 }
401 }
402
403 if (scopeVar != null) {
404 if (scopeVar.isLiteralText()==false) {
405 component.setValueExpression(Properties.SCOPE_VAR, scopeVar);
406
407 } else {
408 component.setScopeVar(scopeVar.getExpressionString());
409 }
410 }
411
412 if (margins != null) {
413 if (margins.isLiteralText()==false) {
414 throw new javax.faces.FacesException("Attribute 'margins' does not accept binding !");
415 }
416 component.setMargins(margins.getExpressionString());
417 }
418 }
419
420 public void release() {
421 propertyChangeListeners = null;
422 userEventListeners = null;
423 errorListeners = null;
424 ariaLabel = null;
425 ariaLevel = null;
426 waiRole = null;
427 marginBottom = null;
428 marginLeft = null;
429 marginRight = null;
430 marginTop = null;
431 backgroundColor = null;
432 foregroundColor = null;
433 backgroundImageHorizontalPosition = null;
434 backgroundImageHorizontalRepeat = null;
435 backgroundImageURL = null;
436 backgroundImageVerticalPosition = null;
437 backgroundImageVerticalRepeat = null;
438 lookId = null;
439 styleClass = null;
440 height = null;
441 mouseOutListeners = null;
442 mouseOverListeners = null;
443 initListeners = null;
444 loadListeners = null;
445 scopeSaveValue = null;
446 scopeValue = null;
447 scopeVar = null;
448 margins = null;
449
450 super.release();
451 }
452
453 }