1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.component;
21
22 import javax.faces.context.FacesContext;
23 import org.apache.myfaces.tobago.context.Markup;
24 import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
25 import org.apache.myfaces.tobago.layout.Display;
26 import org.apache.myfaces.tobago.layout.Measure;
27 import org.apache.commons.lang.ArrayUtils;
28 import org.apache.commons.lang.StringUtils;
29 import org.apache.myfaces.tobago.internal.util.Deprecation;
30 import org.apache.myfaces.tobago.renderkit.MarginValues;
31 import org.apache.myfaces.tobago.renderkit.SpacingValues;
32 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
33 import javax.el.ELException;
34 import javax.faces.FacesException;
35 import java.util.ArrayList;
36 import java.util.List;
37 import javax.el.MethodExpression;
38 import javax.el.ValueExpression;
39
40
41
42
43
44
45 public class UIOut
46 extends AbstractUIOut implements SupportsMarkup {
47
48 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Out";
49
50 public static final String COMPONENT_FAMILY = "javax.faces.Output";
51
52 private org.apache.myfaces.tobago.context.Markup currentMarkup;
53
54 enum PropertyKeys {
55 markup,
56 marginLeft,
57 minimumHeight,
58 escape,
59 tip,
60 height,
61 minimumWidth,
62 inline,
63 rowSpan,
64 left,
65 columnSpan,
66 maximumHeight,
67 top,
68 currentWidth,
69 marginTop,
70 marginRight,
71 width,
72 preferredHeight,
73 currentHeight,
74 display,
75 maximumWidth,
76 preferredWidth,
77 marginBottom,
78 createSpan,
79 verticalIndex,
80 horizontalIndex,
81 }
82
83 public String getFamily() {
84 return COMPONENT_FAMILY;
85 }
86
87
88 public org.apache.myfaces.tobago.context.Markup getMarkup() {
89 Object object = getStateHelper().eval(PropertyKeys.markup);
90 if (object != null) {
91 return Markup.valueOf(object);
92 }
93 return null;
94 }
95
96 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
97 getStateHelper().put(PropertyKeys.markup, markup);
98 }
99
100 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
101 Object object = getStateHelper().eval(PropertyKeys.marginLeft);
102 if (object != null) {
103 return Measure.valueOf(object);
104 }
105 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
106 }
107
108 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
109 getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
110 }
111
112 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
113 Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
114 if (object != null) {
115 return Measure.valueOf(object);
116 }
117 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
118 }
119
120 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
121 getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
122 }
123
124
125
126
127
128
129 public boolean isEscape() {
130 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.escape);
131 if (bool != null) {
132 return bool;
133 }
134 return true;
135 }
136
137 public void setEscape(boolean escape) {
138 getStateHelper().put(PropertyKeys.escape, escape);
139 }
140
141
142
143
144
145 public java.lang.String getTip() {
146 return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
147 }
148
149 public void setTip(java.lang.String tip) {
150 getStateHelper().put(PropertyKeys.tip, tip);
151 }
152
153
154
155
156
157 public org.apache.myfaces.tobago.layout.Measure getHeight() {
158 Object object = getStateHelper().eval(PropertyKeys.height);
159 if (object != null) {
160 return Measure.valueOf(object);
161 }
162 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
163 }
164
165 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
166 getStateHelper().put(PropertyKeys.height, height);
167 }
168
169 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
170 Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
171 if (object != null) {
172 return Measure.valueOf(object);
173 }
174 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
175 }
176
177 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
178 getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
179 }
180
181
182
183
184
185 @Deprecated
186 public boolean isInline() {
187 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.inline);
188 if (bool != null) {
189 return bool;
190 }
191 return false;
192 }
193
194 @Deprecated
195 public void setInline(boolean inline) {
196 Deprecation.LOG.error("The attribute 'inline' of 'UIOut' is deprecated. "
197 + "Please refer the documentation for further information.");
198 getStateHelper().put(PropertyKeys.inline, inline);
199 }
200
201 public java.lang.Integer getRowSpan() {
202 Number value = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
203 if (value != null) {
204 return value.intValue();
205 }
206 return 1;
207 }
208
209 public void setRowSpan(java.lang.Integer rowSpan) {
210 getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
211 }
212
213
214
215
216
217 public org.apache.myfaces.tobago.layout.Measure getLeft() {
218 Object object = getStateHelper().eval(PropertyKeys.left);
219 if (object != null) {
220 return Measure.valueOf(object);
221 }
222 return null;
223 }
224
225 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
226 getStateHelper().put(PropertyKeys.left, left);
227 }
228
229 public java.lang.Integer getColumnSpan() {
230 Number value = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
231 if (value != null) {
232 return value.intValue();
233 }
234 return 1;
235 }
236
237 public void setColumnSpan(java.lang.Integer columnSpan) {
238 getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
239 }
240
241 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
242 Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
243 if (object != null) {
244 return Measure.valueOf(object);
245 }
246 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
247 }
248
249 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
250 getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
251 }
252
253
254
255
256
257 public org.apache.myfaces.tobago.layout.Measure getTop() {
258 Object object = getStateHelper().eval(PropertyKeys.top);
259 if (object != null) {
260 return Measure.valueOf(object);
261 }
262 return null;
263 }
264
265 public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
266 getStateHelper().put(PropertyKeys.top, top);
267 }
268
269
270
271
272
273 public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
274 Object object = getStateHelper().eval(PropertyKeys.currentWidth);
275 if (object != null) {
276 return Measure.valueOf(object);
277 }
278 return getWidth();
279 }
280
281 public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
282 getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
283 }
284
285 public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
286 Object object = getStateHelper().eval(PropertyKeys.marginTop);
287 if (object != null) {
288 return Measure.valueOf(object);
289 }
290 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
291 }
292
293 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
294 getStateHelper().put(PropertyKeys.marginTop, marginTop);
295 }
296
297 public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
298 Object object = getStateHelper().eval(PropertyKeys.marginRight);
299 if (object != null) {
300 return Measure.valueOf(object);
301 }
302 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
303 }
304
305 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
306 getStateHelper().put(PropertyKeys.marginRight, marginRight);
307 }
308
309
310
311
312
313 public org.apache.myfaces.tobago.layout.Measure getWidth() {
314 Object object = getStateHelper().eval(PropertyKeys.width);
315 if (object != null) {
316 return Measure.valueOf(object);
317 }
318 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
319 }
320
321 public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
322 getStateHelper().put(PropertyKeys.width, width);
323 }
324
325 public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
326 Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
327 if (object != null) {
328 return Measure.valueOf(object);
329 }
330 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
331 }
332
333 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
334 getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
335 }
336
337
338
339
340
341 public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
342 Object object = getStateHelper().eval(PropertyKeys.currentHeight);
343 if (object != null) {
344 return Measure.valueOf(object);
345 }
346 return getHeight();
347 }
348
349 public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
350 getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
351 }
352
353
354
355
356
357 public org.apache.myfaces.tobago.layout.Display getDisplay() {
358 return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
359 }
360
361 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
362 getStateHelper().put(PropertyKeys.display, display);
363 }
364
365 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
366 Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
367 if (object != null) {
368 return Measure.valueOf(object);
369 }
370 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
371 }
372
373 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
374 getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
375 }
376
377 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
378 Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
379 if (object != null) {
380 return Measure.valueOf(object);
381 }
382 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
383 }
384
385 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
386 getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
387 }
388
389 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
390 Object object = getStateHelper().eval(PropertyKeys.marginBottom);
391 if (object != null) {
392 return Measure.valueOf(object);
393 }
394 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
395 }
396
397 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
398 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
399 }
400
401
402
403
404
405
406
407
408 public boolean isCreateSpan() {
409 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.createSpan);
410 if (bool != null) {
411 return bool;
412 }
413 return true;
414 }
415
416 public void setCreateSpan(boolean createSpan) {
417 getStateHelper().put(PropertyKeys.createSpan, createSpan);
418 }
419
420
421
422
423
424 public java.lang.Integer getVerticalIndex() {
425 Number value = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
426 if (value != null) {
427 return value.intValue();
428 }
429 return null;
430 }
431
432 public void setVerticalIndex(java.lang.Integer verticalIndex) {
433 getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
434 }
435
436 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
437 if (currentMarkup != null) {
438 return currentMarkup;
439 }
440 return null;
441 }
442
443 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
444 this.currentMarkup = currentMarkup;
445 }
446
447
448
449
450
451 public java.lang.Integer getHorizontalIndex() {
452 Number value = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
453 if (value != null) {
454 return value.intValue();
455 }
456 return null;
457 }
458
459 public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
460 getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
461 }
462
463 public Object saveState(FacesContext context) {
464 currentMarkup = null;
465 return super.saveState(context);
466 }
467
468
469 }