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.AbstractUILink;
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 org.apache.myfaces.tobago.component.Tags;
30  import javax.annotation.Generated;
31  import javax.el.ELException;
32  import javax.faces.FacesException;
33  import java.util.Arrays;
34  import java.util.ArrayList;
35  import java.util.Collection;
36  import java.util.List;
37  import javax.el.MethodExpression;
38  import javax.el.ValueExpression;
39  
40  /**
41   Renders a link element, i. e. an anchor <a> tag.
42    For a <link> tag, please use <tc:metaLink> tag.
43    * UIComponent class, generated from template {@code component.stg} with class
44    * {@link org.apache.myfaces.tobago.internal.taglib.component.LinkTagDeclaration}.
45   */
46  @Generated("component.stg")
47  public class UILink
48      extends AbstractUILink implements SupportsAccessKey {
49  
50    public static final String COMPONENT_TYPE = Tags.link.componentType();
51  
52    public static final String COMPONENT_FAMILY = "javax.faces.Command";
53  
54    private static final Collection<String> EVENT_NAMES = Arrays.asList("click", "dblclick", "focus", "blur");
55  
56    @Override
57    public Collection<String> getEventNames() {
58      return EVENT_NAMES;
59    }
60  
61    @Override
62    public String getDefaultEventName() {
63      return "click";
64    }
65  
66  
67    enum PropertyKeys {
68      image,
69      markup,
70      link,
71      tabIndex,
72      confirmation,
73      label,
74      transition,
75      target,
76      fragment,
77      accessKey,
78      customClass,
79      tip,
80      omit,
81      outcome,
82    }
83  
84    public String getFamily() {
85      return COMPONENT_FAMILY;
86    }
87  
88  
89    /**
90    Url to an image to display.
91  
92    */
93    public java.lang.String getImage() {
94      return (java.lang.String) getStateHelper().eval(PropertyKeys.image);
95    }
96  
97    public void setImage(java.lang.String image) {
98      getStateHelper().put(PropertyKeys.image, image);
99    }
100 
101   public org.apache.myfaces.tobago.context.Markup getMarkup() {
102     Object object = getStateHelper().eval(PropertyKeys.markup);
103     if (object != null) {
104       return Markup.valueOf(object);
105     }
106     return null;
107   }
108 
109   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
110     getStateHelper().put(PropertyKeys.markup, markup);
111   }
112 
113   /**
114   <p>
115    Link to an arbitrary URL, either an internal link or an external link. For internal URLs, a session id will be
116    added, if needed (when cookies disabled). The context path needs to be added manually e.g. #{request.contextPath}.
117    For JSF navigation to a viewId use the outcome attribute!
118    </p>
119 
120    <p>
121    The semantic of this attributes has been changed from Tobago 3 to 4!
122    </p>
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   */
202   public java.lang.String getTarget() {
203     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
204   }
205 
206   public void setTarget(java.lang.String target) {
207     getStateHelper().put(PropertyKeys.target, target);
208   }
209 
210   /**
211   The identifier of the page fragment which should
212    be brought into focus when the target page is
213    rendered. The value of this attribute is appended
214    to the end of target URL following a hash (#) mark.
215    This notation is part of the standard URL syntax.
216 
217   */
218   public java.lang.String getFragment() {
219     return (java.lang.String) getStateHelper().eval(PropertyKeys.fragment);
220   }
221 
222   public void setFragment(java.lang.String fragment) {
223     getStateHelper().put(PropertyKeys.fragment, fragment);
224   }
225 
226   /**
227   The access key of this control.
228 
229   */
230   public java.lang.Character getAccessKey() {
231     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
232   }
233 
234   public void setAccessKey(java.lang.Character accessKey) {
235     getStateHelper().put(PropertyKeys.accessKey, accessKey);
236   }
237 
238   /**
239   Sets a CSS class in its parent, if the parent supports it.
240 
241    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
242 
243    <pre>
244    &lt;tc:in&gt;
245      &lt;tc:style customClass="my-emphasized"/&gt;
246    &lt;/tc:in&gt;
247    </pre>
248 
249    One capability is, to used external CSS libs.
250    <br>
251    This feature should not be used imprudent.
252    Because it might be unstable against changes in the renderered HTML code.
253 
254   */
255   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
256     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
257   }
258 
259   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
260     getStateHelper().put(PropertyKeys.customClass, customClass);
261   }
262 
263   /**
264   Text value to display as tooltip.
265 
266   */
267   public java.lang.String getTip() {
268     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
269   }
270 
271   public void setTip(java.lang.String tip) {
272     getStateHelper().put(PropertyKeys.tip, tip);
273   }
274 
275   /**
276   Flag indicating that the action of this element, will not be executed from client side
277    (e. g. when the user clicks a button.
278    When setting this value to true, the action will not be executed by the Tobago, but it can executed
279    by JavaScript.
280    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
281    In this case you usually don't want a submit with a full reload of the page.
282   <br>Default: <code>false</code>
283   */
284   public boolean isOmit() {
285     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
286     if (bool != null) {
287       return bool;
288     }
289     return false;
290   }
291 
292   public void setOmit(boolean omit) {
293     getStateHelper().put(PropertyKeys.omit, omit);
294   }
295 
296   /**
297   Link to an internal facelet page, like the outcome of an action.
298    The context path will be added.
299    A session id will be added, if needed.
300 
301   */
302   public java.lang.String getOutcome() {
303     return (java.lang.String) getStateHelper().eval(PropertyKeys.outcome);
304   }
305 
306   public void setOutcome(java.lang.String outcome) {
307     getStateHelper().put(PropertyKeys.outcome, outcome);
308   }
309 
310 
311   @Override
312   public void restoreState(FacesContext context, Object state) {
313     // FIXME HACK for mojarra SystemEventListener state restoring bug
314     pushComponentToEL(context, this);
315     super.restoreState(context, state);
316     popComponentFromEL(context);
317   }
318 
319 }