1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.component.iterator.ICardIterator;
4 import org.rcfaces.core.component.capability.ISelectionEventCapability;
5 import org.rcfaces.core.internal.component.Properties;
6 import org.rcfaces.core.internal.tools.CardBoxTools;
7 import java.lang.String;
8 import org.apache.commons.logging.LogFactory;
9 import org.rcfaces.core.internal.converter.AsyncRenderModeConverter;
10 import javax.faces.context.FacesContext;
11 import javax.faces.event.PhaseId;
12 import org.rcfaces.core.component.capability.IAsyncRenderModeCapability;
13 import org.rcfaces.core.internal.capability.IPreferencesSettings;
14 import javax.el.ValueExpression;
15 import org.rcfaces.core.internal.converter.AsyncDecodeModeConverter;
16 import java.util.HashSet;
17 import org.apache.commons.logging.Log;
18 import org.rcfaces.core.component.CardComponent;
19 import java.util.Set;
20 import java.util.Arrays;
21 import org.rcfaces.core.internal.capability.IVariableScopeCapability;
22 import org.rcfaces.core.component.AbstractInputComponent;
23 import org.rcfaces.core.component.capability.IAsyncDecodeModeCapability;
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 public class CardBoxComponent extends AbstractInputComponent implements
62 ISelectionEventCapability,
63 IAsyncRenderModeCapability,
64 IPreferencesSettings,
65 IVariableScopeCapability,
66 IAsyncDecodeModeCapability {
67
68 private static final Log LOG = LogFactory.getLog(CardBoxComponent.class);
69
70 public static final String COMPONENT_TYPE="org.rcfaces.core.cardBox";
71
72 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractInputComponent.CAMELIA_ATTRIBUTES);
73 static {
74 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"selectionListener","scopeSaveValue","scopeVar","scopeValue","asyncDecodeMode","asyncRenderMode","preferences"}));
75 }
76 protected static final String CAMELIA_VALUE_ALIAS="value";
77
78 public CardBoxComponent() {
79 setRendererType(COMPONENT_TYPE);
80 }
81
82 public CardBoxComponent(String componentId) {
83 this();
84 setId(componentId);
85 }
86
87 public ICardIterator listCards() {
88
89
90 return CardBoxTools.listCards(this);
91
92 }
93
94 public CardComponent getSelectedCard() {
95
96
97 return CardBoxTools.getSelectedCard(this);
98
99 }
100
101 public CardComponent getSelectedCard(FacesContext facesContext) {
102
103
104 return CardBoxTools.getSelectedCard(this);
105
106 }
107
108 public void select(CardComponent card) {
109
110
111 CardBoxTools.selectCard(this, card);
112
113 }
114
115 public void setAsyncRenderMode(String asyncRenderMode) {
116
117
118 setAsyncRenderMode(((Integer)AsyncRenderModeConverter.SINGLETON.getAsObject(null, this, asyncRenderMode)).intValue());
119
120 }
121
122 public void setAsyncDecodeMode(String asyncDecodeMode) {
123
124
125 setAsyncDecodeMode(((Integer)AsyncDecodeModeConverter.SINGLETON.getAsObject(null, this, asyncDecodeMode)).intValue());
126
127 }
128
129 protected boolean verifyAsyncDecode(FacesContext facesContext, PhaseId phaseId) {
130
131
132 return true;
133
134 }
135
136 public final void addSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
137 addFacesListener(listener);
138 }
139
140 public final void removeSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
141 removeFacesListener(listener);
142 }
143
144 public final javax.faces.event.FacesListener [] listSelectionListeners() {
145 return getFacesListeners(org.rcfaces.core.event.ISelectionListener.class);
146 }
147
148 public int getAsyncRenderMode() {
149 return getAsyncRenderMode(null);
150 }
151
152
153
154
155 public int getAsyncRenderMode(javax.faces.context.FacesContext facesContext) {
156 return engine.getIntProperty(Properties.ASYNC_RENDER_MODE,0, facesContext);
157 }
158
159
160
161
162
163 public final boolean isAsyncRenderModeSetted() {
164 return engine.isPropertySetted(Properties.ASYNC_RENDER_MODE);
165 }
166
167 public void setAsyncRenderMode(int asyncRenderMode) {
168 engine.setProperty(Properties.ASYNC_RENDER_MODE, asyncRenderMode);
169 }
170
171 public org.rcfaces.core.preference.IComponentPreferences getPreferences() {
172 return getPreferences(null);
173 }
174
175
176
177
178 public org.rcfaces.core.preference.IComponentPreferences getPreferences(javax.faces.context.FacesContext facesContext) {
179 return (org.rcfaces.core.preference.IComponentPreferences)engine.getProperty(Properties.PREFERENCES, facesContext);
180 }
181
182
183
184
185
186 public final boolean isPreferencesSetted() {
187 return engine.isPropertySetted(Properties.PREFERENCES);
188 }
189
190 public void setPreferences(org.rcfaces.core.preference.IComponentPreferences preferences) {
191 engine.setProperty(Properties.PREFERENCES, preferences);
192 }
193
194 public boolean isScopeSaveValue() {
195 return isScopeSaveValue(null);
196 }
197
198
199
200
201 public boolean isScopeSaveValue(javax.faces.context.FacesContext facesContext) {
202 return engine.getBoolProperty(Properties.SCOPE_SAVE_VALUE, false, facesContext);
203 }
204
205
206
207
208
209 public final boolean isScopeSaveValueSetted() {
210 return engine.isPropertySetted(Properties.SCOPE_SAVE_VALUE);
211 }
212
213 public void setScopeSaveValue(boolean scopeSaveValue) {
214 engine.setProperty(Properties.SCOPE_SAVE_VALUE, scopeSaveValue);
215 }
216
217 public java.lang.Object getScopeValue() {
218 return getScopeValue(null);
219 }
220
221
222
223
224 public java.lang.Object getScopeValue(javax.faces.context.FacesContext facesContext) {
225 return engine.getProperty(Properties.SCOPE_VALUE, facesContext);
226 }
227
228
229
230
231
232 public final boolean isScopeValueSetted() {
233 return engine.isPropertySetted(Properties.SCOPE_VALUE);
234 }
235
236 public void setScopeValue(java.lang.Object scopeValue) {
237 engine.setProperty(Properties.SCOPE_VALUE, scopeValue);
238 }
239
240 public java.lang.String getScopeVar() {
241 return getScopeVar(null);
242 }
243
244
245
246
247 public java.lang.String getScopeVar(javax.faces.context.FacesContext facesContext) {
248 return engine.getStringProperty(Properties.SCOPE_VAR, facesContext);
249 }
250
251
252
253
254
255 public final boolean isScopeVarSetted() {
256 return engine.isPropertySetted(Properties.SCOPE_VAR);
257 }
258
259 public void setScopeVar(java.lang.String scopeVar) {
260 engine.setProperty(Properties.SCOPE_VAR, scopeVar);
261 }
262
263 public int getAsyncDecodeMode() {
264 return getAsyncDecodeMode(null);
265 }
266
267
268
269
270 public int getAsyncDecodeMode(javax.faces.context.FacesContext facesContext) {
271 return engine.getIntProperty(Properties.ASYNC_DECODE_MODE,0, facesContext);
272 }
273
274
275
276
277
278 public final boolean isAsyncDecodeModeSetted() {
279 return engine.isPropertySetted(Properties.ASYNC_DECODE_MODE);
280 }
281
282 public void setAsyncDecodeMode(int asyncDecodeMode) {
283 engine.setProperty(Properties.ASYNC_DECODE_MODE, asyncDecodeMode);
284 }
285
286 protected Set getCameliaFields() {
287 return CAMELIA_ATTRIBUTES;
288 }
289
290 protected String getCameliaValueAlias() {
291 return CAMELIA_VALUE_ALIAS;
292 }
293 }