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