1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.component.capability.IImmediateCapability;
4 import org.rcfaces.core.internal.component.Properties;
5 import javax.el.ValueExpression;
6 import org.apache.commons.logging.Log;
7 import java.util.HashSet;
8 import org.rcfaces.core.component.capability.IKeyPressEventCapability;
9 import org.apache.commons.logging.LogFactory;
10 import java.util.Arrays;
11 import java.util.Set;
12 import org.rcfaces.core.component.capability.IForCapability;
13 import org.rcfaces.core.component.capability.IValidationEventCapability;
14 import org.rcfaces.core.internal.component.CameliaCommandComponent;
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 public class AcceleratorComponent extends CameliaCommandComponent implements
32 IKeyPressEventCapability,
33 IImmediateCapability,
34 IValidationEventCapability,
35 IForCapability {
36
37 private static final Log LOG = LogFactory.getLog(AcceleratorComponent.class);
38
39 public static final String COMPONENT_TYPE="org.rcfaces.core.accelerator";
40
41 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaCommandComponent.CAMELIA_ATTRIBUTES);
42 static {
43 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"immediate","forItemValue","for","keyBinding","keyPressListener","ignoreEditableComponent","validationListener"}));
44 }
45
46 public AcceleratorComponent() {
47 setRendererType(COMPONENT_TYPE);
48 }
49
50 public AcceleratorComponent(String componentId) {
51 this();
52 setId(componentId);
53 }
54
55 public final void addKeyPressListener(org.rcfaces.core.event.IKeyPressListener listener) {
56 addFacesListener(listener);
57 }
58
59 public final void removeKeyPressListener(org.rcfaces.core.event.IKeyPressListener listener) {
60 removeFacesListener(listener);
61 }
62
63 public final javax.faces.event.FacesListener [] listKeyPressListeners() {
64 return getFacesListeners(org.rcfaces.core.event.IKeyPressListener.class);
65 }
66
67 public final void addValidationListener(org.rcfaces.core.event.IValidationListener listener) {
68 addFacesListener(listener);
69 }
70
71 public final void removeValidationListener(org.rcfaces.core.event.IValidationListener listener) {
72 removeFacesListener(listener);
73 }
74
75 public final javax.faces.event.FacesListener [] listValidationListeners() {
76 return getFacesListeners(org.rcfaces.core.event.IValidationListener.class);
77 }
78
79 public java.lang.String getFor() {
80 return getFor(null);
81 }
82
83
84
85
86 public java.lang.String getFor(javax.faces.context.FacesContext facesContext) {
87 return engine.getStringProperty(Properties.FOR, facesContext);
88 }
89
90
91
92
93
94 public final boolean isForSetted() {
95 return engine.isPropertySetted(Properties.FOR);
96 }
97
98 public void setFor(java.lang.String forValue) {
99 engine.setProperty(Properties.FOR, forValue);
100 }
101
102
103
104
105
106 public String getForItemValue() {
107 return getForItemValue(null);
108 }
109
110
111
112
113
114 public String getForItemValue(javax.faces.context.FacesContext facesContext) {
115 return engine.getStringProperty(Properties.FOR_ITEM_VALUE, facesContext);
116 }
117
118
119
120
121
122 public void setForItemValue(String forItemValue) {
123 engine.setProperty(Properties.FOR_ITEM_VALUE, forItemValue);
124 }
125
126
127
128
129
130
131
132
133
134 public boolean isForItemValueSetted() {
135 return engine.isPropertySetted(Properties.FOR_ITEM_VALUE);
136 }
137
138
139
140
141
142 public String getKeyBinding() {
143 return getKeyBinding(null);
144 }
145
146
147
148
149
150 public String getKeyBinding(javax.faces.context.FacesContext facesContext) {
151 return engine.getStringProperty(Properties.KEY_BINDING, facesContext);
152 }
153
154
155
156
157
158 public void setKeyBinding(String keyBinding) {
159 engine.setProperty(Properties.KEY_BINDING, keyBinding);
160 }
161
162
163
164
165
166
167
168
169
170 public boolean isKeyBindingSetted() {
171 return engine.isPropertySetted(Properties.KEY_BINDING);
172 }
173
174 public boolean isIgnoreEditableComponent() {
175 return isIgnoreEditableComponent(null);
176 }
177
178 public boolean isIgnoreEditableComponent(javax.faces.context.FacesContext facesContext) {
179 return engine.getBoolProperty(Properties.IGNORE_EDITABLE_COMPONENT, false, facesContext);
180 }
181
182 public void setIgnoreEditableComponent(boolean ignoreEditableComponent) {
183 engine.setProperty(Properties.IGNORE_EDITABLE_COMPONENT, ignoreEditableComponent);
184 }
185
186
187
188
189
190 public boolean isIgnoreEditableComponentSetted() {
191 return engine.isPropertySetted(Properties.IGNORE_EDITABLE_COMPONENT);
192 }
193
194 protected Set getCameliaFields() {
195 return CAMELIA_ATTRIBUTES;
196 }
197 }