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