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.AbstractUIButton;
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 button element.
39    * UIComponent class, generated from template {@code component.stg} with class
40    * {@link org.apache.myfaces.tobago.internal.taglib.component.ButtonTagDeclaration}.
41   */
42  public class UIButton
43      extends AbstractUIButton implements SupportsAccessKey, Visual {
44  
45    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Button";
46  
47    public static final String COMPONENT_FAMILY = "javax.faces.Command";
48  
49  
50    enum PropertyKeys {
51      image,
52      markup,
53      link,
54      tabIndex,
55      confirmation,
56      label,
57      transition,
58      target,
59      defaultCommand,
60      accessKey,
61      customClass,
62      style,
63      tip,
64      omit,
65    }
66  
67    public String getFamily() {
68      return COMPONENT_FAMILY;
69    }
70  
71  
72    /**
73    Url to an image to display.
74  
75    */
76    public java.lang.String getImage() {
77      return (java.lang.String) getStateHelper().eval(PropertyKeys.image);
78    }
79  
80    public void setImage(java.lang.String image) {
81      getStateHelper().put(PropertyKeys.image, image);
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   If true the command is executed as default -- for example if the
198    user presses the enter key inside a related input field.
199   <br>Default: <code>false</code>
200   */
201   public boolean isDefaultCommand() {
202     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.defaultCommand);
203     if (bool != null) {
204       return bool;
205     }
206     return false;
207   }
208 
209   public void setDefaultCommand(boolean defaultCommand) {
210     getStateHelper().put(PropertyKeys.defaultCommand, defaultCommand);
211   }
212 
213   /**
214   The access key of this control.
215 
216   */
217   public java.lang.Character getAccessKey() {
218     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
219   }
220 
221   public void setAccessKey(java.lang.Character accessKey) {
222     getStateHelper().put(PropertyKeys.accessKey, accessKey);
223   }
224 
225   /**
226   Sets a CSS class in its parent, if the parent supports it.
227 
228    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
229 
230    <pre>
231    &lt;tc:in&gt;
232      &lt;tc:style customClass="my-emphasized"/&gt;
233    &lt;/tc:in&gt;
234    </pre>
235 
236    One capability is, to used external CSS libs.
237    <br>
238    This feature should not be used imprudent.
239    Because it might be unstable against changes in the renderered HTML code.
240 
241   */
242   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
243     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
244   }
245 
246   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
247     getStateHelper().put(PropertyKeys.customClass, customClass);
248   }
249 
250   /**
251   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
252 
253   */
254   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
255     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
256   }
257 
258   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
259     getStateHelper().put(PropertyKeys.style, style);
260   }
261 
262   /**
263   Text value to display as tooltip.
264 
265   */
266   public java.lang.String getTip() {
267     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
268   }
269 
270   public void setTip(java.lang.String tip) {
271     getStateHelper().put(PropertyKeys.tip, tip);
272   }
273 
274   /**
275   Flag indicating that the action of this element, will not be executed from client side
276    (e. g. when the user clicks a button.
277    When setting this value to true, the action will not be executed by the Tobago, but it can executed
278    by JavaScript.
279    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
280    In this case you usually don't want a submit with a full reload of the page.
281   <br>Default: <code>false</code>
282   */
283   public boolean isOmit() {
284     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
285     if (bool != null) {
286       return bool;
287     }
288     return false;
289   }
290 
291   public void setOmit(boolean omit) {
292     getStateHelper().put(PropertyKeys.omit, omit);
293   }
294 
295 
296 }