View Javadoc

1   package org.rcfaces.core.component;
2   
3   import javax.faces.convert.Converter;
4   import org.rcfaces.core.internal.capability.IConvertValueHolder;
5   import org.rcfaces.core.internal.component.Properties;
6   import org.rcfaces.core.component.ButtonComponent;
7   import org.apache.commons.logging.Log;
8   import java.util.HashSet;
9   import java.lang.String;
10  import org.apache.commons.logging.LogFactory;
11  import java.util.Arrays;
12  import java.util.Set;
13  import javax.faces.context.FacesContext;
14  
15  /**
16   * <p>The hyperLink Component translates into a classic hyperlink and is a <A href="/comps/buttonComponent.html">button</A>.</p>
17   * <p>The hyperLink Component has the following capabilities :
18   * <ul>
19   * <li>Position &amp; Size</li>
20   * <li>Foreground &amp; Background Color</li>
21   * <li>Text, font &amp; image</li>
22   * <li>Help</li>
23   * <li>Visibility, Read-Only, Disabled</li>
24   * <li>Events Handling</li>
25   * </ul>
26   * </p>
27   * 
28   * 
29   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/HyperLinkComponent.html">hyperLink</a> renderer is link to the <a href="/jsdocs/index.html?f_hyperLink.html" target="_blank">f_hyperLink</a> javascript class. f_hyperLink extends f_input, fa_immediate, fa_value</p>
30   * 
31   * 
32   * <p>Table of component style classes : </p>
33   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
34   * <tbody >
35   * <tr style="text-align:left">
36   * <th  width="33%">Style Name</th>
37   * <th width="50%">Description</th>
38   * </tr>
39   * <tr id="pwsif0" style="text-align:left">
40   * <td  width="33%">f_hyperLink</td>
41   * <td  width="50%">Defines styles for the wrapper element of the component</td>
42   * </tr>
43   * </tbody>
44   * </table>
45   */
46  public class HyperLinkComponent extends ButtonComponent implements 
47  	IConvertValueHolder {
48  
49  	private static final Log LOG = LogFactory.getLog(HyperLinkComponent.class);
50  
51  	public static final String COMPONENT_TYPE="org.rcfaces.core.hyperLink";
52  
53  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(ButtonComponent.CAMELIA_ATTRIBUTES);
54  	static {
55  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"converter"}));
56  	}
57  
58  	public HyperLinkComponent() {
59  		setRendererType(COMPONENT_TYPE);
60  	}
61  
62  	public HyperLinkComponent(String componentId) {
63  		this();
64  		setId(componentId);
65  	}
66  
67  	public void setConverter(String converterId) {
68  
69  
70  			 setConverter(null, converterId);
71  		
72  	}
73  
74  	public void setConverter(FacesContext facesContext, String converterId) {
75  
76  
77  			if (facesContext==null) {
78  				facesContext=FacesContext.getCurrentInstance();
79  			}
80  			Converter converter = facesContext.getApplication().createConverter(converterId);
81              this.setConverter(converter);
82  		
83  	}
84  
85  	public void setConverter(Converter converter) {
86  
87  
88          	engine.setProperty("converter", converter);
89  		
90  	}
91  
92  	public Converter getConverter() {
93  
94  
95          	return (Converter)engine.getProperty("converter", null);
96  		
97  	}
98  
99  	public Converter getConverter(FacesContext facesContext) {
100 
101 
102         	return (Converter)engine.getProperty("converter", facesContext);
103 		
104 	}
105 
106 	public Object getLocalValue() {
107 
108 
109 		return engine.getLocalValue(Properties.VALUE);
110 		
111 	}
112 
113 	protected Set getCameliaFields() {
114 		return CAMELIA_ATTRIBUTES;
115 	}
116 }