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.Arrays;
33  import java.util.ArrayList;
34  import java.util.Collection;
35  import java.util.List;
36  import javax.el.MethodExpression;
37  import javax.el.ValueExpression;
38  
39  /** 
40   Renders a command inside of a tree.
41    * UIComponent class, generated from template {@code component.stg} with class
42    * {@link org.apache.myfaces.tobago.internal.taglib.component.TreeCommandTagDeclaration}.
43   */
44  public class UITreeCommand
45      extends AbstractUITreeCommand implements SupportsAccessKey, Visual {
46  
47    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TreeCommand";
48  
49    public static final String COMPONENT_FAMILY = "javax.faces.Command";
50  
51    private static final Collection<String> EVENT_NAMES = Arrays.asList("click", "dblclick");
52  
53    @Override
54    public Collection<String> getEventNames() {
55      return EVENT_NAMES;
56    }
57  
58    @Override
59    public String getDefaultEventName() {
60      return "click";
61    }
62  
63  
64    enum PropertyKeys {
65      markup,
66      link,
67      tabIndex,
68      confirmation,
69      label,
70      transition,
71      target,
72      accessKey,
73      customClass,
74      tip,
75      style,
76      omit,
77    }
78  
79    public String getFamily() {
80      return COMPONENT_FAMILY;
81    }
82  
83  
84    public org.apache.myfaces.tobago.context.Markup getMarkup() {
85      Object object = getStateHelper().eval(PropertyKeys.markup);
86      if (object != null) {
87        return Markup.valueOf(object);
88      }
89      return null;
90    }
91  
92    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
93      getStateHelper().put(PropertyKeys.markup, markup);
94    }
95  
96    /**
97    Link to an arbitrary URL, either an internal link or an external link.
98  
99     <dl>
100      <dt>internal absolute link</dt>
101      <dd>Starts with a slash '/' character. The context path will be added.
102          A session id will be added, if needed.</dd>
103      <dt>external link</dt>
104      <dd>Starts with protocol followed by a colon ':' character.
105          The link will not be modified.</dd>
106      <dt>internal relative link</dt>
107      <dd>Any other strings. A session id will be added, if needed.</dd>
108    </dl>
109 
110   */
111   public java.lang.String getLink() {
112     return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
113   }
114 
115   public void setLink(java.lang.String link) {
116     getStateHelper().put(PropertyKeys.link, link);
117   }
118 
119   /**
120   Controls the navigation of the focus through the
121    input controls on a page with the Tab-Key.
122    The navigation starts from the element with
123    the lowest tabIndex value to the element with the highest value.
124    Elements that have identical tabIndex values should be navigated
125    in the order they appear in the character stream
126    Elements that are disabled or with a negative tabIndex
127    do not participate in the tabbing order.
128 
129   */
130   public java.lang.Integer getTabIndex() {
131     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
132     if (value != null) {
133       return value.intValue();
134     }
135     return null;
136   }
137 
138   public void setTabIndex(java.lang.Integer tabIndex) {
139     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
140   }
141 
142   /**
143   Text to use as confirmation message.
144 
145   */
146   public java.lang.String getConfirmation() {
147     return (java.lang.String) getStateHelper().eval(PropertyKeys.confirmation);
148   }
149 
150   public void setConfirmation(java.lang.String confirmation) {
151     getStateHelper().put(PropertyKeys.confirmation, confirmation);
152   }
153 
154   /**
155   A localized user presentable label for this component.
156 
157   */
158   public java.lang.String getLabel() {
159     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
160   }
161 
162   public void setLabel(java.lang.String label) {
163     getStateHelper().put(PropertyKeys.label, label);
164   }
165 
166   /**
167   Specify, if the command calls an JSF-Action.
168    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
169   <br>Default: <code>true</code>
170   */
171   public boolean isTransition() {
172     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
173     if (bool != null) {
174       return bool;
175     }
176     return true;
177   }
178 
179   public void setTransition(boolean transition) {
180     getStateHelper().put(PropertyKeys.transition, transition);
181   }
182 
183   /**
184   Name of a frame where the resource retrieved via this hyperlink is to be
185    displayed.
186 
187   */
188   public java.lang.String getTarget() {
189     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
190   }
191 
192   public void setTarget(java.lang.String target) {
193     getStateHelper().put(PropertyKeys.target, target);
194   }
195 
196   /**
197   The access key of this control.
198 
199   */
200   public java.lang.Character getAccessKey() {
201     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
202   }
203 
204   public void setAccessKey(java.lang.Character accessKey) {
205     getStateHelper().put(PropertyKeys.accessKey, accessKey);
206   }
207 
208   /**
209   Sets a CSS class in its parent, if the parent supports it.
210 
211    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
212 
213    <pre>
214    &lt;tc:in&gt;
215      &lt;tc:style customClass="my-emphasized"/&gt;
216    &lt;/tc:in&gt;
217    </pre>
218 
219    One capability is, to used external CSS libs.
220    <br>
221    This feature should not be used imprudent.
222    Because it might be unstable against changes in the renderered HTML code.
223 
224   */
225   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
226     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
227   }
228 
229   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
230     getStateHelper().put(PropertyKeys.customClass, customClass);
231   }
232 
233   /**
234   Text value to display as tooltip.
235 
236   */
237   public java.lang.String getTip() {
238     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
239   }
240 
241   public void setTip(java.lang.String tip) {
242     getStateHelper().put(PropertyKeys.tip, tip);
243   }
244 
245   /**
246   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
247 
248   */
249   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
250     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
251   }
252 
253   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
254     getStateHelper().put(PropertyKeys.style, style);
255   }
256 
257   /**
258   Flag indicating that the action of this element, will not be executed from client side
259    (e. g. when the user clicks a button.
260    When setting this value to true, the action will not be executed by the Tobago, but it can executed
261    by JavaScript.
262    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
263    In this case you usually don't want a submit with a full reload of the page.
264   <br>Default: <code>false</code>
265   */
266   public boolean isOmit() {
267     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
268     if (bool != null) {
269       return bool;
270     }
271     return false;
272   }
273 
274   public void setOmit(boolean omit) {
275     getStateHelper().put(PropertyKeys.omit, omit);
276   }
277 
278 
279 }