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