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