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