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