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.AbstractUITreeListbox;
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 data structure displayed as a set of list boxes.
44    * UIComponent class, generated from template {@code component.stg} with class
45    * {@link org.apache.myfaces.tobago.internal.taglib.component.TreeListboxTagDeclaration}.
46   */
47  @Generated("component.stg")
48  public class UITreeListbox
49      extends AbstractUITreeListbox implements ClientBehaviorHolder {
50  
51    public static final String COMPONENT_TYPE = Tags.treeListbox.componentType();
52  
53    public static final String COMPONENT_FAMILY = "javax.faces.Data";
54  
55  
56    enum PropertyKeys {
57      markup,
58      size,
59      selectable,
60      customClass,
61      required,
62    }
63  
64    public String getFamily() {
65      return COMPONENT_FAMILY;
66    }
67  
68  
69    public org.apache.myfaces.tobago.context.Markup getMarkup() {
70      Object object = getStateHelper().eval(PropertyKeys.markup);
71      if (object != null) {
72        return Markup.valueOf(object);
73      }
74      return null;
75    }
76  
77    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
78      getStateHelper().put(PropertyKeys.markup, markup);
79    }
80  
81    /**
82    The number of the shown rows in the element. E. g. the size attribute of the select element in HTML.
83  
84    */
85    public java.lang.Integer getSize() {
86      Number value  = (Number) getStateHelper().eval(PropertyKeys.size);
87      if (value != null) {
88        return value.intValue();
89      }
90      return null;
91    }
92  
93    public void setSize(java.lang.Integer size) {
94      getStateHelper().put(PropertyKeys.size, size);
95    }
96  
97    /**
98    Flag indicating whether or not this component should be render selectable items.
99     Possible values are:
100    <ul>
101    <li><strong>single</strong> : a single section tree is rendered</li>
102    <li><strong>multiLeafOnly</strong> : a multi section tree is rendered,
103    only Leaf's are selectable</li>
104    <li><strong>singleLeafOnly</strong> : a single section tree is rendered,
105    only Leaf's are selectable</li>
106    </ul>
107   <br>Default: <code>single</code><br>Allowed Values: <code>single,multiLeafOnly,singleLeafOnly</code>
108   */
109   public org.apache.myfaces.tobago.model.Selectable getSelectable() {
110     org.apache.myfaces.tobago.model.Selectable selectable = (org.apache.myfaces.tobago.model.Selectable) getStateHelper().eval(PropertyKeys.selectable);
111     if (selectable != null) {
112       return selectable;
113     }
114     return org.apache.myfaces.tobago.model.Selectable.single;
115   }
116 
117   public void setSelectable(org.apache.myfaces.tobago.model.Selectable selectable) {
118     getStateHelper().put(PropertyKeys.selectable, selectable);
119   }
120 
121   /**
122   Sets a CSS class in its parent, if the parent supports it.
123 
124    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
125 
126    <pre>
127    &lt;tc:in&gt;
128      &lt;tc:style customClass="my-emphasized"/&gt;
129    &lt;/tc:in&gt;
130    </pre>
131 
132    One capability is, to used external CSS libs.
133    <br>
134    This feature should not be used imprudent.
135    Because it might be unstable against changes in the renderered HTML code.
136 
137   */
138   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
139     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
140   }
141 
142   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
143     getStateHelper().put(PropertyKeys.customClass, customClass);
144   }
145 
146   /**
147   Flag indicating that a value is required.
148    If the value is an empty string a
149    ValidationError occurs and a Error Message is rendered.
150   <br>Default: <code>false</code>
151   */
152   public boolean isRequired() {
153     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.required);
154     if (bool != null) {
155       return bool;
156     }
157     return false;
158   }
159 
160   public void setRequired(boolean required) {
161     getStateHelper().put(PropertyKeys.required, required);
162   }
163 
164 
165   @Override
166   public void restoreState(FacesContext context, Object state) {
167     // FIXME HACK for mojarra SystemEventListener state restoring bug
168     pushComponentToEL(context, this);
169     super.restoreState(context, state);
170     popComponentFromEL(context);
171   }
172 
173 }