001 // ---------- Attention: Generated code, please do not modify! ----------- 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with 006 * this work for additional information regarding copyright ownership. 007 * The ASF licenses this file to You under the Apache License, Version 2.0 008 * (the "License"); you may not use this file except in compliance with 009 * the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019 020 package org.apache.myfaces.tobago.component; 021 022 import javax.faces.context.FacesContext; 023 import org.apache.commons.lang.ArrayUtils; 024 import org.apache.commons.lang.StringUtils; 025 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression; 026 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding; 027 import org.apache.myfaces.tobago.internal.util.Deprecation; 028 import org.apache.myfaces.tobago.renderkit.MarginValues; 029 import org.apache.myfaces.tobago.renderkit.SpacingValues; 030 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer; 031 import javax.el.ELException; 032 import javax.faces.FacesException; 033 import java.util.ArrayList; 034 import java.util.List; 035 import javax.el.MethodExpression; 036 import javax.el.ValueExpression; 037 038 /** 039 Renders a link element. 040 * UIComponent class, generated from template {@code component1.2.stg} with class 041 * {@link org.apache.myfaces.tobago.internal.taglib.component.LinkTagDeclaration}. 042 */ 043 public class UILink 044 extends UICommand implements UILinkCommand { 045 046 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Link"; 047 048 private java.lang.Character accessKey; 049 private java.lang.String labelWithAccessKey; 050 private java.lang.Integer tabIndex; 051 private java.lang.String tip; 052 private java.lang.Boolean inline; 053 private java.lang.String image; 054 private java.lang.String label; 055 056 057 /** 058 Deprecated! Has not longer any function. 059 060 @deprecated*/ 061 @Deprecated 062 public java.lang.Character getAccessKey() { 063 if (accessKey != null) { 064 return accessKey; 065 } 066 ValueExpression ve = getValueExpression("accessKey"); 067 if (ve != null) { 068 try { 069 return (java.lang.Character) ve.getValue(getFacesContext().getELContext()); 070 } catch (ELException e) { 071 throw new FacesException(e); 072 } 073 } 074 return null; 075 } 076 077 @Deprecated 078 public void setAccessKey(java.lang.Character accessKey) { 079 this.accessKey = accessKey; 080 } 081 082 /** 083 Deprecated! Use 'label' instead. 084 Text value to display as label. 085 If text contains an underscore the next character overwrites 'accesskey'. 086 087 @deprecated*/ 088 @Deprecated 089 public java.lang.String getLabelWithAccessKey() { 090 if (labelWithAccessKey != null) { 091 return labelWithAccessKey; 092 } 093 ValueExpression ve = getValueExpression("labelWithAccessKey"); 094 if (ve != null) { 095 try { 096 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 097 } catch (ELException e) { 098 throw new FacesException(e); 099 } 100 } 101 return null; 102 } 103 104 @Deprecated 105 public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) { 106 this.labelWithAccessKey = labelWithAccessKey; 107 } 108 109 /** 110 Controls the navigation of the focus through the 111 input controls on a page with the Tab-Key. 112 The navigation starts from the element with 113 the lowest tabIndex value to the element with the highest value. 114 Elements that have identical tabIndex values should be navigated 115 in the order they appear in the character stream 116 Elements that are disabled or with a negative tabIndex 117 do not participate in the tabbing order. 118 119 */ 120 public java.lang.Integer getTabIndex() { 121 if (tabIndex != null) { 122 return tabIndex; 123 } 124 ValueExpression ve = getValueExpression("tabIndex"); 125 if (ve != null) { 126 try { 127 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 128 if (number != null) { 129 return number.intValue(); 130 } 131 } catch (ELException e) { 132 throw new FacesException(e); 133 } 134 } 135 return null; 136 } 137 138 public void setTabIndex(java.lang.Integer tabIndex) { 139 this.tabIndex = tabIndex; 140 } 141 142 /** 143 Text value to display as tooltip. 144 145 */ 146 public java.lang.String getTip() { 147 if (tip != null) { 148 return tip; 149 } 150 ValueExpression ve = getValueExpression("tip"); 151 if (ve != null) { 152 try { 153 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 154 } catch (ELException e) { 155 throw new FacesException(e); 156 } 157 } 158 return null; 159 } 160 161 public void setTip(java.lang.String tip) { 162 this.tip = tip; 163 } 164 165 /** 166 Flag indicating this component should rendered as an inline element. 167 <br />Default: <code>false</code> 168 */ 169 public boolean isInline() { 170 if (inline != null) { 171 return inline; 172 } 173 ValueExpression ve = getValueExpression("inline"); 174 if (ve != null) { 175 try { 176 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext()); 177 if (bool != null) { 178 return bool; 179 } 180 } catch (ELException e) { 181 throw new FacesException(e); 182 } 183 } 184 return false; 185 } 186 187 public void setInline(boolean inline) { 188 this.inline = inline; 189 } 190 191 /** 192 Url to an image to display. 193 194 */ 195 public java.lang.String getImage() { 196 if (image != null) { 197 return image; 198 } 199 ValueExpression ve = getValueExpression("image"); 200 if (ve != null) { 201 try { 202 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 203 } catch (ELException e) { 204 throw new FacesException(e); 205 } 206 } 207 return null; 208 } 209 210 public void setImage(java.lang.String image) { 211 this.image = image; 212 } 213 214 /** 215 Text value to display as label. 216 If text contains an underscore the next character is used as accesskey. 217 218 */ 219 public java.lang.String getLabel() { 220 if (label != null) { 221 return label; 222 } 223 ValueExpression ve = getValueExpression("label"); 224 if (ve != null) { 225 try { 226 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 227 } catch (ELException e) { 228 throw new FacesException(e); 229 } 230 } 231 return null; 232 } 233 234 public void setLabel(java.lang.String label) { 235 this.label = label; 236 } 237 238 public void restoreState(FacesContext context, Object componentState) { 239 Object[] values = (Object[]) componentState; 240 super.restoreState(context, values[0]); 241 accessKey = (java.lang.Character) values[1]; 242 labelWithAccessKey = (java.lang.String) values[2]; 243 tabIndex = (java.lang.Integer) values[3]; 244 tip = (java.lang.String) values[4]; 245 inline = (java.lang.Boolean) values[5]; 246 image = (java.lang.String) values[6]; 247 label = (java.lang.String) values[7]; 248 } 249 250 public Object saveState(FacesContext context) { 251 Object[] values = new Object[8]; 252 values[0] = super.saveState(context); 253 values[1] = accessKey; 254 values[2] = labelWithAccessKey; 255 values[3] = tabIndex; 256 values[4] = tip; 257 values[5] = inline; 258 values[6] = image; 259 values[7] = label; 260 return values; 261 } 262 263 264 }