1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.component.iterator.IMenuIterator;
4 import javax.faces.component.NamingContainer;
5 import org.rcfaces.core.internal.component.Properties;
6 import org.apache.commons.logging.LogFactory;
7 import org.rcfaces.core.component.ToolBarComponent;
8 import org.rcfaces.core.component.capability.IShowDropDownMarkCapability;
9 import org.rcfaces.core.component.IMenuComponent;
10 import org.rcfaces.core.component.capability.IReadOnlyCapability;
11 import org.apache.commons.logging.Log;
12 import java.util.Set;
13 import org.rcfaces.core.component.capability.IInitEventCapability;
14 import org.rcfaces.core.component.capability.IDoubleClickEventCapability;
15 import org.rcfaces.core.internal.tools.CheckTools;
16 import org.rcfaces.core.component.capability.ISelectionEventCapability;
17 import org.rcfaces.core.component.capability.ICheckedValuesCapability;
18 import java.lang.String;
19 import org.rcfaces.core.internal.tools.MenuTools;
20 import org.rcfaces.core.component.capability.IHorizontalTextPositionCapability;
21 import org.rcfaces.core.component.capability.IBorderTypeCapability;
22 import javax.faces.convert.Converter;
23 import org.rcfaces.core.component.capability.ICheckEventCapability;
24 import org.rcfaces.core.component.capability.IMouseEventCapability;
25 import javax.el.ValueExpression;
26 import org.rcfaces.core.component.capability.ITextPositionCapability;
27 import org.rcfaces.core.component.capability.IDisabledCapability;
28 import java.util.HashSet;
29 import org.rcfaces.core.internal.tools.ToolBarTools;
30 import java.util.Arrays;
31 import org.rcfaces.core.internal.converter.HiddenModeConverter;
32 import org.rcfaces.core.component.AbstractInputComponent;
33 import org.rcfaces.core.component.capability.IMenuCapability;
34 import org.rcfaces.core.internal.converter.TextPositionConverter;
35 import org.rcfaces.core.component.capability.IVerticalAlignmentCapability;
36
37 public class ItemsToolFolderComponent extends AbstractInputComponent implements
38 IInitEventCapability,
39 IMenuCapability,
40 IMouseEventCapability,
41 IDoubleClickEventCapability,
42 ITextPositionCapability,
43 IBorderTypeCapability,
44 ISelectionEventCapability,
45 ICheckEventCapability,
46 ICheckedValuesCapability,
47 IDisabledCapability,
48 IReadOnlyCapability,
49 IVerticalAlignmentCapability,
50 IShowDropDownMarkCapability,
51 NamingContainer {
52
53 private static final Log LOG = LogFactory.getLog(ItemsToolFolderComponent.class);
54
55 public static final String COMPONENT_TYPE="org.rcfaces.core.itemsToolFolder";
56
57 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractInputComponent.CAMELIA_ATTRIBUTES);
58 static {
59 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"checkListener","defaultItemLookId","itemHiddenMode","textPosition","borderType","showDropDownMark","doubleClickListener","initListener","checkedValues","selectionListener","verticalAlignment","readOnly","mouseOverListener","defaultItemStyleClass","mouseOutListener","disabled"}));
60 }
61
62 public ItemsToolFolderComponent() {
63 setRendererType(COMPONENT_TYPE);
64 }
65
66 public ItemsToolFolderComponent(String componentId) {
67 this();
68 setId(componentId);
69 }
70
71 public void setItemHiddenMode(String hiddenMode) {
72
73
74 setItemHiddenMode(((Integer)HiddenModeConverter.SINGLETON.getAsObject(null, this, hiddenMode)).intValue());
75
76 }
77
78 protected Converter getTextPositionConverter() {
79
80
81 return TextPositionConverter.SINGLETON;
82
83 }
84
85 public void setTextPosition(String textPosition) {
86
87
88 setTextPosition(((Integer)getTextPositionConverter().getAsObject(null, this, textPosition)).intValue());
89
90 }
91
92 public ToolBarComponent getToolBar() {
93
94
95 return (ToolBarComponent)getParent();
96
97 }
98
99 public IMenuComponent getMenu() {
100
101
102 return MenuTools.getMenu(this);
103
104 }
105
106 public IMenuComponent getMenu(String menuId) {
107
108
109 return MenuTools.getMenu(this, menuId);
110
111 }
112
113 public IMenuIterator listMenus() {
114
115
116 return MenuTools.listMenus(this);
117
118 }
119
120 public final void addDoubleClickListener(org.rcfaces.core.event.IDoubleClickListener listener) {
121 addFacesListener(listener);
122 }
123
124 public final void removeDoubleClickListener(org.rcfaces.core.event.IDoubleClickListener listener) {
125 removeFacesListener(listener);
126 }
127
128 public final javax.faces.event.FacesListener [] listDoubleClickListeners() {
129 return getFacesListeners(org.rcfaces.core.event.IDoubleClickListener.class);
130 }
131
132 public int getTextPosition() {
133 return getTextPosition(null);
134 }
135
136
137
138
139 public int getTextPosition(javax.faces.context.FacesContext facesContext) {
140 return engine.getIntProperty(Properties.TEXT_POSITION,IHorizontalTextPositionCapability.DEFAULT_POSITION, facesContext);
141 }
142
143
144
145
146
147 public final boolean isTextPositionSetted() {
148 return engine.isPropertySetted(Properties.TEXT_POSITION);
149 }
150
151 public void setTextPosition(int textPosition) {
152 engine.setProperty(Properties.TEXT_POSITION, textPosition);
153 }
154
155 public java.lang.String getBorderType() {
156 return getBorderType(null);
157 }
158
159
160
161
162 public java.lang.String getBorderType(javax.faces.context.FacesContext facesContext) {
163 return engine.getStringProperty(Properties.BORDER_TYPE, facesContext);
164 }
165
166
167
168
169
170 public final boolean isBorderTypeSetted() {
171 return engine.isPropertySetted(Properties.BORDER_TYPE);
172 }
173
174 public void setBorderType(java.lang.String borderType) {
175 engine.setProperty(Properties.BORDER_TYPE, borderType);
176 }
177
178 public final void addSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
179 addFacesListener(listener);
180 }
181
182 public final void removeSelectionListener(org.rcfaces.core.event.ISelectionListener listener) {
183 removeFacesListener(listener);
184 }
185
186 public final javax.faces.event.FacesListener [] listSelectionListeners() {
187 return getFacesListeners(org.rcfaces.core.event.ISelectionListener.class);
188 }
189
190 public final void addCheckListener(org.rcfaces.core.event.ICheckListener listener) {
191 addFacesListener(listener);
192 }
193
194 public final void removeCheckListener(org.rcfaces.core.event.ICheckListener listener) {
195 removeFacesListener(listener);
196 }
197
198 public final javax.faces.event.FacesListener [] listCheckListeners() {
199 return getFacesListeners(org.rcfaces.core.event.ICheckListener.class);
200 }
201
202 public java.lang.Object getCheckedValues() {
203 return getCheckedValues(null);
204 }
205
206
207
208
209 public java.lang.Object getCheckedValues(javax.faces.context.FacesContext facesContext) {
210 return engine.getProperty(Properties.CHECKED_VALUES, facesContext);
211 }
212
213
214
215
216
217 public final boolean isCheckedValuesSetted() {
218 return engine.isPropertySetted(Properties.CHECKED_VALUES);
219 }
220
221 public void setCheckedValues(java.lang.Object checkedValues) {
222 engine.setProperty(Properties.CHECKED_VALUES, checkedValues);
223 }
224
225
226
227
228 public Class getCheckedValuesType(javax.faces.context.FacesContext facesContext) {
229 ValueExpression valueExpression=engine.getValueExpressionProperty(Properties.CHECKED_VALUES);
230 if (valueExpression==null) {
231 return null;
232 }
233 if (facesContext==null) {
234 facesContext=javax.faces.context.FacesContext.getCurrentInstance();
235 }
236 return valueExpression.getType(facesContext.getELContext());
237 }
238
239 public Object getFirstCheckedValue() {
240
241
242 return CheckTools.getFirst(getCheckedValues(), getValue());
243
244 }
245
246 public int getCheckedValuesCount() {
247
248
249 return CheckTools.getCount(getCheckedValues());
250
251 }
252
253 public Object[] listCheckedValues() {
254
255
256 return CheckTools.listValues(getCheckedValues(), getValue());
257
258 }
259
260 public boolean isReadOnly() {
261 return isReadOnly(null);
262 }
263
264
265
266
267 public boolean isReadOnly(javax.faces.context.FacesContext facesContext) {
268 return engine.getBoolProperty(Properties.READ_ONLY, false, facesContext);
269 }
270
271
272
273
274
275 public final boolean isReadOnlySetted() {
276 return engine.isPropertySetted(Properties.READ_ONLY);
277 }
278
279 public void setReadOnly(boolean readOnly) {
280 engine.setProperty(Properties.READ_ONLY, readOnly);
281 }
282
283 public java.lang.String getVerticalAlignment() {
284 return getVerticalAlignment(null);
285 }
286
287
288
289
290 public java.lang.String getVerticalAlignment(javax.faces.context.FacesContext facesContext) {
291 return engine.getStringProperty(Properties.VERTICAL_ALIGNMENT, facesContext);
292 }
293
294
295
296
297
298 public final boolean isVerticalAlignmentSetted() {
299 return engine.isPropertySetted(Properties.VERTICAL_ALIGNMENT);
300 }
301
302 public void setVerticalAlignment(java.lang.String verticalAlignment) {
303 engine.setProperty(Properties.VERTICAL_ALIGNMENT, verticalAlignment);
304 }
305
306 public boolean isShowDropDownMark() {
307 return isShowDropDownMark(null);
308 }
309
310
311
312
313 public boolean isShowDropDownMark(javax.faces.context.FacesContext facesContext) {
314 return engine.getBoolProperty(Properties.SHOW_DROP_DOWN_MARK, false, facesContext);
315 }
316
317
318
319
320
321 public final boolean isShowDropDownMarkSetted() {
322 return engine.isPropertySetted(Properties.SHOW_DROP_DOWN_MARK);
323 }
324
325 public void setShowDropDownMark(boolean showDropDownMark) {
326 engine.setProperty(Properties.SHOW_DROP_DOWN_MARK, showDropDownMark);
327 }
328
329 public String getDefaultItemLookId() {
330 return getDefaultItemLookId(null);
331 }
332
333 public String getDefaultItemLookId(javax.faces.context.FacesContext facesContext) {
334 return engine.getStringProperty(Properties.DEFAULT_ITEM_LOOK_ID, facesContext);
335 }
336
337 public void setDefaultItemLookId(String defaultItemLookId) {
338 engine.setProperty(Properties.DEFAULT_ITEM_LOOK_ID, defaultItemLookId);
339 }
340
341
342
343
344
345 public boolean isDefaultItemLookIdSetted() {
346 return engine.isPropertySetted(Properties.DEFAULT_ITEM_LOOK_ID);
347 }
348
349 public String getDefaultItemStyleClass() {
350 return getDefaultItemStyleClass(null);
351 }
352
353 public String getDefaultItemStyleClass(javax.faces.context.FacesContext facesContext) {
354 return engine.getStringProperty(Properties.DEFAULT_ITEM_STYLE_CLASS, facesContext);
355 }
356
357 public void setDefaultItemStyleClass(String defaultItemStyleClass) {
358 engine.setProperty(Properties.DEFAULT_ITEM_STYLE_CLASS, defaultItemStyleClass);
359 }
360
361
362
363
364
365 public boolean isDefaultItemStyleClassSetted() {
366 return engine.isPropertySetted(Properties.DEFAULT_ITEM_STYLE_CLASS);
367 }
368
369 public int getItemHiddenMode() {
370 return getItemHiddenMode(null);
371 }
372
373 public int getItemHiddenMode(javax.faces.context.FacesContext facesContext) {
374 return engine.getIntProperty(Properties.ITEM_HIDDEN_MODE, 0, facesContext);
375 }
376
377 public void setItemHiddenMode(int itemHiddenMode) {
378 engine.setProperty(Properties.ITEM_HIDDEN_MODE, itemHiddenMode);
379 }
380
381
382
383
384
385 public boolean isItemHiddenModeSetted() {
386 return engine.isPropertySetted(Properties.ITEM_HIDDEN_MODE);
387 }
388
389 protected Set getCameliaFields() {
390 return CAMELIA_ATTRIBUTES;
391 }
392 }