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 public class UIObject
45 extends AbstractUIOut implements SupportsMarkup {
46
47 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Object";
48
49 public static final String COMPONENT_FAMILY = "javax.faces.Output";
50
51 private org.apache.myfaces.tobago.context.Markup currentMarkup;
52
53 enum PropertyKeys {
54 currentWidth,
55 markup,
56 marginLeft,
57 marginTop,
58 width,
59 marginRight,
60 currentHeight,
61 preferredHeight,
62 display,
63 minimumHeight,
64 maximumWidth,
65 preferredWidth,
66 marginBottom,
67 height,
68 verticalIndex,
69 minimumWidth,
70 rowSpan,
71 horizontalIndex,
72 left,
73 src,
74 columnSpan,
75 top,
76 maximumHeight,
77 }
78
79 public String getFamily() {
80 return COMPONENT_FAMILY;
81 }
82
83
84
85
86
87
88 public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
89 Object object = getStateHelper().eval(PropertyKeys.currentWidth);
90 if (object != null) {
91 return Measure.valueOf(object);
92 }
93 return getWidth();
94 }
95
96 public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
97 getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
98 }
99
100 public org.apache.myfaces.tobago.context.Markup getMarkup() {
101 Object object = getStateHelper().eval(PropertyKeys.markup);
102 if (object != null) {
103 return Markup.valueOf(object);
104 }
105 return null;
106 }
107
108 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
109 getStateHelper().put(PropertyKeys.markup, markup);
110 }
111
112 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
113 Object object = getStateHelper().eval(PropertyKeys.marginLeft);
114 if (object != null) {
115 return Measure.valueOf(object);
116 }
117 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
118 }
119
120 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
121 getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
122 }
123
124 public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
125 Object object = getStateHelper().eval(PropertyKeys.marginTop);
126 if (object != null) {
127 return Measure.valueOf(object);
128 }
129 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
130 }
131
132 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
133 getStateHelper().put(PropertyKeys.marginTop, marginTop);
134 }
135
136
137
138
139
140 public org.apache.myfaces.tobago.layout.Measure getWidth() {
141 Object object = getStateHelper().eval(PropertyKeys.width);
142 if (object != null) {
143 return Measure.valueOf(object);
144 }
145 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
146 }
147
148 public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
149 getStateHelper().put(PropertyKeys.width, width);
150 }
151
152 public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
153 Object object = getStateHelper().eval(PropertyKeys.marginRight);
154 if (object != null) {
155 return Measure.valueOf(object);
156 }
157 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
158 }
159
160 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
161 getStateHelper().put(PropertyKeys.marginRight, marginRight);
162 }
163
164
165
166
167
168 public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
169 Object object = getStateHelper().eval(PropertyKeys.currentHeight);
170 if (object != null) {
171 return Measure.valueOf(object);
172 }
173 return getHeight();
174 }
175
176 public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
177 getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
178 }
179
180 public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
181 Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
182 if (object != null) {
183 return Measure.valueOf(object);
184 }
185 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
186 }
187
188 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
189 getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
190 }
191
192
193
194
195
196 public org.apache.myfaces.tobago.layout.Display getDisplay() {
197 return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
198 }
199
200 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
201 getStateHelper().put(PropertyKeys.display, display);
202 }
203
204 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
205 Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
206 if (object != null) {
207 return Measure.valueOf(object);
208 }
209 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
210 }
211
212 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
213 getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
214 }
215
216 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
217 Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
218 if (object != null) {
219 return Measure.valueOf(object);
220 }
221 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
222 }
223
224 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
225 getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
226 }
227
228 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
229 Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
230 if (object != null) {
231 return Measure.valueOf(object);
232 }
233 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
234 }
235
236 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
237 getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
238 }
239
240 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
241 Object object = getStateHelper().eval(PropertyKeys.marginBottom);
242 if (object != null) {
243 return Measure.valueOf(object);
244 }
245 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
246 }
247
248 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
249 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
250 }
251
252
253
254
255
256 public org.apache.myfaces.tobago.layout.Measure getHeight() {
257 Object object = getStateHelper().eval(PropertyKeys.height);
258 if (object != null) {
259 return Measure.valueOf(object);
260 }
261 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
262 }
263
264 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
265 getStateHelper().put(PropertyKeys.height, height);
266 }
267
268
269
270
271
272 public java.lang.Integer getVerticalIndex() {
273 Number value = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
274 if (value != null) {
275 return value.intValue();
276 }
277 return null;
278 }
279
280 public void setVerticalIndex(java.lang.Integer verticalIndex) {
281 getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
282 }
283
284 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
285 Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
286 if (object != null) {
287 return Measure.valueOf(object);
288 }
289 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
290 }
291
292 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
293 getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
294 }
295
296 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
297 if (currentMarkup != null) {
298 return currentMarkup;
299 }
300 return null;
301 }
302
303 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
304 this.currentMarkup = currentMarkup;
305 }
306
307 public java.lang.Integer getRowSpan() {
308 Number value = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
309 if (value != null) {
310 return value.intValue();
311 }
312 return 1;
313 }
314
315 public void setRowSpan(java.lang.Integer rowSpan) {
316 getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
317 }
318
319
320
321
322
323 public java.lang.Integer getHorizontalIndex() {
324 Number value = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
325 if (value != null) {
326 return value.intValue();
327 }
328 return null;
329 }
330
331 public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
332 getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
333 }
334
335
336
337
338
339 public org.apache.myfaces.tobago.layout.Measure getLeft() {
340 Object object = getStateHelper().eval(PropertyKeys.left);
341 if (object != null) {
342 return Measure.valueOf(object);
343 }
344 return null;
345 }
346
347 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
348 getStateHelper().put(PropertyKeys.left, left);
349 }
350
351
352
353
354
355 public java.lang.String getSrc() {
356 return (java.lang.String) getStateHelper().eval(PropertyKeys.src);
357 }
358
359 public void setSrc(java.lang.String src) {
360 getStateHelper().put(PropertyKeys.src, src);
361 }
362
363 public java.lang.Integer getColumnSpan() {
364 Number value = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
365 if (value != null) {
366 return value.intValue();
367 }
368 return 1;
369 }
370
371 public void setColumnSpan(java.lang.Integer columnSpan) {
372 getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
373 }
374
375
376
377
378
379 public org.apache.myfaces.tobago.layout.Measure getTop() {
380 Object object = getStateHelper().eval(PropertyKeys.top);
381 if (object != null) {
382 return Measure.valueOf(object);
383 }
384 return null;
385 }
386
387 public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
388 getStateHelper().put(PropertyKeys.top, top);
389 }
390
391 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
392 Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
393 if (object != null) {
394 return Measure.valueOf(object);
395 }
396 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
397 }
398
399 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
400 getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
401 }
402
403 public Object saveState(FacesContext context) {
404 currentMarkup = null;
405 return super.saveState(context);
406 }
407
408
409 }