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.AbstractUICommand;
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   Use this tag only as a facet for the client events "click", "change"
39    in selectOneRadio, selectBooleanCheckbox, selectManyCheckbox, selectOneChoice, etc.
40    TODO: may add some events and components. See {
41    * UIComponent class, generated from template {@code component.stg} with class
42    * {@link org.apache.myfaces.tobago.internal.taglib.component.CommandTagDeclaration}.
43   */
44  public class UICommand
45      extends AbstractUICommand implements Visual {
46  
47    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Command";
48  
49    public static final String COMPONENT_FAMILY = "javax.faces.Command";
50  
51  
52    enum PropertyKeys {
53      image,
54      markup,
55      resource,
56      link,
57      confirmation,
58      label,
59      transition,
60      target,
61      defaultCommand,
62      jsfResource,
63      accessKey,
64      customClass,
65      style,
66      tip,
67      omit,
68    }
69  
70    public String getFamily() {
71      return COMPONENT_FAMILY;
72    }
73  
74  
75    /**
76    Url to an image to display.
77  
78    */
79    public java.lang.String getImage() {
80      return (java.lang.String) getStateHelper().eval(PropertyKeys.image);
81    }
82  
83    public void setImage(java.lang.String image) {
84      getStateHelper().put(PropertyKeys.image, image);
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   Link to an internal resource.
101    Resources will be processed by the resource management.
102    E. g. define help.html and it will be served help_es.html or help_de.html if available.
103    For JSF-Pages you have to set the jsfResource attribute.
104 
105   */
106   public java.lang.String getResource() {
107     return (java.lang.String) getStateHelper().eval(PropertyKeys.resource);
108   }
109 
110   public void setResource(java.lang.String resource) {
111     getStateHelper().put(PropertyKeys.resource, resource);
112   }
113 
114   /**
115   Link to an arbitrary URL, either an internal link or an external link.
116 
117    <dl>
118      <dt>internal absolute link</dt>
119      <dd>Starts with a slash '/' character. The context path will be added.
120          A session id will be added, if needed.</dd>
121      <dt>external link</dt>
122      <dd>Starts with protocol followed by a colon ':' character.
123          The link will not be modified.</dd>
124      <dt>internal relative link</dt>
125      <dd>Any other strings. A session id will be added, if needed.</dd>
126    </dl>
127 
128   */
129   public java.lang.String getLink() {
130     return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
131   }
132 
133   public void setLink(java.lang.String link) {
134     getStateHelper().put(PropertyKeys.link, link);
135   }
136 
137   /**
138   Text to use as confirmation message.
139 
140   */
141   public java.lang.String getConfirmation() {
142     return (java.lang.String) getStateHelper().eval(PropertyKeys.confirmation);
143   }
144 
145   public void setConfirmation(java.lang.String confirmation) {
146     getStateHelper().put(PropertyKeys.confirmation, confirmation);
147   }
148 
149   /**
150   Text value to display as label.
151    If text contains an underscore the next character is used as accesskey (if configured so and possible).
152 
153   */
154   public java.lang.String getLabel() {
155     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
156   }
157 
158   public void setLabel(java.lang.String label) {
159     getStateHelper().put(PropertyKeys.label, label);
160   }
161 
162   /**
163   Specify, if the command calls an JSF-Action.
164    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
165   <br>Default: <code>true</code>
166   */
167   public boolean isTransition() {
168     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
169     if (bool != null) {
170       return bool;
171     }
172     return true;
173   }
174 
175   public void setTransition(boolean transition) {
176     getStateHelper().put(PropertyKeys.transition, transition);
177   }
178 
179   /**
180   Name of a frame where the resource retrieved via this hyperlink is to be
181    displayed.
182 
183   */
184   public java.lang.String getTarget() {
185     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
186   }
187 
188   public void setTarget(java.lang.String target) {
189     getStateHelper().put(PropertyKeys.target, target);
190   }
191 
192   /**
193   If true the command is executed as default -- for example if the
194    user presses the enter key inside a related input field.
195   <br>Default: <code>false</code>
196   */
197   public boolean isDefaultCommand() {
198     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.defaultCommand);
199     if (bool != null) {
200       return bool;
201     }
202     return false;
203   }
204 
205   public void setDefaultCommand(boolean defaultCommand) {
206     getStateHelper().put(PropertyKeys.defaultCommand, defaultCommand);
207   }
208 
209   /**
210   Flag indicating that the resource referenced by the resource attribute is a jsf resource.
211    That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
212    /faces/*). Default is false.
213   <br>Default: <code>false</code>
214   */
215   public boolean isJsfResource() {
216     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.jsfResource);
217     if (bool != null) {
218       return bool;
219     }
220     return false;
221   }
222 
223   public void setJsfResource(boolean jsfResource) {
224     getStateHelper().put(PropertyKeys.jsfResource, jsfResource);
225   }
226 
227   /**
228   The access key of this control.
229 
230   */
231   public java.lang.Character getAccessKey() {
232     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
233   }
234 
235   public void setAccessKey(java.lang.Character accessKey) {
236     getStateHelper().put(PropertyKeys.accessKey, accessKey);
237   }
238 
239   /**
240   Sets a CSS class in its parent, if the parent supports it.
241 
242    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
243 
244    <pre>
245    &lt;tc:in&gt;
246      &lt;tc:style customClass="my-emphasized"/&gt;
247    &lt;/tc:in&gt;
248    </pre>
249 
250    One capability is, to used external CSS libs.
251    <br>
252    This feature should not be used imprudent.
253    Because it might be unstable against changes in the renderered HTML code.
254 
255   */
256   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
257     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
258   }
259 
260   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
261     getStateHelper().put(PropertyKeys.customClass, customClass);
262   }
263 
264   /**
265   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
266 
267   */
268   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
269     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
270   }
271 
272   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
273     getStateHelper().put(PropertyKeys.style, style);
274   }
275 
276   /**
277   Text value to display as tooltip.
278 
279   */
280   public java.lang.String getTip() {
281     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
282   }
283 
284   public void setTip(java.lang.String tip) {
285     getStateHelper().put(PropertyKeys.tip, tip);
286   }
287 
288   /**
289   Flag indicating that the action of this element, will not be executed from client side
290    (e. g. when the user clicks a button.
291    When setting this value to true, the action will not be executed by the Tobago, but it can executed
292    by JavaScript.
293    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
294    In this case you usually don't want a submit with a full reload of the page.
295   <br>Default: <code>false</code>
296   */
297   public boolean isOmit() {
298     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
299     if (bool != null) {
300       return bool;
301     }
302     return false;
303   }
304 
305   public void setOmit(boolean omit) {
306     getStateHelper().put(PropertyKeys.omit, omit);
307   }
308 
309 
310 }