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.ArrayList;
33  import java.util.List;
34  import javax.el.MethodExpression;
35  import javax.el.ValueExpression;
36  
37  /** 
38   Renders a link element.
39    * UIComponent class, generated from template {@code component.stg} with class
40    * {@link org.apache.myfaces.tobago.internal.taglib.component.LinkTagDeclaration}.
41   */
42  public class UILink
43      extends AbstractUILink implements SupportsAccessKey, Visual {
44  
45    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Link";
46  
47    public static final String COMPONENT_FAMILY = "javax.faces.Command";
48  
49  
50    enum PropertyKeys {
51      image,
52      markup,
53      resource,
54      link,
55      tabIndex,
56      confirmation,
57      label,
58      transition,
59      target,
60      jsfResource,
61      accessKey,
62      customClass,
63      style,
64      tip,
65      omit,
66    }
67  
68    public String getFamily() {
69      return COMPONENT_FAMILY;
70    }
71  
72  
73    /**
74    Url to an image to display.
75  
76    */
77    public java.lang.String getImage() {
78      return (java.lang.String) getStateHelper().eval(PropertyKeys.image);
79    }
80  
81    public void setImage(java.lang.String image) {
82      getStateHelper().put(PropertyKeys.image, image);
83    }
84  
85    public org.apache.myfaces.tobago.context.Markup getMarkup() {
86      Object object = getStateHelper().eval(PropertyKeys.markup);
87      if (object != null) {
88        return Markup.valueOf(object);
89      }
90      return null;
91    }
92  
93    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
94      getStateHelper().put(PropertyKeys.markup, markup);
95    }
96  
97    /**
98    Link to an internal resource.
99     Resources will be processed by the resource management.
100    E. g. define help.html and it will be served help_es.html or help_de.html if available.
101    For JSF-Pages you have to set the jsfResource attribute.
102 
103   */
104   public java.lang.String getResource() {
105     return (java.lang.String) getStateHelper().eval(PropertyKeys.resource);
106   }
107 
108   public void setResource(java.lang.String resource) {
109     getStateHelper().put(PropertyKeys.resource, resource);
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   Text value to display as label.
172    If text contains an underscore the next character is used as accesskey (if configured so and possible).
173 
174   */
175   public java.lang.String getLabel() {
176     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
177   }
178 
179   public void setLabel(java.lang.String label) {
180     getStateHelper().put(PropertyKeys.label, label);
181   }
182 
183   /**
184   Specify, if the command calls an JSF-Action.
185    Useful to switch off the Double-Submit-Check and Waiting-Behavior.
186   <br>Default: <code>true</code>
187   */
188   public boolean isTransition() {
189     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.transition);
190     if (bool != null) {
191       return bool;
192     }
193     return true;
194   }
195 
196   public void setTransition(boolean transition) {
197     getStateHelper().put(PropertyKeys.transition, transition);
198   }
199 
200   /**
201   Name of a frame where the resource retrieved via this hyperlink is to be
202    displayed.
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   Flag indicating that the resource referenced by the resource attribute is a jsf resource.
215    That means that the url has to be processed to change the prefix or suffix (e. g. *.jsf or
216    /faces/*). Default is false.
217   <br>Default: <code>false</code>
218   */
219   public boolean isJsfResource() {
220     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.jsfResource);
221     if (bool != null) {
222       return bool;
223     }
224     return false;
225   }
226 
227   public void setJsfResource(boolean jsfResource) {
228     getStateHelper().put(PropertyKeys.jsfResource, jsfResource);
229   }
230 
231   /**
232   The access key of this control.
233 
234   */
235   public java.lang.Character getAccessKey() {
236     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
237   }
238 
239   public void setAccessKey(java.lang.Character accessKey) {
240     getStateHelper().put(PropertyKeys.accessKey, accessKey);
241   }
242 
243   /**
244   Sets a CSS class in its parent, if the parent supports it.
245 
246    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
247 
248    <pre>
249    &lt;tc:in&gt;
250      &lt;tc:style customClass="my-emphasized"/&gt;
251    &lt;/tc:in&gt;
252    </pre>
253 
254    One capability is, to used external CSS libs.
255    <br>
256    This feature should not be used imprudent.
257    Because it might be unstable against changes in the renderered HTML code.
258 
259   */
260   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
261     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
262   }
263 
264   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
265     getStateHelper().put(PropertyKeys.customClass, customClass);
266   }
267 
268   /**
269   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
270 
271   */
272   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
273     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
274   }
275 
276   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
277     getStateHelper().put(PropertyKeys.style, style);
278   }
279 
280   /**
281   Text value to display as tooltip.
282 
283   */
284   public java.lang.String getTip() {
285     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
286   }
287 
288   public void setTip(java.lang.String tip) {
289     getStateHelper().put(PropertyKeys.tip, tip);
290   }
291 
292   /**
293   Flag indicating that the action of this element, will not be executed from client side
294    (e. g. when the user clicks a button.
295    When setting this value to true, the action will not be executed by the Tobago, but it can executed
296    by JavaScript.
297    This attribute is useful, when you want to add JavaScript event handlers to commands manually.
298    In this case you usually don't want a submit with a full reload of the page.
299   <br>Default: <code>false</code>
300   */
301   public boolean isOmit() {
302     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.omit);
303     if (bool != null) {
304       return bool;
305     }
306     return false;
307   }
308 
309   public void setOmit(boolean omit) {
310     getStateHelper().put(PropertyKeys.omit, omit);
311   }
312 
313 
314 }