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.component.behavior.ClientBehaviorHolder;
23  import javax.faces.context.FacesContext;
24  import org.apache.myfaces.tobago.context.Markup;
25  import org.apache.myfaces.tobago.internal.component.AbstractUITree;
26  import org.apache.myfaces.tobago.model.Selectable;
27  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
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 ClientBehaviorHolder, 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    }
61  
62    public String getFamily() {
63      return COMPONENT_FAMILY;
64    }
65  
66  
67    /**
68    Only applicable in the case that the data model is a tree.
69     This flag indicates that the root node should be displayed.
70     Often in tree structures the root node is special and should not be displayed.
71    <br>Default: <code>false</code>
72    */
73    public boolean isShowRoot() {
74      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRoot);
75      if (bool != null) {
76        return bool;
77      }
78      return false;
79    }
80  
81    public void setShowRoot(boolean showRoot) {
82      getStateHelper().put(PropertyKeys.showRoot, showRoot);
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    /**
98    Only applicable in the case that the data model is a tree.
99     This flag indicates that the root node should be displayed with an open-close-switch.
100   <br>Default: <code>false</code>
101   */
102   public boolean isShowRootJunction() {
103     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRootJunction);
104     if (bool != null) {
105       return bool;
106     }
107     return false;
108   }
109 
110   public void setShowRootJunction(boolean showRootJunction) {
111     getStateHelper().put(PropertyKeys.showRootJunction, showRootJunction);
112   }
113 
114   /**
115   Flag indicating whether or not this component should be render selectable items.
116    Possible values are:
117    <ul>
118    <li><strong>none</strong> : not selectable</li>
119    <li><strong>multi</strong> : a multi section tree is rendered</li>
120    <li><strong>single</strong> : a single section tree is rendered</li>
121    <li><strong>multiLeafOnly</strong> : a multi section tree is rendered,
122    only leaf's are selectable</li>
123    <li><strong>singleLeafOnly</strong> : a single section tree is rendered,
124    only leaf's are selectable</li>
125    </ul>
126   <br>Default: <code>multi</code><br>Allowed Values: <code>none,multi,single,multiLeafOnly,singleLeafOnly</code>
127   */
128   public org.apache.myfaces.tobago.model.Selectable getSelectable() {
129     org.apache.myfaces.tobago.model.Selectable selectable = (org.apache.myfaces.tobago.model.Selectable) getStateHelper().eval(PropertyKeys.selectable);
130     if (selectable != null) {
131       return selectable;
132     }
133     return org.apache.myfaces.tobago.model.Selectable.multi;
134   }
135 
136   public void setSelectable(org.apache.myfaces.tobago.model.Selectable selectable) {
137     getStateHelper().put(PropertyKeys.selectable, selectable);
138   }
139 
140   /**
141   Sets a CSS class in its parent, if the parent supports it.
142 
143    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
144 
145    <pre>
146    &lt;tc:in&gt;
147      &lt;tc:style customClass="my-emphasized"/&gt;
148    &lt;/tc:in&gt;
149    </pre>
150 
151    One capability is, to used external CSS libs.
152    <br>
153    This feature should not be used imprudent.
154    Because it might be unstable against changes in the renderered HTML code.
155 
156   */
157   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
158     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
159   }
160 
161   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
162     getStateHelper().put(PropertyKeys.customClass, customClass);
163   }
164 
165 
166 }