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