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.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.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 link element.
41    * UIComponent class, generated from template {@code component.stg} with class
42    * {@link org.apache.myfaces.tobago.internal.taglib.component.LinkTagDeclaration}.
43   */
44  public class UILink
45      extends AbstractUILink implements SupportsAccessKey, Visual {
46  
47    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Link";
48  
49    public static final String COMPONENT_FAMILY = "javax.faces.Command";
50  
51    private static final Collection<String> EVENT_NAMES = Arrays.asList("click", "dblclick", "focus", "blur");
52  
53    @Override
54    public Collection<String> getEventNames() {
55      return EVENT_NAMES;
56    }
57  
58    @Override
59    public String getDefaultEventName() {
60      return "click";
61    }
62  
63  
64    enum PropertyKeys {
65      image,
66      markup,
67      link,
68      tabIndex,
69      confirmation,
70      label,
71      transition,
72      target,
73      accessKey,
74      customClass,
75      style,
76      tip,
77      omit,
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   */
201   public java.lang.String getTarget() {
202     return (java.lang.String) getStateHelper().eval(PropertyKeys.target);
203   }
204 
205   public void setTarget(java.lang.String target) {
206     getStateHelper().put(PropertyKeys.target, target);
207   }
208 
209   /**
210   The access key of this control.
211 
212   */
213   public java.lang.Character getAccessKey() {
214     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
215   }
216 
217   public void setAccessKey(java.lang.Character accessKey) {
218     getStateHelper().put(PropertyKeys.accessKey, accessKey);
219   }
220 
221   /**
222   Sets a CSS class in its parent, if the parent supports it.
223 
224    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
225 
226    <pre>
227    &lt;tc:in&gt;
228      &lt;tc:style customClass="my-emphasized"/&gt;
229    &lt;/tc:in&gt;
230    </pre>
231 
232    One capability is, to used external CSS libs.
233    <br>
234    This feature should not be used imprudent.
235    Because it might be unstable against changes in the renderered HTML code.
236 
237   */
238   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
239     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
240   }
241 
242   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
243     getStateHelper().put(PropertyKeys.customClass, customClass);
244   }
245 
246   /**
247   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
248 
249   */
250   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
251     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
252   }
253 
254   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
255     getStateHelper().put(PropertyKeys.style, style);
256   }
257 
258   /**
259   Text value to display as tooltip.
260 
261   */
262   public java.lang.String getTip() {
263     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
264   }
265 
266   public void setTip(java.lang.String tip) {
267     getStateHelper().put(PropertyKeys.tip, tip);
268   }
269 
270   /**
271   Flag indicating that the action of this element, will not be executed from client side
272    (e. g. when the user clicks a button.
273    When setting this value to true, the action will not be executed by the Tobago, but it can executed
274    by JavaScript.
275    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
276    In this case you usually don't want a submit with a full reload of the page.
277   <br>Default: <code>false</code>
278   */
279   public boolean isOmit() {
280     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
281     if (bool != null) {
282       return bool;
283     }
284     return false;
285   }
286 
287   public void setOmit(boolean omit) {
288     getStateHelper().put(PropertyKeys.omit, omit);
289   }
290 
291 
292 }