1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.internal.component.Properties;
4 import org.rcfaces.core.component.capability.ISuggestionEventCapability;
5 import java.lang.String;
6 import org.apache.commons.logging.LogFactory;
7 import javax.faces.context.FacesContext;
8 import org.rcfaces.core.component.TextEntryComponent;
9 import org.rcfaces.core.component.capability.IMaxResultNumberCapability;
10 import javax.faces.convert.Converter;
11 import org.rcfaces.core.internal.converter.FilterPropertiesConverter;
12 import javax.el.ValueExpression;
13 import java.util.HashSet;
14 import org.apache.commons.logging.Log;
15 import org.rcfaces.core.component.capability.IFilterCapability;
16 import org.rcfaces.core.model.IFilterProperties;
17 import java.util.Set;
18 import java.util.Arrays;
19 import org.rcfaces.core.component.capability.IMenuEventCapability;
20 import org.rcfaces.core.internal.tools.ComponentTools;
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
47
48
49
50
51
52 public class SuggestTextEntryComponent extends TextEntryComponent implements
53 IFilterCapability,
54 IMaxResultNumberCapability,
55 ISuggestionEventCapability,
56 IMenuEventCapability {
57
58 private static final Log LOG = LogFactory.getLog(SuggestTextEntryComponent.class);
59
60 public static final String COMPONENT_TYPE="org.rcfaces.core.suggestTextEntry";
61
62 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(TextEntryComponent.CAMELIA_ATTRIBUTES);
63 static {
64 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"filterProperties","suggestionListener","suggestionConverter","suggestionMinChars","menuListener","maxResultNumber","orderedItems","caseSensitive","suggestionDelayMs","suggestionValue","forceProposal","moreResultsMessage"}));
65 }
66
67 public SuggestTextEntryComponent() {
68 setRendererType(COMPONENT_TYPE);
69 }
70
71 public SuggestTextEntryComponent(String componentId) {
72 this();
73 setId(componentId);
74 }
75
76 public void setSuggestionConverter(String converterId) {
77
78
79 setSuggestionConverter(converterId, null);
80
81 }
82
83 public void setSuggestionConverter(String converterId, FacesContext facesContext) {
84
85
86 Converter converter=ComponentTools.createConverter(facesContext, converterId);
87
88 setSuggestionConverter(converter);
89
90 }
91
92 public void setFilterProperties(String properties) {
93
94
95 IFilterProperties filterProperties=(IFilterProperties)FilterPropertiesConverter.SINGLETON.getAsObject(null, this, properties);
96
97 setFilterProperties(filterProperties);
98
99 }
100
101 public org.rcfaces.core.model.IFilterProperties getFilterProperties() {
102 return getFilterProperties(null);
103 }
104
105
106
107
108 public org.rcfaces.core.model.IFilterProperties getFilterProperties(javax.faces.context.FacesContext facesContext) {
109 return (org.rcfaces.core.model.IFilterProperties)engine.getProperty(Properties.FILTER_PROPERTIES, facesContext);
110 }
111
112
113
114
115
116 public final boolean isFilterPropertiesSetted() {
117 return engine.isPropertySetted(Properties.FILTER_PROPERTIES);
118 }
119
120 public void setFilterProperties(org.rcfaces.core.model.IFilterProperties filterProperties) {
121 engine.setProperty(Properties.FILTER_PROPERTIES, filterProperties);
122 }
123
124 public int getMaxResultNumber() {
125 return getMaxResultNumber(null);
126 }
127
128
129
130
131 public int getMaxResultNumber(javax.faces.context.FacesContext facesContext) {
132 return engine.getIntProperty(Properties.MAX_RESULT_NUMBER,0, facesContext);
133 }
134
135
136
137
138
139 public final boolean isMaxResultNumberSetted() {
140 return engine.isPropertySetted(Properties.MAX_RESULT_NUMBER);
141 }
142
143 public void setMaxResultNumber(int maxResultNumber) {
144 engine.setProperty(Properties.MAX_RESULT_NUMBER, maxResultNumber);
145 }
146
147 public final void addSuggestionListener(org.rcfaces.core.event.ISuggestionListener listener) {
148 addFacesListener(listener);
149 }
150
151 public final void removeSuggestionListener(org.rcfaces.core.event.ISuggestionListener listener) {
152 removeFacesListener(listener);
153 }
154
155 public final javax.faces.event.FacesListener [] listSuggestionListeners() {
156 return getFacesListeners(org.rcfaces.core.event.ISuggestionListener.class);
157 }
158
159 public final void addMenuListener(org.rcfaces.core.event.IMenuListener listener) {
160 addFacesListener(listener);
161 }
162
163 public final void removeMenuListener(org.rcfaces.core.event.IMenuListener listener) {
164 removeFacesListener(listener);
165 }
166
167 public final javax.faces.event.FacesListener [] listMenuListeners() {
168 return getFacesListeners(org.rcfaces.core.event.IMenuListener.class);
169 }
170
171
172
173
174
175 public int getSuggestionDelayMs() {
176 return getSuggestionDelayMs(null);
177 }
178
179
180
181
182
183 public int getSuggestionDelayMs(javax.faces.context.FacesContext facesContext) {
184 return engine.getIntProperty(Properties.SUGGESTION_DELAY_MS, 0, facesContext);
185 }
186
187
188
189
190
191 public void setSuggestionDelayMs(int suggestionDelayMs) {
192 engine.setProperty(Properties.SUGGESTION_DELAY_MS, suggestionDelayMs);
193 }
194
195
196
197
198
199
200
201
202
203 public boolean isSuggestionDelayMsSetted() {
204 return engine.isPropertySetted(Properties.SUGGESTION_DELAY_MS);
205 }
206
207
208
209
210
211 public int getSuggestionMinChars() {
212 return getSuggestionMinChars(null);
213 }
214
215
216
217
218
219 public int getSuggestionMinChars(javax.faces.context.FacesContext facesContext) {
220 return engine.getIntProperty(Properties.SUGGESTION_MIN_CHARS, 0, facesContext);
221 }
222
223
224
225
226
227 public void setSuggestionMinChars(int suggestionMinChars) {
228 engine.setProperty(Properties.SUGGESTION_MIN_CHARS, suggestionMinChars);
229 }
230
231
232
233
234
235
236
237
238
239 public boolean isSuggestionMinCharsSetted() {
240 return engine.isPropertySetted(Properties.SUGGESTION_MIN_CHARS);
241 }
242
243
244
245
246
247 public boolean isCaseSensitive() {
248 return isCaseSensitive(null);
249 }
250
251
252
253
254
255 public boolean isCaseSensitive(javax.faces.context.FacesContext facesContext) {
256 return engine.getBoolProperty(Properties.CASE_SENSITIVE, false, facesContext);
257 }
258
259
260
261
262
263 public void setCaseSensitive(boolean caseSensitive) {
264 engine.setProperty(Properties.CASE_SENSITIVE, caseSensitive);
265 }
266
267
268
269
270
271
272
273
274
275 public boolean isCaseSensitiveSetted() {
276 return engine.isPropertySetted(Properties.CASE_SENSITIVE);
277 }
278
279
280
281
282
283 public boolean isForceProposal() {
284 return isForceProposal(null);
285 }
286
287
288
289
290
291 public boolean isForceProposal(javax.faces.context.FacesContext facesContext) {
292 return engine.getBoolProperty(Properties.FORCE_PROPOSAL, false, facesContext);
293 }
294
295
296
297
298
299 public void setForceProposal(boolean forceProposal) {
300 engine.setProperty(Properties.FORCE_PROPOSAL, forceProposal);
301 }
302
303
304
305
306
307
308
309
310
311 public boolean isForceProposalSetted() {
312 return engine.isPropertySetted(Properties.FORCE_PROPOSAL);
313 }
314
315
316
317
318
319 public Object getSuggestionValue() {
320 return getSuggestionValue(null);
321 }
322
323
324
325
326
327 public Object getSuggestionValue(javax.faces.context.FacesContext facesContext) {
328 return engine.getValue(Properties.SUGGESTION_VALUE, facesContext);
329 }
330
331
332
333
334
335 public void setSuggestionValue(Object suggestionValue) {
336 engine.setValue(Properties.SUGGESTION_VALUE, suggestionValue);
337 }
338
339
340
341
342
343
344
345
346
347 public boolean isSuggestionValueSetted() {
348 return engine.isPropertySetted(Properties.SUGGESTION_VALUE);
349 }
350
351
352
353
354
355 public javax.faces.convert.Converter getSuggestionConverter() {
356 return getSuggestionConverter(null);
357 }
358
359
360
361
362
363 public javax.faces.convert.Converter getSuggestionConverter(javax.faces.context.FacesContext facesContext) {
364 return (javax.faces.convert.Converter)engine.getValue(Properties.SUGGESTION_CONVERTER, facesContext);
365 }
366
367
368
369
370
371 public void setSuggestionConverter(javax.faces.convert.Converter suggestionConverter) {
372 engine.setProperty(Properties.SUGGESTION_CONVERTER, suggestionConverter);
373 }
374
375
376
377
378
379
380
381
382
383 public boolean isSuggestionConverterSetted() {
384 return engine.isPropertySetted(Properties.SUGGESTION_CONVERTER);
385 }
386
387 public String getMoreResultsMessage() {
388 return getMoreResultsMessage(null);
389 }
390
391 public String getMoreResultsMessage(javax.faces.context.FacesContext facesContext) {
392 return engine.getStringProperty(Properties.MORE_RESULTS_MESSAGE, facesContext);
393 }
394
395 public void setMoreResultsMessage(String moreResultsMessage) {
396 engine.setProperty(Properties.MORE_RESULTS_MESSAGE, moreResultsMessage);
397 }
398
399
400
401
402
403 public boolean isMoreResultsMessageSetted() {
404 return engine.isPropertySetted(Properties.MORE_RESULTS_MESSAGE);
405 }
406
407 public boolean isOrderedItems() {
408 return isOrderedItems(null);
409 }
410
411 public boolean isOrderedItems(javax.faces.context.FacesContext facesContext) {
412 return engine.getBoolProperty(Properties.ORDERED_ITEMS, true, facesContext);
413 }
414
415 public void setOrderedItems(boolean orderedItems) {
416 engine.setProperty(Properties.ORDERED_ITEMS, orderedItems);
417 }
418
419
420
421
422
423 public boolean isOrderedItemsSetted() {
424 return engine.isPropertySetted(Properties.ORDERED_ITEMS);
425 }
426
427 protected Set getCameliaFields() {
428 return CAMELIA_ATTRIBUTES;
429 }
430 }