1 17 package org.alfresco.web.ui.common.component; 18 19 import java.util.HashMap ; 20 import java.util.Map ; 21 22 import javax.faces.component.UICommand; 23 import javax.faces.context.FacesContext; 24 import javax.faces.el.ValueBinding; 25 26 29 public class UIActionLink extends UICommand 30 { 31 34 37 public UIActionLink() 38 { 39 setRendererType("org.alfresco.faces.ActionLinkRenderer"); 40 } 41 42 43 46 49 public String getFamily() 50 { 51 return "org.alfresco.faces.Controls"; 52 } 53 54 57 public void restoreState(FacesContext context, Object state) 58 { 59 Object values[] = (Object [])state; 60 super.restoreState(context, values[0]); 62 this.padding = (Integer )values[1]; 63 this.image = (String )values[2]; 64 this.showLink = (Boolean )values[3]; 65 this.params = (Map )values[4]; 66 this.href = (String )values[5]; 67 this.tooltip = (String )values[6]; 68 this.target = (String )values[7]; 69 } 70 71 74 public Object saveState(FacesContext context) 75 { 76 Object values[] = new Object [8]; 77 values[0] = super.saveState(context); 79 values[1] = this.padding; 80 values[2] = this.image; 81 values[3] = this.showLink; 82 values[4] = this.params; 83 values[5] = this.href; 84 values[6] = this.tooltip; 85 values[7] = this.target; 86 return (values); 87 } 88 89 90 93 99 public Map <String , String > getParameterMap() 100 { 101 if (this.params == null) 102 { 103 this.params = new HashMap <String , String >(3, 1.0f); 104 } 105 return this.params; 106 } 107 108 113 public boolean getShowLink() 114 { 115 ValueBinding vb = getValueBinding("showLink"); 116 if (vb != null) 117 { 118 this.showLink = (Boolean )vb.getValue(getFacesContext()); 119 } 120 121 if (this.showLink != null) 122 { 123 return this.showLink.booleanValue(); 124 } 125 else 126 { 127 return true; 129 } 130 } 131 132 137 public void setShowLink(boolean showLink) 138 { 139 this.showLink = Boolean.valueOf(showLink); 140 } 141 142 147 public int getPadding() 148 { 149 ValueBinding vb = getValueBinding("padding"); 150 if (vb != null) 151 { 152 this.padding = (Integer )vb.getValue(getFacesContext()); 153 } 154 155 if (this.padding != null) 156 { 157 return this.padding.intValue(); 158 } 159 else 160 { 161 return 0; 163 } 164 } 165 166 171 public void setPadding(int padding) 172 { 173 this.padding = padding; 174 } 175 176 183 public String getImage() 184 { 185 ValueBinding vb = getValueBinding("image"); 186 if (vb != null) 187 { 188 this.image = (String )vb.getValue(getFacesContext()); 189 } 190 191 return this.image; 192 } 193 194 201 public void setImage(String image) 202 { 203 this.image = image; 204 } 205 206 209 public String getHref() 210 { 211 ValueBinding vb = getValueBinding("href"); 212 if (vb != null) 213 { 214 this.href = (String )vb.getValue(getFacesContext()); 215 } 216 217 return this.href; 218 } 219 220 223 public void setHref(String href) 224 { 225 this.href = href; 226 } 227 228 233 public String getTooltip() 234 { 235 ValueBinding vb = getValueBinding("tooltip"); 236 if (vb != null) 237 { 238 this.tooltip = (String )vb.getValue(getFacesContext()); 239 } 240 241 return this.tooltip; 242 } 243 244 249 public void setTooltip(String tooltip) 250 { 251 this.tooltip = tooltip; 252 } 253 254 259 public String getTarget() 260 { 261 ValueBinding vb = getValueBinding("target"); 262 if (vb != null) 263 { 264 this.target = (String )vb.getValue(getFacesContext()); 265 } 266 267 return this.target; 268 } 269 270 275 public void setTarget(String target) 276 { 277 this.target = target; 278 } 279 280 285 public String getOnclick() 286 { 287 ValueBinding vb = getValueBinding("onclick"); 288 if (vb != null) 289 { 290 this.onclick = (String )vb.getValue(getFacesContext()); 291 } 292 293 return this.onclick; 294 } 295 296 301 public void setOnclick(String onclick) 302 { 303 this.onclick = onclick; 304 } 305 306 307 310 311 private Integer padding = null; 312 313 314 private Boolean showLink = null; 315 316 317 private String image = null; 318 319 320 private String href = null; 321 322 323 private String tooltip = null; 324 325 326 private String target = null; 327 328 329 private String onclick = null; 330 331 332 private Map <String , String > params = null; 333 } 334 | Popular Tags |