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