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