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