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