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.AbstractUITreeCommand;
25  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
26  import org.apache.myfaces.tobago.renderkit.css.Style;
27  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
28  import org.apache.myfaces.tobago.internal.util.StringUtils;
29  import org.apache.myfaces.tobago.internal.util.Deprecation;
30  import javax.el.ELException;
31  import javax.faces.FacesException;
32  import java.util.ArrayList;
33  import java.util.List;
34  import javax.el.MethodExpression;
35  import javax.el.ValueExpression;
36  
37  /** 
38   Renders a command inside of a tree.
39    * UIComponent class, generated from template {@code component.stg} with class
40    * {@link org.apache.myfaces.tobago.internal.taglib.component.TreeCommandTagDeclaration}.
41   */
42  public class UITreeCommand
43      extends AbstractUITreeCommand implements SupportsAccessKey, Visual {
44  
45    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TreeCommand";
46  
47    public static final String COMPONENT_FAMILY = "javax.faces.Command";
48  
49  
50    enum PropertyKeys {
51      markup,
52      resource,
53      link,
54      tabIndex,
55      label,
56      transition,
57      target,
58      renderedPartially,
59      jsfResource,
60      accessKey,
61      customClass,
62      tip,
63      style,
64      omit,
65    }
66  
67    public String getFamily() {
68      return COMPONENT_FAMILY;
69    }
70  
71  
72    public org.apache.myfaces.tobago.context.Markup getMarkup() {
73      Object object = getStateHelper().eval(PropertyKeys.markup);
74      if (object != null) {
75        return Markup.valueOf(object);
76      }
77      return null;
78    }
79  
80    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
81      getStateHelper().put(PropertyKeys.markup, markup);
82    }
83  
84    /**
85    Link to an internal resource.
86     Resources will be processed by the resource management.
87     E. g. define help.html and it will be served help_es.html or help_de.html if available.
88     For JSF-Pages you have to set the jsfResource attribute.
89  
90    */
91    public java.lang.String getResource() {
92      return (java.lang.String) getStateHelper().eval(PropertyKeys.resource);
93    }
94  
95    public void setResource(java.lang.String resource) {
96      getStateHelper().put(PropertyKeys.resource, resource);
97    }
98  
99    /**
100   Link to an arbitrary URL, either an internal link or an external link.
101 
102    <dl>
103      <dt>internal absolute link</dt>
104      <dd>Starts with a slash '/' character. The context path will be added.
105          A session id will be added, if needed.</dd>
106      <dt>external link</dt>
107      <dd>Starts with protocol followed by a colon ':' character.
108          The link will not be modified.</dd>
109      <dt>internal relative link</dt>
110      <dd>Any other strings. A session id will be added, if needed.</dd>
111    </dl>
112 
113   */
114   public java.lang.String getLink() {
115     return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
116   }
117 
118   public void setLink(java.lang.String link) {
119     getStateHelper().put(PropertyKeys.link, link);
120   }
121 
122   /**
123   Controls the navigation of the focus through the
124    input controls on a page with the Tab-Key.
125    The navigation starts from the element with
126    the lowest tabIndex value to the element with the highest value.
127    Elements that have identical tabIndex values should be navigated
128    in the order they appear in the character stream
129    Elements that are disabled or with a negative tabIndex
130    do not participate in the tabbing order.
131 
132   */
133   public java.lang.Integer getTabIndex() {
134     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
135     if (value != null) {
136       return value.intValue();
137     }
138     return null;
139   }
140 
141   public void setTabIndex(java.lang.Integer tabIndex) {
142     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
143   }
144 
145   /**
146   Text value to display as label.
147    If text contains an underscore the next character is used as accesskey (if configured so and possible).
148 
149   */
150   public java.lang.String getLabel() {
151     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
152   }
153 
154   public void setLabel(java.lang.String label) {
155     getStateHelper().put(PropertyKeys.label, label);
156   }
157 
158   /**
159   Specify, if the command calls an JSF-Action.
160    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
161   <br>Default: <code>true</code>
162   */
163   public boolean isTransition() {
164     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
165     if (bool != null) {
166       return bool;
167     }
168     return true;
169   }
170 
171   public void setTransition(boolean transition) {
172     getStateHelper().put(PropertyKeys.transition, transition);
173   }
174 
175   /**
176   Name of a frame where the resource retrieved via this hyperlink is to be
177    displayed.
178 
179   */
180   public java.lang.String getTarget() {
181     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
182   }
183 
184   public void setTarget(java.lang.String target) {
185     getStateHelper().put(PropertyKeys.target, target);
186   }
187 
188   /**
189   <p>
190    Indicate the partially rendered components in a case of a submit.
191    </p>
192    <p>
193    The search depends on the number of prefixed colons in the relativeId:
194    </p>
195    <dl>
196      <dd>number of prefixed colons == 0</dd>
197      <dt>fully relative</dt>
198      <dd>number of prefixed colons == 1</dd>
199      <dt>absolute (still normal findComponent syntax)</dt>
200      <dd>number of prefixed colons == 2</dd>
201      <dt>search in the current naming container (same as 0 colons)</dt>
202      <dd>number of prefixed colons == 3</dd>
203      <dt>search in the parent naming container of the current naming container</dt>
204      <dd>number of prefixed colons &gt; 3</dd>
205      <dt>go to the next parent naming container for each additional colon</dt>
206    </dl>
207    <p>
208    If a literal is specified: to use more than one identifier the identifiers must be space delimited.
209    </p>
210    <p>
211    Using this in a UISheet or UITabGroup component this list indicates components to update when calling
212    internal AJAX requests like sort or paging commands.
213    Don't forget to add the sheet-id or tagGroup-id in that case, if needed.
214    </p>
215    <p>
216    You can also use
217 
218   */
219   public String[] getRenderedPartially() {
220     Object strArray = getStateHelper().eval(PropertyKeys.renderedPartially);
221     if (strArray != null) {
222       if (strArray instanceof String[]) {
223         return (String[]) strArray;
224       } else if (strArray instanceof String) {
225         String[] strings = StringUtils.split((String) strArray, ", ");
226         List<String> result = new ArrayList<String>(strings.length);
227         for (String string : strings) {
228           if (string.trim().length() != 0) {
229             result.add(string.trim());
230           }
231         }
232         return result.toArray(new String[result.size()]);
233       } else if (strArray == null) {
234         return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
235       } else {
236         return new String[]{strArray.toString()};
237       }
238     }
239     return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
240   }
241 
242   public void setRenderedPartially(String[] renderedPartially) {
243     getStateHelper().put(PropertyKeys.renderedPartially, renderedPartially);
244   }
245 
246   /**
247   Flag indicating that the resource referenced by the resource attribute is a jsf resource.
248    That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
249    /faces/*). Default is false.
250   <br>Default: <code>false</code>
251   */
252   public boolean isJsfResource() {
253     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.jsfResource);
254     if (bool != null) {
255       return bool;
256     }
257     return false;
258   }
259 
260   public void setJsfResource(boolean jsfResource) {
261     getStateHelper().put(PropertyKeys.jsfResource, jsfResource);
262   }
263 
264   /**
265   The access key of this control.
266 
267   */
268   public java.lang.Character getAccessKey() {
269     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
270   }
271 
272   public void setAccessKey(java.lang.Character accessKey) {
273     getStateHelper().put(PropertyKeys.accessKey, accessKey);
274   }
275 
276   /**
277   Sets a CSS class in its parent, if the parent supports it.
278 
279    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
280 
281    <pre>
282    &lt;tc:in&gt;
283      &lt;tc:style customClass="my-emphasized"/&gt;
284    &lt;/tc:in&gt;
285    </pre>
286 
287    One capability is, to used external CSS libs.
288    <br>
289    This feature should not be used imprudent.
290    Because it might be unstable against changes in the renderered HTML code.
291 
292   */
293   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
294     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
295   }
296 
297   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
298     getStateHelper().put(PropertyKeys.customClass, customClass);
299   }
300 
301   /**
302   Text value to display as tooltip.
303 
304   */
305   public java.lang.String getTip() {
306     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
307   }
308 
309   public void setTip(java.lang.String tip) {
310     getStateHelper().put(PropertyKeys.tip, tip);
311   }
312 
313   /**
314   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
315 
316   */
317   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
318     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
319   }
320 
321   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
322     getStateHelper().put(PropertyKeys.style, style);
323   }
324 
325   /**
326   Flag indicating that the action of this element, will not be executed from client side
327    (e. g. when the user clicks a button.
328    When setting this value to true, the action will not be executed by the Tobago, but it can executed
329    by JavaScript.
330    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
331    In this case you usually don't want a submit with a full reload of the page.
332   <br>Default: <code>false</code>
333   */
334   public boolean isOmit() {
335     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
336     if (bool != null) {
337       return bool;
338     }
339     return false;
340   }
341 
342   public void setOmit(boolean omit) {
343     getStateHelper().put(PropertyKeys.omit, omit);
344   }
345 
346 
347 }