1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.internal.converter.DragDropEffectsConverter;
4 import org.rcfaces.core.component.ExpandableItemComponent;
5 import org.rcfaces.core.internal.component.Properties;
6 import org.rcfaces.core.component.capability.IInputTypeCapability;
7 import org.rcfaces.core.component.capability.IRadioGroupCapability;
8 import org.rcfaces.core.component.capability.IMenuPopupIdCapability;
9 import java.lang.String;
10 import org.apache.commons.logging.LogFactory;
11 import org.rcfaces.core.internal.tools.TreeTools;
12 import org.rcfaces.core.component.capability.IDraggableCapability;
13 import javax.faces.context.FacesContext;
14 import org.rcfaces.core.component.TreeComponent;
15 import org.rcfaces.core.component.capability.IDragAndDropEffects;
16 import javax.el.ValueExpression;
17 import org.rcfaces.core.internal.converter.InputTypeConverter;
18 import java.util.HashSet;
19 import org.apache.commons.logging.Log;
20 import org.rcfaces.core.component.capability.IDroppableCapability;
21 import org.rcfaces.core.internal.converter.DragDropTypesConverter;
22 import org.rcfaces.core.component.capability.IStyleClassCapability;
23 import java.util.Set;
24 import java.util.Arrays;
25
26
27
28
29 public class TreeNodeComponent extends ExpandableItemComponent implements
30 IRadioGroupCapability,
31 IStyleClassCapability,
32 IMenuPopupIdCapability,
33 IInputTypeCapability,
34 IDraggableCapability,
35 IDroppableCapability {
36
37 private static final Log LOG = LogFactory.getLog(TreeNodeComponent.class);
38
39 public static final String COMPONENT_TYPE="org.rcfaces.core.treeNode";
40
41 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(ExpandableItemComponent.CAMELIA_ATTRIBUTES);
42 static {
43 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"droppable","groupName","dragTypes","menuPopupId","dragEffects","inputType","styleClass","dropEffects","dropTypes","draggable"}));
44 }
45
46 public TreeNodeComponent() {
47 setRendererType(null);
48 }
49
50 public TreeNodeComponent(String componentId) {
51 this();
52 setId(componentId);
53 }
54
55 public void setInputType(String inputType) {
56
57
58 setInputType(((Integer)InputTypeConverter.SINGLETON.getAsObject(null, this, inputType)).intValue());
59
60 }
61
62 public void setDragEffects(String dragEffects) {
63
64
65 setDragEffects(((Integer)DragDropEffectsConverter.SINGLETON.getAsObject(null, this, dragEffects)).intValue());
66
67 }
68
69 public void setDragTypes(String dragTypes) {
70
71
72 setDragTypes((String[])DragDropTypesConverter.SINGLETON.getAsObject(null, this, dragTypes));
73
74 }
75
76 public void setDropEffects(String dropEffects) {
77
78
79 setDropEffects(((Integer)DragDropEffectsConverter.SINGLETON.getAsObject(null, this, dropEffects)).intValue());
80
81 }
82
83 public void setDropTypes(String dropTypes) {
84
85
86 setDropTypes((String[])DragDropTypesConverter.SINGLETON.getAsObject(null, this, dropTypes));
87
88 }
89
90 public void setExpanded(boolean expanded) {
91
92
93 setExpanded(null, expanded);
94
95 }
96
97 public void setExpanded(FacesContext context, boolean expanded) {
98
99
100 getTree().setExpanded(context, getItemValue(), expanded);
101
102 }
103
104 public boolean isExpanded() {
105
106
107 return isExpanded(null);
108
109 }
110
111 public boolean isExpanded(FacesContext context) {
112
113
114 return getTree().isExpanded(context, getItemValue());
115
116 }
117
118 public TreeComponent getTree() {
119
120
121 return TreeTools.getTree(this);
122
123 }
124
125 public java.lang.String getGroupName() {
126 return getGroupName(null);
127 }
128
129
130
131
132 public java.lang.String getGroupName(javax.faces.context.FacesContext facesContext) {
133 return engine.getStringProperty(Properties.GROUP_NAME, facesContext);
134 }
135
136
137
138
139
140 public final boolean isGroupNameSetted() {
141 return engine.isPropertySetted(Properties.GROUP_NAME);
142 }
143
144 public void setGroupName(java.lang.String groupName) {
145 engine.setProperty(Properties.GROUP_NAME, groupName);
146 }
147
148 public java.lang.String getStyleClass() {
149 return getStyleClass(null);
150 }
151
152
153
154
155 public java.lang.String getStyleClass(javax.faces.context.FacesContext facesContext) {
156 return engine.getStringProperty(Properties.STYLE_CLASS, facesContext);
157 }
158
159
160
161
162
163 public final boolean isStyleClassSetted() {
164 return engine.isPropertySetted(Properties.STYLE_CLASS);
165 }
166
167 public void setStyleClass(java.lang.String styleClass) {
168 engine.setProperty(Properties.STYLE_CLASS, styleClass);
169 }
170
171 public java.lang.String getMenuPopupId() {
172 return getMenuPopupId(null);
173 }
174
175
176
177
178 public java.lang.String getMenuPopupId(javax.faces.context.FacesContext facesContext) {
179 return engine.getStringProperty(Properties.MENU_POPUP_ID, facesContext);
180 }
181
182
183
184
185
186 public final boolean isMenuPopupIdSetted() {
187 return engine.isPropertySetted(Properties.MENU_POPUP_ID);
188 }
189
190 public void setMenuPopupId(java.lang.String menuPopupId) {
191 engine.setProperty(Properties.MENU_POPUP_ID, menuPopupId);
192 }
193
194 public int getInputType() {
195 return getInputType(null);
196 }
197
198
199
200
201 public int getInputType(javax.faces.context.FacesContext facesContext) {
202 return engine.getIntProperty(Properties.INPUT_TYPE,0, facesContext);
203 }
204
205
206
207
208
209 public final boolean isInputTypeSetted() {
210 return engine.isPropertySetted(Properties.INPUT_TYPE);
211 }
212
213 public void setInputType(int inputType) {
214 engine.setProperty(Properties.INPUT_TYPE, inputType);
215 }
216
217 public int getDragEffects() {
218 return getDragEffects(null);
219 }
220
221
222
223
224 public int getDragEffects(javax.faces.context.FacesContext facesContext) {
225 return engine.getIntProperty(Properties.DRAG_EFFECTS,IDragAndDropEffects.UNKNOWN_DND_EFFECT, facesContext);
226 }
227
228
229
230
231
232 public final boolean isDragEffectsSetted() {
233 return engine.isPropertySetted(Properties.DRAG_EFFECTS);
234 }
235
236 public void setDragEffects(int dragEffects) {
237 engine.setProperty(Properties.DRAG_EFFECTS, dragEffects);
238 }
239
240 public java.lang.String[] getDragTypes() {
241 return getDragTypes(null);
242 }
243
244
245
246
247 public java.lang.String[] getDragTypes(javax.faces.context.FacesContext facesContext) {
248 return (java.lang.String[])engine.getProperty(Properties.DRAG_TYPES, facesContext);
249 }
250
251
252
253
254
255 public final boolean isDragTypesSetted() {
256 return engine.isPropertySetted(Properties.DRAG_TYPES);
257 }
258
259 public void setDragTypes(java.lang.String[] dragTypes) {
260 engine.setProperty(Properties.DRAG_TYPES, dragTypes);
261 }
262
263 public boolean isDraggable() {
264 return isDraggable(null);
265 }
266
267
268
269
270 public boolean isDraggable(javax.faces.context.FacesContext facesContext) {
271 return engine.getBoolProperty(Properties.DRAGGABLE, false, facesContext);
272 }
273
274
275
276
277
278 public final boolean isDraggableSetted() {
279 return engine.isPropertySetted(Properties.DRAGGABLE);
280 }
281
282 public void setDraggable(boolean draggable) {
283 engine.setProperty(Properties.DRAGGABLE, draggable);
284 }
285
286 public int getDropEffects() {
287 return getDropEffects(null);
288 }
289
290
291
292
293 public int getDropEffects(javax.faces.context.FacesContext facesContext) {
294 return engine.getIntProperty(Properties.DROP_EFFECTS,IDragAndDropEffects.UNKNOWN_DND_EFFECT, facesContext);
295 }
296
297
298
299
300
301 public final boolean isDropEffectsSetted() {
302 return engine.isPropertySetted(Properties.DROP_EFFECTS);
303 }
304
305 public void setDropEffects(int dropEffects) {
306 engine.setProperty(Properties.DROP_EFFECTS, dropEffects);
307 }
308
309 public java.lang.String[] getDropTypes() {
310 return getDropTypes(null);
311 }
312
313
314
315
316 public java.lang.String[] getDropTypes(javax.faces.context.FacesContext facesContext) {
317 return (java.lang.String[])engine.getProperty(Properties.DROP_TYPES, facesContext);
318 }
319
320
321
322
323
324 public final boolean isDropTypesSetted() {
325 return engine.isPropertySetted(Properties.DROP_TYPES);
326 }
327
328 public void setDropTypes(java.lang.String[] dropTypes) {
329 engine.setProperty(Properties.DROP_TYPES, dropTypes);
330 }
331
332 public boolean isDroppable() {
333 return isDroppable(null);
334 }
335
336
337
338
339 public boolean isDroppable(javax.faces.context.FacesContext facesContext) {
340 return engine.getBoolProperty(Properties.DROPPABLE, false, facesContext);
341 }
342
343
344
345
346
347 public final boolean isDroppableSetted() {
348 return engine.isPropertySetted(Properties.DROPPABLE);
349 }
350
351 public void setDroppable(boolean droppable) {
352 engine.setProperty(Properties.DROPPABLE, droppable);
353 }
354
355 protected Set getCameliaFields() {
356 return CAMELIA_ATTRIBUTES;
357 }
358 }