Source Code Cross Referenced for TreePanel.java in  » Ajax » gwtext-2.01 » com » gwtext » client » widgets » tree » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » gwtext 2.01 » com.gwtext.client.widgets.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * GWT-Ext Widget Library
003:         * Copyright(c) 2007-2008, GWT-Ext.
004:         * licensing@gwt-ext.com
005:         * 
006:         * http://www.gwt-ext.com/license
007:         */
008:
009:        package com.gwtext.client.widgets.tree;
010:
011:        import com.google.gwt.core.client.JavaScriptObject;
012:        import com.gwtext.client.core.Function;
013:        import com.gwtext.client.data.Node;
014:        import com.gwtext.client.data.Tree;
015:        import com.gwtext.client.util.JavaScriptObjectHelper;
016:        import com.gwtext.client.widgets.Panel;
017:        import com.gwtext.client.widgets.tree.event.TreePanelListener;
018:
019:        /**
020:         * A Tree widget.
021:         */
022:        public class TreePanel extends Panel {
023:
024:            private TreeSelectionModel selectionModel;
025:
026:            private static JavaScriptObject configPrototype;
027:
028:            static {
029:                init();
030:            }
031:
032:            private static native void init()/*-{
033:                    var c = new $wnd.Ext.tree.TreePanel();
034:                    @com.gwtext.client.widgets.tree.TreePanel::configPrototype = c.initialConfig;
035:                }-*/;
036:
037:            protected JavaScriptObject getConfigPrototype() {
038:                return configPrototype;
039:            }
040:
041:            public String getXType() {
042:                return "treepanel";
043:            }
044:
045:            public TreePanel() {
046:            }
047:
048:            protected void initComponent() {
049:                JavaScriptObject root = getAttributeAsJavaScriptObject("root");
050:                super .initComponent();
051:                if (root == null) {
052:                    error("TreePanel root node must be assigned. See setRootNode(..)");
053:                }
054:            }
055:
056:            /**
057:             * Construct a new TreePanel.
058:             *
059:             * @param id the tree panel ID
060:             */
061:            public TreePanel(String id) {
062:                setId(id);
063:            }
064:
065:            protected native JavaScriptObject create(JavaScriptObject config) /*-{
066:                   return new $wnd.Ext.tree.TreePanel(config);
067:               }-*/;
068:
069:            /**
070:             * The dragZone used by this tree if drag is enabled.
071:             *
072:             * @return the drag zone, or null if not enabled
073:             */
074:            public native TreeDragZone getDragZone()/*-{
075:                    var tp = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
076:                    var dragZone = tp.dragZone;
077:                    return dragZone == null ? null : @com.gwtext.client.widgets.tree.TreeDragZone::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(dragZone);
078:                }-*/;
079:
080:            /**
081:             * The dropZone used by this tree if drop is enabled.
082:             *
083:             * @return the drop zone, or null if not enabled
084:             */
085:            public native TreeDropZone getDropZone()/*-{
086:                    var tp = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
087:                    var dropZone = tp.dropZone;
088:                    return dropZone == null ? null : @com.gwtext.client.widgets.tree.TreeDropZone::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(dropZone);        
089:                }-*/;
090:
091:            /**
092:             * Return the underlying Tree data structure backing the TreePanel.
093:             *
094:             * @return the tree data structure
095:             */
096:            public native Tree getTree()/*-{
097:                    //in Ext TreePanel (UI aspect) extends Tree (dat structure).. kinda strange
098:                    //but lets model it as a contains relationship in GWT-Ext
099:                    var tree = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
100:                    return @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);                            
101:                }-*/;
102:
103:            /**
104:             * Collapse all nodes.
105:             */
106:            public native void collapseAll() /*-{
107:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
108:                   panel.collapseAll();
109:               }-*/;
110:
111:            public void expandAll() {
112:                if (!isRendered()) {
113:                    addListener("render", new Function() {
114:                        public void execute() {
115:                            expandAll();
116:                        }
117:                    });
118:                } else {
119:                    expandAllRendered();
120:                }
121:            }
122:
123:            /**
124:             * Expand all nodes.
125:             */
126:            public native void expandAllRendered() /*-{
127:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
128:                   panel.expandAll();
129:               }-*/;
130:
131:            /**
132:             * Expands a specified path in this TreePanel. A path can be retrieved from a node with {@link Node#getPath}
133:             *
134:             * @param path the path
135:             * @param cb   the callback to call when the expand is complete
136:             */
137:            public native void expandPath(String path, NodeExpansionCallback cb) /*-{
138:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
139:                   if(cb == null) {
140:                       panel.expandPath(path);
141:                   } else {
142:                       panel.expandPath(path, null, function(success, node) {
143:                           var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
144:                           cb.@com.gwtext.client.widgets.tree.NodeExpansionCallback::onExpand(ZLcom/gwtext/client/widgets/tree/TreeNode;)(success, nodeJ);
145:                       });
146:                   }
147:               }-*/;
148:
149:            /**
150:             * Return an array of checked TreeNodes starting from the root node.
151:             *
152:             * @return array of checked nodes, empty array if no nodes are checked
153:             */
154:            public TreeNode[] getChecked() {
155:                JavaScriptObject arr = getChecked(getOrCreateJsObj());
156:                return convertFromNativeTreeNodeArray(arr);
157:            }
158:
159:            static TreeNode[] convertFromNativeTreeNodeArray(
160:                    JavaScriptObject nativeArray) {
161:                if (nativeArray == null)
162:                    return new TreeNode[0];
163:                JavaScriptObject[] treeNodesJ = JavaScriptObjectHelper
164:                        .toArray(nativeArray);
165:                TreeNode[] treeNodes = new TreeNode[treeNodesJ.length];
166:                for (int i = 0; i < treeNodesJ.length; i++) {
167:                    JavaScriptObject treeNode = treeNodesJ[i];
168:                    treeNodes[i] = new TreeNode(treeNode);
169:                }
170:                return treeNodes;
171:            }
172:
173:            private native JavaScriptObject getChecked(JavaScriptObject tree) /*-{
174:                   var checked = tree.getChecked();
175:                   return checked === undefined || (checked.length == 1 && checked[0] === undefined) ? null : checked;
176:               }-*/;
177:
178:            /**
179:             * Return an array of checked TreeNodes starting from the specified startNode.
180:             *
181:             * @param startNode the node to start from
182:             * @return array of checked nodes, empty array if no nodes are checked
183:             */
184:
185:            public TreeNode[] getChecked(TreeNode startNode) {
186:                JavaScriptObject arr = getChecked(getOrCreateJsObj(), startNode
187:                        .getJsObj());
188:                return convertFromNativeTreeNodeArray(arr);
189:            }
190:
191:            private native JavaScriptObject getChecked(JavaScriptObject tree,
192:                    JavaScriptObject startNode) /*-{
193:                   var checked =  tree.getChecked(startNode);
194:                   return checked === undefined || (checked.length == 1 && checked[0] === undefined) ? null : checked;
195:               }-*/;
196:
197:            /**
198:             * Retrun the TreeLoader associated with the TreePanel.
199:             *
200:             * @return the tree loader
201:             */
202:            public native TreeLoader getLoader() /*-{
203:                   var tree = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
204:                   return @com.gwtext.client.widgets.tree.TreeLoader::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree.getLoader());
205:               }-*/;
206:
207:            /**
208:             * Gets a node in this tree by its ID.
209:             *
210:             * @param id the node ID
211:             * @return the node, null if none found
212:             */
213:            public TreeNode getNodeById(String id) {
214:                JavaScriptObject node = getNodeById(getOrCreateJsObj(), id);
215:                if (node == null) {
216:                    return null;
217:                } else {
218:                    return new TreeNode(node);
219:                }
220:            }
221:
222:            private native JavaScriptObject getNodeById(JavaScriptObject tree,
223:                    String id) /*-{
224:                   var node = tree.getNodeById(id);
225:                   if(node === undefined) {
226:                       return null;
227:                   } else {
228:                       return node;
229:                   }
230:               }-*/;
231:
232:            /**
233:             * Returns the root node for this tree.
234:             *
235:             * @return the root node
236:             */
237:            public TreeNode getRootNode() {
238:                JavaScriptObject rootJS = getRootNode(getOrCreateJsObj());
239:                return rootJS == null ? null : new TreeNode(rootJS);
240:            }
241:
242:            private native JavaScriptObject getRootNode(JavaScriptObject tree) /*-{
243:                   var root = tree.getRootNode();
244:                   return root === undefined ? null : root;
245:               }-*/;
246:
247:            /**
248:             * Selects the node in this tree at the specified path. A path can be retrieved from a node with {@link Node#getPath}.
249:             *
250:             * @param path the path
251:             * @param cb   the callback to call when the selection is complete
252:             */
253:            public native void selectPath(String path, NodeSelectionCallback cb) /*-{
254:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
255:                   if(cb == null) {
256:                       panel.selectPath(path);
257:                   } else {
258:                       panel.selectPath(path, null, function(success, node) {
259:                           var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
260:                           cb.@com.gwtext.client.widgets.tree.NodeSelectionCallback::onSelect(ZLcom/gwtext/client/widgets/tree/TreeNode;)(success, nodeJ);
261:                       });
262:                   }
263:               }-*/;
264:
265:            public void setRootNode(Node node) {
266:                if (!isRendered()) {
267:                    setAttribute("root", node.getJsObj(), true);
268:                } else {
269:                    setRootNodeRendered(node);
270:                }
271:            }
272:
273:            /**
274:             * Sets the root node for this tree.
275:             *
276:             * @param node the root node
277:             */
278:            public native void setRootNodeRendered(Node node) /*-{
279:                   var tree = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
280:                   var nodeJS = node.@com.gwtext.client.core.JsObject::getJsObj()();
281:                   tree.setRootNode(nodeJS);
282:               }-*/;
283:
284:            /**
285:             * Return the TreePanel's selection model.
286:             *
287:             * @return the selection model
288:             */
289:            public TreeSelectionModel getSelectionModel() {
290:                if (selectionModel == null) {
291:                    return doGetSelectionModel();
292:                } else {
293:                    return selectionModel;
294:                }
295:            }
296:
297:            private static DropNodeCallback createDropNodeCB(
298:                    final JavaScriptObject event) {
299:                return new DropNodeCallback() {
300:                    public void setDropNode(TreeNode node) {
301:                        JavaScriptObjectHelper.setAttribute(event, "dropNode",
302:                                node.getJsObj());
303:                    }
304:
305:                    public void setDropNodes(TreeNode[] nodes) {
306:                        JavaScriptObject[] nodesJS = new JavaScriptObject[nodes.length];
307:                        for (int i = 0; i < nodes.length; i++) {
308:                            TreeNode node = nodes[i];
309:                            nodesJS[i] = node.getJsObj();
310:                        }
311:                        JavaScriptObject nativeRecordsArray = JavaScriptObjectHelper
312:                                .convertToJavaScriptArray(nodesJS);
313:                        JavaScriptObjectHelper.setAttribute(event, "dropNode",
314:                                nativeRecordsArray);
315:                    }
316:                };
317:            }
318:
319:            private native DefaultSelectionModel doGetSelectionModel() /*-{
320:                   var tree = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
321:                   var sm = tree.getSelectionModel();
322:                   return @com.gwtext.client.widgets.tree.DefaultSelectionModel::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(sm);
323:               }-*/;
324:
325:            /**
326:             * Set the token used to separate sub-paths in path strings (defaults to '/').
327:             *
328:             * @param separator the path separator
329:             */
330:            public native void setPathSeparator(String separator)/*-{
331:                    var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
332:                    panel.pathSeparator = separator;
333:                }-*/;
334:
335:            /**
336:             * Add a TreePanel listener.
337:             *
338:             * @param listener the listener
339:             */
340:            public native void addListener(TreePanelListener listener)/*-{
341:
342:                    this.@com.gwtext.client.widgets.Panel::addListener(Lcom/gwtext/client/widgets/event/PanelListener;)(listener);
343:
344:                    var treePanelJ = this;
345:
346:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('append',
347:                        function(tree, parent, node, index) {
348:                            var treeJ = @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);
349:                            var parentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(parent);
350:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
351:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onAppend(Lcom/gwtext/client/data/Tree;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;I)(treeJ, parentJ, nodeJ, index);
352:                        }
353:                    );
354:
355:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforeappend',
356:                        function(tree, parent, node, index) {
357:                            var treeJ = @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);
358:                            var parentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(parent);
359:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
360:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeAppend(Lcom/gwtext/client/data/Tree;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;)(treeJ, parentJ, nodeJ);
361:                        }
362:                    );
363:
364:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforeinsert',
365:                        function(tree, parent, node, refNode) {
366:                            var treeJ = @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);
367:                            var parentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(parent);
368:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
369:                            var refNodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(refNode);
370:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeInsert(Lcom/gwtext/client/data/Tree;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;)(treeJ, parentJ, nodeJ, refNodeJ);
371:                        }
372:                    );
373:
374:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('insert',
375:                        function(tree, parent, node, refNode) {
376:                            var treeJ = @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);
377:                            var parentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(parent);
378:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
379:                            var refNodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(refNode);
380:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onInsert(Lcom/gwtext/client/data/Tree;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;)(treeJ, parentJ, nodeJ, refNodeJ);
381:                        }
382:                    );
383:
384:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforeremove',
385:                        function(tree, parent, node) {
386:                            var treeJ = @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);
387:                            var parentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(parent);
388:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
389:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeRemove(Lcom/gwtext/client/data/Tree;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;)(treeJ, parentJ, nodeJ);
390:                        }
391:                    );
392:
393:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('remove',
394:                        function(tree, parent, node) {
395:                            var treeJ = @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);
396:                            var parentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(parent);
397:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
398:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onRemove(Lcom/gwtext/client/data/Tree;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;)(treeJ, parentJ, nodeJ);
399:                        }
400:                    );
401:
402:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforechildrenrendered',
403:                        function(node, event) {
404:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
405:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeChildrenRendered(Lcom/gwtext/client/widgets/tree/TreeNode;)(nodeJ);
406:                        }
407:                    );
408:
409:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforeclick',
410:                        function(node, event) {
411:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
412:                            var e = @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
413:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeClick(Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/core/EventObject;)(nodeJ, e);
414:                        }
415:                    );
416:                          
417:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforecollapsenode',
418:                        function(node, deep, anim) {
419:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
420:                            if(deep === undefined || deep == null) deep = false;
421:                            if(anim === undefined || anim == null) anim = false;
422:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeCollapseNode(Lcom/gwtext/client/widgets/tree/TreeNode;ZZ)(nodeJ, deep, anim);
423:                        }
424:                    );
425:                
426:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforeexpandnode',
427:                        function(node, deep, anim) {
428:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
429:                            if(deep === undefined || deep == null) deep = false;
430:                            if(anim === undefined || anim == null) anim = false;
431:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeExpandNode(Lcom/gwtext/client/widgets/tree/TreeNode;ZZ)(nodeJ, deep, anim);
432:                        }
433:                    );
434:                
435:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforenodedrop',
436:                        function(e) {
437:                            var tree = e.tree;
438:                            var targetNode = e.target;
439:                            var data = e.data;
440:                            var point = e.point;
441:                            var source = e.source;
442:                            var rawEvent = e.rawEvent;
443:                            var dropNode = e.dropNode;
444:
445:
446:                            var targetNodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(targetNode);
447:                            var dragDataJ = data == null || data == undefined ? null : @com.gwtext.client.dd.DragData::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(data);
448:                            var sourceJ = @com.gwtext.client.dd.DragDrop::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(source);
449:                            var dropNodeJ = dropNode == null || dropNode === undefined ? null : @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(dropNode);
450:                            var dropNodeCB = @com.gwtext.client.widgets.tree.TreePanel::createDropNodeCB(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
451:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeNodeDrop(Lcom/gwtext/client/widgets/tree/TreePanel;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/dd/DragData;Ljava/lang/String;Lcom/gwtext/client/dd/DragDrop;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/DropNodeCallback;)(treePanelJ, targetNodeJ, dragDataJ, point, sourceJ, dropNodeJ, dropNodeCB);
452:                        }
453:                    );
454:
455:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforeload',
456:                        function(node) {
457:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
458:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeLoad(Lcom/gwtext/client/widgets/tree/TreeNode;)(nodeJ);
459:                        }
460:                    );
461:                
462:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('checkchange',
463:                        function(node, checked) {
464:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
465:                            if(checked === undefined || checked == null) checked = false;
466:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onCheckChange(Lcom/gwtext/client/widgets/tree/TreeNode;Z)(nodeJ, checked);
467:                        }
468:                    );
469:                
470:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('click',
471:                        function(node, event) {
472:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
473:                            var e = @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
474:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onClick(Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/core/EventObject;)(nodeJ, e);
475:                        }
476:                    );
477:
478:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('collapsenode',
479:                        function(node) {
480:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
481:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onCollapseNode(Lcom/gwtext/client/widgets/tree/TreeNode;)(nodeJ);
482:                        }
483:                    );
484:
485:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('contextmenu',
486:                        function(node, event) {
487:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
488:                            var e = @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
489:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onContextMenu(Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/core/EventObject;)(nodeJ, e);
490:                        }
491:                    );
492:
493:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('dblclick',
494:                        function(node, event) {
495:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
496:                            var e = @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
497:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onDblClick(Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/core/EventObject;)(nodeJ, e);
498:                        }
499:                    );
500:
501:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('disabledchange',
502:                        function(node, disabled) {
503:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
504:                            if(disabled === undefined || disabled == null) disabled = false;
505:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onDisabledChange(Lcom/gwtext/client/widgets/tree/TreeNode;Z)(nodeJ, disabled);
506:                        }
507:                    );
508:
509:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('dragdrop',
510:                        function(treePanel, node, dd, e) {
511:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
512:                            var ddJ = @com.gwtext.client.dd.DD::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(dd);
513:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onDragDrop(Lcom/gwtext/client/widgets/tree/TreePanel;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/dd/DD;)(treePanelJ, nodeJ, ddJ);
514:                        }
515:                    );
516:
517:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('enddrag',
518:                        function(treePanel, node, e) {
519:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
520:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onEndDrag(Lcom/gwtext/client/widgets/tree/TreePanel;Lcom/gwtext/client/widgets/tree/TreeNode;)(treePanelJ, nodeJ);
521:                        }
522:                    );
523:
524:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('expandnode',
525:                        function(node) {
526:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
527:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onExpandNode(Lcom/gwtext/client/widgets/tree/TreeNode;)(nodeJ);
528:                        }
529:                    );
530:
531:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('load',
532:                        function(node) {
533:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
534:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onLoad(Lcom/gwtext/client/widgets/tree/TreeNode;)(nodeJ);
535:                        }
536:                    );
537:
538:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('nodedragover',
539:                        function(e) {
540:                            
541:                            var tree = e.tree;
542:                            var targetNode = e.target;
543:                            var data = e.data;
544:                            var point = e.point;
545:                            var source = e.source;
546:                            var rawEvent = e.rawEvent;
547:                            var dropNode = e.dropNode;
548:
549:                            var targetNodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(targetNode);
550:                            var dragDataJ = data == null || data == undefined ? null : @com.gwtext.client.dd.DragData::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(data);
551:                            var sourceJ = @com.gwtext.client.dd.DragDrop::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(source);
552:                            var dropNodeJ = dropNode == null || dropNode === undefined ? null : @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(dropNode);
553:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onNodeDragOver(Lcom/gwtext/client/widgets/tree/TreePanel;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/dd/DragData;Ljava/lang/String;Lcom/gwtext/client/dd/DragDrop;Lcom/gwtext/client/widgets/tree/TreeNode;)(treePanelJ, targetNodeJ, dragDataJ, point, sourceJ, dropNodeJ);
554:                        }
555:                    );
556:
557:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('nodedrop',
558:                        function(e) {
559:                            var tree = e.tree;
560:                            var targetNode = e.target;
561:                            var data = e.data;
562:                            var point = e.point;
563:                            var source = e.source;
564:                            var rawEvent = e.rawEvent;
565:                            var dropNode = e.dropNode;
566:
567:                            var targetNodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(targetNode);
568:                            var dragDataJ = data == null || data == undefined ? null : @com.gwtext.client.dd.DragData::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(data);
569:                            var sourceJ = @com.gwtext.client.dd.DragDrop::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(source);
570:                            var dropNodeJ = dropNode == null || dropNode === undefined ? null : @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(dropNode);
571:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onNodeDrop(Lcom/gwtext/client/widgets/tree/TreePanel;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/dd/DragData;Ljava/lang/String;Lcom/gwtext/client/dd/DragDrop;Lcom/gwtext/client/widgets/tree/TreeNode;)(treePanelJ, targetNodeJ, dragDataJ, point, sourceJ, dropNodeJ);
572:                        }
573:                    );
574:
575:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforemovenode',
576:                        function(tree, node, oldParent, newParent, index) {
577:                            var treeJ = @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);
578:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
579:                            var oldParentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(oldParent);
580:                            var newParentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(newParent);
581:                            return listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::doBeforeMoveNode(Lcom/gwtext/client/data/Tree;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;I)(treeJ, nodeJ, oldParentJ, newParentJ, index);
582:                        }
583:                    );
584:
585:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('movenode',
586:                        function(tree, node, oldParent, newParent, index) {
587:                            var treeJ = @com.gwtext.client.data.Tree::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(tree);
588:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
589:                            var oldParentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(oldParent);
590:                            var newParentJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(newParent);
591:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onMoveNode(Lcom/gwtext/client/data/Tree;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;Lcom/gwtext/client/widgets/tree/TreeNode;I)(treeJ, nodeJ, oldParentJ, newParentJ, index);
592:                        }
593:                    );
594:
595:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('startdrag',
596:                        function(treePanel, node, e) {
597:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
598:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onStartDrag(Lcom/gwtext/client/widgets/tree/TreePanel;Lcom/gwtext/client/widgets/tree/TreeNode;)(treePanelJ, nodeJ);
599:                        }
600:                    );
601:
602:                    this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('textchange',
603:                        function(node, newText, oldText) {
604:                            var nodeJ = @com.gwtext.client.widgets.tree.TreeNode::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(node);
605:                            if(newText === undefined) newText = null;
606:                            if(oldText === undefined) oldText = null;
607:                            listener.@com.gwtext.client.widgets.tree.event.TreePanelListener::onTextChange(Lcom/gwtext/client/widgets/tree/TreeNode;Ljava/lang/String;Ljava/lang/String;)(nodeJ, newText, oldText);
608:                        }
609:                    );
610:                }-*/;
611:
612:            // --- config properties ---
613:
614:            /**
615:             * True to enable animated expand/collapse. Defaults to true.
616:             *
617:             * @param animate true to enable enimation.
618:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
619:             */
620:            public void setAnimate(boolean animate)
621:                    throws IllegalStateException {
622:                setAttribute("animate", animate, true);
623:            }
624:
625:            /**
626:             * True to register this container with ScrollManager. Doing so provides automatic scrolling
627:             * of overflow regions in the page during drag operations. Defaults to false.
628:             *
629:             * @param containerScroll true to register this container with ScrollManager
630:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
631:             */
632:            public void setContainerScroll(boolean containerScroll)
633:                    throws IllegalStateException {
634:                setAttribute("containerScroll", containerScroll, true);
635:            }
636:
637:            /**
638:             * True if the tree should only allow append drops (use for trees which are sorted).
639:             *
640:             * @param ddAppendOnly true to allow only append drops
641:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
642:             */
643:            public void setDdAppendOnly(String ddAppendOnly)
644:                    throws IllegalStateException {
645:                setAttribute("ddAppendOnly", ddAppendOnly, true);
646:            }
647:
648:            /**
649:             * The DD group this TreePanel belongs to (defaults to 'TreeDD').
650:             *
651:             * @param ddGroup the DD group
652:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
653:             */
654:            public void setDdGroup(String ddGroup) throws IllegalStateException {
655:                setAttribute("ddGroup", ddGroup, true);
656:            }
657:
658:            /**
659:             * True to enable body scrolling
660:             *
661:             * @param ddScroll true to enable body scrolling.
662:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
663:             */
664:            public void setDdScroll(boolean ddScroll)
665:                    throws IllegalStateException {
666:                setAttribute("ddScroll", ddScroll, true);
667:            }
668:
669:            //TODO no TreeDragZone configs appear to be in Ext
670:            //dragConfig
671:
672:            /**
673:             * Custom config to pass to the {@link TreeDropZone} instance.
674:             *
675:             * @param dropConfig the drop config
676:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
677:             */
678:            public void setDropConfig(TreeDropZone dropConfig)
679:                    throws IllegalStateException {
680:                setAttribute("dropConfig", dropConfig.getJsObj(), true);
681:            }
682:
683:            /**
684:             * True to enable drag and drop.
685:             *
686:             * @param enableDD true to enable drag and drop
687:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
688:             */
689:            public void setEnableDD(boolean enableDD)
690:                    throws IllegalStateException {
691:                setAttribute("enableDD", enableDD, true);
692:            }
693:
694:            /**
695:             * True to enable just drag.
696:             *
697:             * @param enableDrag true to enable just drag
698:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
699:             */
700:            public void setEnableDrag(boolean enableDrag)
701:                    throws IllegalStateException {
702:                setAttribute("enableDrag", enableDrag, true);
703:            }
704:
705:            /**
706:             * True to enable just drop.
707:             *
708:             * @param enableDrop true to enable just drop
709:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
710:             */
711:            public void setEnableDrop(boolean enableDrop)
712:                    throws IllegalStateException {
713:                setAttribute("enableDrop", enableDrop, true);
714:            }
715:
716:            /**
717:             * The color of the node highlight (defaults to C3DAF9).
718:             *
719:             * @param hlColor the color of the node highlight
720:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
721:             */
722:            public void setHlColor(String hlColor) throws IllegalStateException {
723:                setAttribute("hlColor", hlColor, true);
724:            }
725:
726:            /**
727:             * False to disable node highlight on drop.
728:             *
729:             * @param hlDrop false to disable drop drop highlight
730:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
731:             */
732:            public void setHlDrop(boolean hlDrop) throws IllegalStateException {
733:                setAttribute("hlDrop", hlDrop, true);
734:            }
735:
736:            /**
737:             * False to disable tree lines (defaults to true).
738:             *
739:             * @param lines false to disable tree lines
740:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
741:             */
742:            public void setLines(boolean lines) throws IllegalStateException {
743:                setAttribute("lines", lines, true);
744:            }
745:
746:            /**
747:             * A TreeLoader for use with this TreePanel.
748:             *
749:             * @param loader the tree loader
750:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
751:             */
752:            public void setLoader(TreeLoader loader)
753:                    throws IllegalStateException {
754:                setAttribute("loader", loader.getJsObj(), true);
755:            }
756:
757:            /**
758:             * False to hide the root node (defaults to true).
759:             *
760:             * @param rootVisible false to hide the root node
761:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
762:             */
763:            public void setRootVisible(boolean rootVisible)
764:                    throws IllegalStateException {
765:                setAttribute("rootVisible", rootVisible, true);
766:            }
767:
768:            /**
769:             * Set the Tree seelction model
770:             *
771:             * @param selectionModel the selection model
772:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
773:             */
774:            public void setSelectionModel(TreeSelectionModel selectionModel)
775:                    throws IllegalStateException {
776:                setAttribute("selModel", selectionModel.getJsObj(), true);
777:                this .selectionModel = selectionModel;
778:            }
779:
780:            /**
781:             * True if only 1 node per branch may be expanded.
782:             *
783:             * @param singleExpand true if only 1 node per branch may be expanded
784:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
785:             */
786:            public void setSingleExpand(boolean singleExpand)
787:                    throws IllegalStateException {
788:                setAttribute("singleExpand", singleExpand, true);
789:            }
790:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.