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.model.Selectable;
26  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
27  import org.apache.myfaces.tobago.renderkit.css.Style;
28  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
29  import org.apache.myfaces.tobago.internal.util.StringUtils;
30  import org.apache.myfaces.tobago.internal.util.Deprecation;
31  import javax.el.ELException;
32  import javax.faces.FacesException;
33  import java.util.Arrays;
34  import java.util.ArrayList;
35  import java.util.Collection;
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 component.stg} with class
44    * {@link org.apache.myfaces.tobago.internal.taglib.component.TreeTagDeclaration}.
45   */
46  public class UITree
47      extends AbstractUITree implements Visual {
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  
54    enum PropertyKeys {
55      showRoot,
56      markup,
57      showRootJunction,
58      selectable,
59      customClass,
60      style,
61    }
62  
63    public String getFamily() {
64      return COMPONENT_FAMILY;
65    }
66  
67  
68    /**
69    Only applicable in the case that the data model is a tree.
70     This flag indicates that the root node should be displayed.
71     Often in tree structures the root node is special and should not be displayed.
72    <br>Default: <code>false</code>
73    */
74    public boolean isShowRoot() {
75      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRoot);
76      if (bool != null) {
77        return bool;
78      }
79      return false;
80    }
81  
82    public void setShowRoot(boolean showRoot) {
83      getStateHelper().put(PropertyKeys.showRoot, showRoot);
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    /**
99    Only applicable in the case that the data model is a tree.
100    This flag indicates that the root node should be displayed with an open-close-switch.
101   <br>Default: <code>false</code>
102   */
103   public boolean isShowRootJunction() {
104     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRootJunction);
105     if (bool != null) {
106       return bool;
107     }
108     return false;
109   }
110 
111   public void setShowRootJunction(boolean showRootJunction) {
112     getStateHelper().put(PropertyKeys.showRootJunction, showRootJunction);
113   }
114 
115   /**
116   Flag indicating whether or not this component should be render selectable items.
117    Possible values are:
118    <ul>
119    <li><strong>none</strong> : not selectable</li>
120    <li><strong>multi</strong> : a multi section tree is rendered</li>
121    <li><strong>single</strong> : a single section tree is rendered</li>
122    <li><strong>multiLeafOnly</strong> : a multi section tree is rendered,
123    only leaf's are selectable</li>
124    <li><strong>singleLeafOnly</strong> : a single section tree is rendered,
125    only leaf's are selectable</li>
126    </ul>
127   <br>Default: <code>multi</code><br>Allowed Values: <code>none,multi,single,multiLeafOnly,singleLeafOnly</code>
128   */
129   public org.apache.myfaces.tobago.model.Selectable getSelectable() {
130     org.apache.myfaces.tobago.model.Selectable selectable = (org.apache.myfaces.tobago.model.Selectable) getStateHelper().eval(PropertyKeys.selectable);
131     if (selectable != null) {
132       return selectable;
133     }
134     return org.apache.myfaces.tobago.model.Selectable.multi;
135   }
136 
137   public void setSelectable(org.apache.myfaces.tobago.model.Selectable selectable) {
138     getStateHelper().put(PropertyKeys.selectable, selectable);
139   }
140 
141   /**
142   Sets a CSS class in its parent, if the parent supports it.
143 
144    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
145 
146    <pre>
147    &lt;tc:in&gt;
148      &lt;tc:style customClass="my-emphasized"/&gt;
149    &lt;/tc:in&gt;
150    </pre>
151 
152    One capability is, to used external CSS libs.
153    <br>
154    This feature should not be used imprudent.
155    Because it might be unstable against changes in the renderered HTML code.
156 
157   */
158   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
159     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
160   }
161 
162   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
163     getStateHelper().put(PropertyKeys.customClass, customClass);
164   }
165 
166   /**
167   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
168 
169   */
170   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
171     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
172   }
173 
174   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
175     getStateHelper().put(PropertyKeys.style, style);
176   }
177 
178 
179 }