View Javadoc

1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
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.AbstractUITree;
25  import org.apache.myfaces.tobago.layout.Display;
26  import org.apache.myfaces.tobago.layout.Measure;
27  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
28  import org.apache.myfaces.tobago.internal.util.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   A tree with classical look. 
42    Usually used with icons and junction lines to open folder, etc.
43    * UIComponent class, generated from template {@code component2.0.stg} with class
44    * {@link org.apache.myfaces.tobago.internal.taglib.component.TreeTagDeclaration}.
45   */
46  public class UITree
47      extends AbstractUITree implements SupportsMarkup {
48  
49    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Tree";
50  
51    public static final String COMPONENT_FAMILY = "javax.faces.Data";
52  
53    private org.apache.myfaces.tobago.context.Markup currentMarkup;
54  
55    enum PropertyKeys {
56      markup,
57      marginLeft,
58      minimumHeight,
59      height,
60      showRoot,
61      minimumWidth,
62      rowSpan,
63      left,
64      columnSpan,
65      maximumHeight,
66      top,
67      currentWidth,
68      marginTop,
69      marginRight,
70      width,
71      preferredHeight,
72      currentHeight,
73      showRootJunction,
74      display,
75      maximumWidth,
76      preferredWidth,
77      marginBottom,
78      selectable,
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 getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
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 getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
118   }
119 
120   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
121     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
122   }
123 
124   /**
125   This value will usually be set by the layout manager.
126 
127   */
128   public org.apache.myfaces.tobago.layout.Measure getHeight() {
129     Object object = getStateHelper().eval(PropertyKeys.height);
130     if (object != null) {
131        return Measure.valueOf(object);
132     }
133     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
134   }
135 
136   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
137     getStateHelper().put(PropertyKeys.height, height);
138   }
139 
140   /**
141   Only applicable in the case that the data model is a tree.
142    This flag indicates that the root node should be displayed.
143    Often in tree structures the root node is special and should not be displayed.
144   <br />Default: <code>false</code>
145   */
146   public boolean isShowRoot() {
147     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRoot);
148     if (bool != null) {
149       return bool;
150     }
151     return false;
152   }
153 
154   public void setShowRoot(boolean showRoot) {
155     getStateHelper().put(PropertyKeys.showRoot, showRoot);
156   }
157 
158   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
159     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
160     if (object != null) {
161        return Measure.valueOf(object);
162     }
163     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
164   }
165 
166   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
167     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
168   }
169 
170   public java.lang.Integer getRowSpan() {
171     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
172     if (value != null) {
173       return value.intValue();
174     }
175     return 1;
176   }
177 
178   public void setRowSpan(java.lang.Integer rowSpan) {
179     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
180   }
181 
182   /**
183   This value will usually be set by the layout manager.
184 
185   */
186   public org.apache.myfaces.tobago.layout.Measure getLeft() {
187     Object object = getStateHelper().eval(PropertyKeys.left);
188     if (object != null) {
189        return Measure.valueOf(object);
190     }
191     return null;
192   }
193 
194   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
195     getStateHelper().put(PropertyKeys.left, left);
196   }
197 
198   public java.lang.Integer getColumnSpan() {
199     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
200     if (value != null) {
201       return value.intValue();
202     }
203     return 1;
204   }
205 
206   public void setColumnSpan(java.lang.Integer columnSpan) {
207     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
208   }
209 
210   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
211     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
212     if (object != null) {
213        return Measure.valueOf(object);
214     }
215     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
216   }
217 
218   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
219     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
220   }
221 
222   /**
223   This value will usually be set by the layout manager.
224 
225   */
226   public org.apache.myfaces.tobago.layout.Measure getTop() {
227     Object object = getStateHelper().eval(PropertyKeys.top);
228     if (object != null) {
229        return Measure.valueOf(object);
230     }
231     return null;
232   }
233 
234   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
235     getStateHelper().put(PropertyKeys.top, top);
236   }
237 
238   /**
239   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
240 
241   */
242   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
243     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
244     if (object != null) {
245        return Measure.valueOf(object);
246     }
247     return getWidth();
248   }
249 
250   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
251     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
252   }
253 
254   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
255     Object object = getStateHelper().eval(PropertyKeys.marginTop);
256     if (object != null) {
257        return Measure.valueOf(object);
258     }
259     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
260   }
261 
262   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
263     getStateHelper().put(PropertyKeys.marginTop, marginTop);
264   }
265 
266   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
267     Object object = getStateHelper().eval(PropertyKeys.marginRight);
268     if (object != null) {
269        return Measure.valueOf(object);
270     }
271     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
272   }
273 
274   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
275     getStateHelper().put(PropertyKeys.marginRight, marginRight);
276   }
277 
278   /**
279   This value will usually be set by the layout manager.
280 
281   */
282   public org.apache.myfaces.tobago.layout.Measure getWidth() {
283     Object object = getStateHelper().eval(PropertyKeys.width);
284     if (object != null) {
285        return Measure.valueOf(object);
286     }
287     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
288   }
289 
290   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
291     getStateHelper().put(PropertyKeys.width, width);
292   }
293 
294   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
295     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
296     if (object != null) {
297        return Measure.valueOf(object);
298     }
299     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
300   }
301 
302   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
303     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
304   }
305 
306   /**
307   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
308 
309   */
310   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
311     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
312     if (object != null) {
313        return Measure.valueOf(object);
314     }
315     return getHeight();
316   }
317 
318   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
319     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
320   }
321 
322   /**
323   Only applicable in the case that the data model is a tree.
324    This flag indicates that the root node should be displayed with an open-close-switch.
325   <br />Default: <code>false</code>
326   */
327   public boolean isShowRootJunction() {
328     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRootJunction);
329     if (bool != null) {
330       return bool;
331     }
332     return false;
333   }
334 
335   public void setShowRootJunction(boolean showRootJunction) {
336     getStateHelper().put(PropertyKeys.showRootJunction, showRootJunction);
337   }
338 
339   /**
340   This attribute is for internal use only.
341 
342   */
343   public org.apache.myfaces.tobago.layout.Display getDisplay() {
344     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
345   }
346 
347   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
348     getStateHelper().put(PropertyKeys.display, display);
349   }
350 
351   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
352     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
353     if (object != null) {
354        return Measure.valueOf(object);
355     }
356     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
357   }
358 
359   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
360     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
361   }
362 
363   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
364     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
365     if (object != null) {
366        return Measure.valueOf(object);
367     }
368     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
369   }
370 
371   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
372     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
373   }
374 
375   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
376     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
377     if (object != null) {
378        return Measure.valueOf(object);
379     }
380     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
381   }
382 
383   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
384     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
385   }
386 
387   /**
388   Flag indicating whether or not this component should be render selectable items.
389    Possible values are:
390    <ul>
391    <li><strong>multi</strong> : not selectable</li>
392    <li><strong>multi</strong> : a multi section tree is rendered</li>
393    <li><strong>single</strong> : a single section tree is rendered</li>
394    <li><strong>multiLeafOnly</strong> : a multi section tree is rendered,
395    only leaf's are selectable</li>
396    <li><strong>singleLeafOnly</strong> : a single section tree is rendered,
397    only leaf's are selectable</li>
398    </ul>
399   <br />Default: <code>multi</code><br />Allowed Values: <code>none,multi,single,multiLeafOnly,singleLeafOnly</code>
400   */
401   public java.lang.String getSelectable() {
402     java.lang.String selectable = (java.lang.String) getStateHelper().eval(PropertyKeys.selectable);
403     if (selectable != null) {
404       return selectable;
405     }
406     return "multi";
407   }
408 
409   public void setSelectable(java.lang.String selectable) {
410     getStateHelper().put(PropertyKeys.selectable, selectable);
411   }
412 
413   /**
414   This attribute is for internal use only.
415 
416   */
417   public java.lang.Integer getVerticalIndex() {
418     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
419     if (value != null) {
420       return value.intValue();
421     }
422     return null;
423   }
424 
425   public void setVerticalIndex(java.lang.Integer verticalIndex) {
426     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
427   }
428 
429   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
430     if (currentMarkup != null) {
431       return currentMarkup;
432     }
433     return null;
434   }
435 
436   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
437     this.currentMarkup = currentMarkup;
438   }
439 
440   /**
441   This attribute is for internal use only.
442 
443   */
444   public java.lang.Integer getHorizontalIndex() {
445     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
446     if (value != null) {
447       return value.intValue();
448     }
449     return null;
450   }
451 
452   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
453     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
454   }
455 
456   public Object saveState(FacesContext context) {
457     currentMarkup = null;
458     return super.saveState(context);
459   }
460 
461 
462 }