View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.internal.component.CameliaItemsComponent;
4   import org.rcfaces.core.internal.component.Properties;
5   import java.lang.Object;
6   import org.apache.commons.logging.LogFactory;
7   import java.lang.String;
8   import org.rcfaces.core.internal.manager.IClientDataManager;
9   import javax.faces.context.FacesContext;
10  import org.rcfaces.core.internal.component.IDataMapAccessor;
11  import org.rcfaces.core.internal.manager.IServerDataManager;
12  import org.rcfaces.core.internal.tools.SelectItemsIteratorTools;
13  import javax.faces.FacesException;
14  import javax.el.ValueExpression;
15  import java.util.HashSet;
16  import org.apache.commons.logging.Log;
17  import java.util.Set;
18  import java.util.Arrays;
19  
20  public class SelectItemsIteratorComponent extends CameliaItemsComponent implements 
21  	IClientDataManager,
22  	IServerDataManager {
23  
24  	private static final Log LOG = LogFactory.getLog(SelectItemsIteratorComponent.class);
25  
26  	public static final String COMPONENT_TYPE="org.rcfaces.core.selectItemsIterator";
27  
28  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaItemsComponent.CAMELIA_ATTRIBUTES);
29  	static {
30  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"itemImageURL","itemAcceleratorKey","var","itemHoverImageURL","itemVisibility","itemGroupName","itemExpandedImageURL","itemSelectedImageURL","itemDescription","itemIndexVar","items","itemLabel","itemValue","itemInputType","itemDisabledImageURL","itemAccessKey","itemStyleClass","itemDisabled"}));
31  	}
32  
33  	public SelectItemsIteratorComponent() {
34  		setRendererType(null);
35  	}
36  
37  	public SelectItemsIteratorComponent(String componentId) {
38  		this();
39  		setId(componentId);
40  	}
41  
42  	public void setClientData(String name, ValueExpression value) {
43  
44  
45  		IDataMapAccessor dataMapAccessor=engine.getDataMapAccessor(null, "clientData", true);
46              
47  		dataMapAccessor.setData(name, value, null);
48  		
49  	}
50  
51  	public String setClientData(String name, String value) {
52  
53  
54  		IDataMapAccessor dataMapAccessor=engine.getDataMapAccessor(null, "clientData", true);
55              
56  		return (String)dataMapAccessor.setData(name, value, null);
57  		
58  	}
59  
60  	public void setServerData(String name, ValueExpression value) {
61  
62  
63  		IDataMapAccessor dataMapAccessor=engine.getDataMapAccessor(null, "serverData", true);
64              
65  		dataMapAccessor.setData(name, value, null);
66  		
67  	}
68  
69  	public Object setServerData(String name, Object value) {
70  
71  
72  		IDataMapAccessor dataMapAccessor=engine.getDataMapAccessor(null, "serverData", true);
73              
74  		return dataMapAccessor.setData(name, value, null);
75  		
76  	}
77  
78  	public void setValue(Object value) {
79  
80  
81  			throw new FacesException("Can not set value of 'SelectItemsIterator', use 'items' attribute to set the collection.");
82  			
83  	}
84  
85  	public Object getValue() {
86  
87  
88  			return getValue(null);
89  			
90  	}
91  
92  	public Object getValue(FacesContext context) {
93  
94  
95  			return SelectItemsIteratorTools.getValue(this, context);
96  			
97  	}
98  
99  	public IDataMapAccessor getClientMapAccessor(FacesContext context) {
100 
101 
102 			return engine.getDataMapAccessor(context, "clientData", false);
103 			
104 	}
105 
106 	public IDataMapAccessor getServerMapAccessor(FacesContext context) {
107 
108 
109 			return engine.getDataMapAccessor(context, "serverData", false);
110 			
111 	}
112 
113 	public Object getItems() {
114 		return getItems(null);
115 	}
116 
117 	public Object getItems(javax.faces.context.FacesContext facesContext) {
118 		return engine.getValue(Properties.ITEMS, facesContext);
119 	}
120 
121 	public void setItems(Object items) {
122 		engine.setValue(Properties.ITEMS, items);
123 	}
124 
125 	/**
126 	 * Returns <code>true</code> if the attribute "items" is set.
127 	 * @return <code>true</code> if the attribute is set.
128 	 */
129 	public boolean isItemsSetted() {
130 		return engine.isPropertySetted(Properties.ITEMS);
131 	}
132 
133 	public String getVar() {
134 		return getVar(null);
135 	}
136 
137 	public String getVar(javax.faces.context.FacesContext facesContext) {
138 		return engine.getStringProperty(Properties.VAR, facesContext);
139 	}
140 
141 	public void setVar(String var) {
142 		engine.setProperty(Properties.VAR, var);
143 	}
144 
145 	/**
146 	 * Returns <code>true</code> if the attribute "var" is set.
147 	 * @return <code>true</code> if the attribute is set.
148 	 */
149 	public boolean isVarSetted() {
150 		return engine.isPropertySetted(Properties.VAR);
151 	}
152 
153 	public String getItemIndexVar() {
154 		return getItemIndexVar(null);
155 	}
156 
157 	public String getItemIndexVar(javax.faces.context.FacesContext facesContext) {
158 		return engine.getStringProperty(Properties.ITEM_INDEX_VAR, facesContext);
159 	}
160 
161 	public void setItemIndexVar(String itemIndexVar) {
162 		engine.setProperty(Properties.ITEM_INDEX_VAR, itemIndexVar);
163 	}
164 
165 	/**
166 	 * Returns <code>true</code> if the attribute "itemIndexVar" is set.
167 	 * @return <code>true</code> if the attribute is set.
168 	 */
169 	public boolean isItemIndexVarSetted() {
170 		return engine.isPropertySetted(Properties.ITEM_INDEX_VAR);
171 	}
172 
173 	public String getItemLabel() {
174 		return getItemLabel(null);
175 	}
176 
177 	public String getItemLabel(javax.faces.context.FacesContext facesContext) {
178 		return engine.getStringProperty(Properties.ITEM_LABEL, facesContext);
179 	}
180 
181 	public void setItemLabel(String itemLabel) {
182 		engine.setProperty(Properties.ITEM_LABEL, itemLabel);
183 	}
184 
185 	/**
186 	 * Returns <code>true</code> if the attribute "itemLabel" is set.
187 	 * @return <code>true</code> if the attribute is set.
188 	 */
189 	public boolean isItemLabelSetted() {
190 		return engine.isPropertySetted(Properties.ITEM_LABEL);
191 	}
192 
193 	public Object getItemValue() {
194 		return getItemValue(null);
195 	}
196 
197 	public Object getItemValue(javax.faces.context.FacesContext facesContext) {
198 		return engine.getValue(Properties.ITEM_VALUE, facesContext);
199 	}
200 
201 	public void setItemValue(Object itemValue) {
202 		engine.setValue(Properties.ITEM_VALUE, itemValue);
203 	}
204 
205 	/**
206 	 * Returns <code>true</code> if the attribute "itemValue" is set.
207 	 * @return <code>true</code> if the attribute is set.
208 	 */
209 	public boolean isItemValueSetted() {
210 		return engine.isPropertySetted(Properties.ITEM_VALUE);
211 	}
212 
213 	public boolean isItemDisabled() {
214 		return isItemDisabled(null);
215 	}
216 
217 	public boolean isItemDisabled(javax.faces.context.FacesContext facesContext) {
218 		return engine.getBoolProperty(Properties.ITEM_DISABLED, false, facesContext);
219 	}
220 
221 	public void setItemDisabled(boolean itemDisabled) {
222 		engine.setProperty(Properties.ITEM_DISABLED, itemDisabled);
223 	}
224 
225 	/**
226 	 * Returns <code>true</code> if the attribute "itemDisabled" is set.
227 	 * @return <code>true</code> if the attribute is set.
228 	 */
229 	public boolean isItemDisabledSetted() {
230 		return engine.isPropertySetted(Properties.ITEM_DISABLED);
231 	}
232 
233 	public String getItemDescription() {
234 		return getItemDescription(null);
235 	}
236 
237 	public String getItemDescription(javax.faces.context.FacesContext facesContext) {
238 		return engine.getStringProperty(Properties.ITEM_DESCRIPTION, facesContext);
239 	}
240 
241 	public void setItemDescription(String itemDescription) {
242 		engine.setProperty(Properties.ITEM_DESCRIPTION, itemDescription);
243 	}
244 
245 	/**
246 	 * Returns <code>true</code> if the attribute "itemDescription" is set.
247 	 * @return <code>true</code> if the attribute is set.
248 	 */
249 	public boolean isItemDescriptionSetted() {
250 		return engine.isPropertySetted(Properties.ITEM_DESCRIPTION);
251 	}
252 
253 	public String getItemAccessKey() {
254 		return getItemAccessKey(null);
255 	}
256 
257 	public String getItemAccessKey(javax.faces.context.FacesContext facesContext) {
258 		return engine.getStringProperty(Properties.ITEM_ACCESS_KEY, facesContext);
259 	}
260 
261 	public void setItemAccessKey(String itemAccessKey) {
262 		engine.setProperty(Properties.ITEM_ACCESS_KEY, itemAccessKey);
263 	}
264 
265 	/**
266 	 * Returns <code>true</code> if the attribute "itemAccessKey" is set.
267 	 * @return <code>true</code> if the attribute is set.
268 	 */
269 	public boolean isItemAccessKeySetted() {
270 		return engine.isPropertySetted(Properties.ITEM_ACCESS_KEY);
271 	}
272 
273 	public String getItemAcceleratorKey() {
274 		return getItemAcceleratorKey(null);
275 	}
276 
277 	public String getItemAcceleratorKey(javax.faces.context.FacesContext facesContext) {
278 		return engine.getStringProperty(Properties.ITEM_ACCELERATOR_KEY, facesContext);
279 	}
280 
281 	public void setItemAcceleratorKey(String itemAcceleratorKey) {
282 		engine.setProperty(Properties.ITEM_ACCELERATOR_KEY, itemAcceleratorKey);
283 	}
284 
285 	/**
286 	 * Returns <code>true</code> if the attribute "itemAcceleratorKey" is set.
287 	 * @return <code>true</code> if the attribute is set.
288 	 */
289 	public boolean isItemAcceleratorKeySetted() {
290 		return engine.isPropertySetted(Properties.ITEM_ACCELERATOR_KEY);
291 	}
292 
293 	public String getItemGroupName() {
294 		return getItemGroupName(null);
295 	}
296 
297 	public String getItemGroupName(javax.faces.context.FacesContext facesContext) {
298 		return engine.getStringProperty(Properties.ITEM_GROUP_NAME, facesContext);
299 	}
300 
301 	public void setItemGroupName(String itemGroupName) {
302 		engine.setProperty(Properties.ITEM_GROUP_NAME, itemGroupName);
303 	}
304 
305 	/**
306 	 * Returns <code>true</code> if the attribute "itemGroupName" is set.
307 	 * @return <code>true</code> if the attribute is set.
308 	 */
309 	public boolean isItemGroupNameSetted() {
310 		return engine.isPropertySetted(Properties.ITEM_GROUP_NAME);
311 	}
312 
313 	public String getItemInputType() {
314 		return getItemInputType(null);
315 	}
316 
317 	public String getItemInputType(javax.faces.context.FacesContext facesContext) {
318 		return engine.getStringProperty(Properties.ITEM_INPUT_TYPE, facesContext);
319 	}
320 
321 	public void setItemInputType(String itemInputType) {
322 		engine.setProperty(Properties.ITEM_INPUT_TYPE, itemInputType);
323 	}
324 
325 	/**
326 	 * Returns <code>true</code> if the attribute "itemInputType" is set.
327 	 * @return <code>true</code> if the attribute is set.
328 	 */
329 	public boolean isItemInputTypeSetted() {
330 		return engine.isPropertySetted(Properties.ITEM_INPUT_TYPE);
331 	}
332 
333 	public String getItemStyleClass() {
334 		return getItemStyleClass(null);
335 	}
336 
337 	public String getItemStyleClass(javax.faces.context.FacesContext facesContext) {
338 		return engine.getStringProperty(Properties.ITEM_STYLE_CLASS, facesContext);
339 	}
340 
341 	public void setItemStyleClass(String itemStyleClass) {
342 		engine.setProperty(Properties.ITEM_STYLE_CLASS, itemStyleClass);
343 	}
344 
345 	/**
346 	 * Returns <code>true</code> if the attribute "itemStyleClass" is set.
347 	 * @return <code>true</code> if the attribute is set.
348 	 */
349 	public boolean isItemStyleClassSetted() {
350 		return engine.isPropertySetted(Properties.ITEM_STYLE_CLASS);
351 	}
352 
353 	public String getItemImageURL() {
354 		return getItemImageURL(null);
355 	}
356 
357 	public String getItemImageURL(javax.faces.context.FacesContext facesContext) {
358 		return engine.getStringProperty(Properties.ITEM_IMAGE_URL, facesContext);
359 	}
360 
361 	public void setItemImageURL(String itemImageURL) {
362 		engine.setProperty(Properties.ITEM_IMAGE_URL, itemImageURL);
363 	}
364 
365 	/**
366 	 * Returns <code>true</code> if the attribute "itemImageURL" is set.
367 	 * @return <code>true</code> if the attribute is set.
368 	 */
369 	public boolean isItemImageURLSetted() {
370 		return engine.isPropertySetted(Properties.ITEM_IMAGE_URL);
371 	}
372 
373 	public String getItemDisabledImageURL() {
374 		return getItemDisabledImageURL(null);
375 	}
376 
377 	public String getItemDisabledImageURL(javax.faces.context.FacesContext facesContext) {
378 		return engine.getStringProperty(Properties.ITEM_DISABLED_IMAGE_URL, facesContext);
379 	}
380 
381 	public void setItemDisabledImageURL(String itemDisabledImageURL) {
382 		engine.setProperty(Properties.ITEM_DISABLED_IMAGE_URL, itemDisabledImageURL);
383 	}
384 
385 	/**
386 	 * Returns <code>true</code> if the attribute "itemDisabledImageURL" is set.
387 	 * @return <code>true</code> if the attribute is set.
388 	 */
389 	public boolean isItemDisabledImageURLSetted() {
390 		return engine.isPropertySetted(Properties.ITEM_DISABLED_IMAGE_URL);
391 	}
392 
393 	public String getItemHoverImageURL() {
394 		return getItemHoverImageURL(null);
395 	}
396 
397 	public String getItemHoverImageURL(javax.faces.context.FacesContext facesContext) {
398 		return engine.getStringProperty(Properties.ITEM_HOVER_IMAGE_URL, facesContext);
399 	}
400 
401 	public void setItemHoverImageURL(String itemHoverImageURL) {
402 		engine.setProperty(Properties.ITEM_HOVER_IMAGE_URL, itemHoverImageURL);
403 	}
404 
405 	/**
406 	 * Returns <code>true</code> if the attribute "itemHoverImageURL" is set.
407 	 * @return <code>true</code> if the attribute is set.
408 	 */
409 	public boolean isItemHoverImageURLSetted() {
410 		return engine.isPropertySetted(Properties.ITEM_HOVER_IMAGE_URL);
411 	}
412 
413 	public String getItemSelectedImageURL() {
414 		return getItemSelectedImageURL(null);
415 	}
416 
417 	public String getItemSelectedImageURL(javax.faces.context.FacesContext facesContext) {
418 		return engine.getStringProperty(Properties.ITEM_SELECTED_IMAGE_URL, facesContext);
419 	}
420 
421 	public void setItemSelectedImageURL(String itemSelectedImageURL) {
422 		engine.setProperty(Properties.ITEM_SELECTED_IMAGE_URL, itemSelectedImageURL);
423 	}
424 
425 	/**
426 	 * Returns <code>true</code> if the attribute "itemSelectedImageURL" is set.
427 	 * @return <code>true</code> if the attribute is set.
428 	 */
429 	public boolean isItemSelectedImageURLSetted() {
430 		return engine.isPropertySetted(Properties.ITEM_SELECTED_IMAGE_URL);
431 	}
432 
433 	public String getItemExpandedImageURL() {
434 		return getItemExpandedImageURL(null);
435 	}
436 
437 	public String getItemExpandedImageURL(javax.faces.context.FacesContext facesContext) {
438 		return engine.getStringProperty(Properties.ITEM_EXPANDED_IMAGE_URL, facesContext);
439 	}
440 
441 	public void setItemExpandedImageURL(String itemExpandedImageURL) {
442 		engine.setProperty(Properties.ITEM_EXPANDED_IMAGE_URL, itemExpandedImageURL);
443 	}
444 
445 	/**
446 	 * Returns <code>true</code> if the attribute "itemExpandedImageURL" is set.
447 	 * @return <code>true</code> if the attribute is set.
448 	 */
449 	public boolean isItemExpandedImageURLSetted() {
450 		return engine.isPropertySetted(Properties.ITEM_EXPANDED_IMAGE_URL);
451 	}
452 
453 	public boolean isItemVisibility() {
454 		return isItemVisibility(null);
455 	}
456 
457 	public boolean isItemVisibility(javax.faces.context.FacesContext facesContext) {
458 		return engine.getBoolProperty(Properties.ITEM_VISIBILITY, false, facesContext);
459 	}
460 
461 	public void setItemVisibility(boolean itemVisibility) {
462 		engine.setProperty(Properties.ITEM_VISIBILITY, itemVisibility);
463 	}
464 
465 	/**
466 	 * Returns <code>true</code> if the attribute "itemVisibility" is set.
467 	 * @return <code>true</code> if the attribute is set.
468 	 */
469 	public boolean isItemVisibilitySetted() {
470 		return engine.isPropertySetted(Properties.ITEM_VISIBILITY);
471 	}
472 
473 	protected Set getCameliaFields() {
474 		return CAMELIA_ATTRIBUTES;
475 	}
476 }