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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 }