Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / docs / source / TreeEventModel.html
index 5a432dd..a754fdc 100644 (file)
@@ -1,5 +1,6 @@
 <html>\r
 <head>\r
 <html>\r
 <head>\r
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \r
   <title>The source code</title>\r
     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
   <title>The source code</title>\r
     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
 \r
 Ext.tree.TreeEventModel.prototype = {\r
     initEvents : function(){\r
 \r
 Ext.tree.TreeEventModel.prototype = {\r
     initEvents : function(){\r
-        var el = this.tree.getTreeEl();\r
-        el.on('click', this.delegateClick, this);\r
-        if(this.tree.trackMouseOver !== false){\r
-            this.tree.innerCt.on('mouseover', this.delegateOver, this);\r
-            this.tree.innerCt.on('mouseout', this.delegateOut, this);\r
-        }\r
-        el.on('dblclick', this.delegateDblClick, this);\r
-        el.on('contextmenu', this.delegateContextMenu, this);\r
+        var t = this.tree;\r
+            \r
+        if(t.trackMouseOver !== false){\r
+            t.mon(t.innerCt, {\r
+                scope: this,\r
+                mouseover: this.delegateOver,\r
+                mouseout: this.delegateOut\r
+            });\r
+        }\r
+        t.mon(t.getTreeEl(), {\r
+            scope: this,\r
+            click: this.delegateClick,\r
+            dblclick: this.delegateDblClick,\r
+            contextmenu: this.delegateContextMenu\r
+        });\r
     },\r
 \r
     getNode : function(e){\r
     },\r
 \r
     getNode : function(e){\r
@@ -88,32 +96,42 @@ Ext.tree.TreeEventModel.prototype = {
     },\r
 \r
     delegateClick : function(e, t){\r
     },\r
 \r
     delegateClick : function(e, t){\r
-        if(!this.beforeEvent(e)){\r
-            return;\r
-        }\r
-\r
-        if(e.getTarget('input[type=checkbox]', 1)){\r
-            this.onCheckboxClick(e, this.getNode(e));\r
-        }\r
-        else if(e.getTarget('.x-tree-ec-icon', 1)){\r
-            this.onIconClick(e, this.getNode(e));\r
-        }\r
-        else if(this.getNodeTarget(e)){\r
-            this.onNodeClick(e, this.getNode(e));\r
+        if(this.beforeEvent(e)){\r
+            if(e.getTarget('input[type=checkbox]', 1)){\r
+                this.onCheckboxClick(e, this.getNode(e));\r
+            }else if(e.getTarget('.x-tree-ec-icon', 1)){\r
+                this.onIconClick(e, this.getNode(e));\r
+            }else if(this.getNodeTarget(e)){\r
+                this.onNodeClick(e, this.getNode(e));\r
+            }else{\r
+                this.onContainerEvent(e, 'click');\r
+            }\r
         }\r
     },\r
 \r
     delegateDblClick : function(e, t){\r
         }\r
     },\r
 \r
     delegateDblClick : function(e, t){\r
-        if(this.beforeEvent(e) && this.getNodeTarget(e)){\r
-            this.onNodeDblClick(e, this.getNode(e));\r
+        if(this.beforeEvent(e)){\r
+            if(this.getNodeTarget(e)){\r
+                this.onNodeDblClick(e, this.getNode(e));\r
+            }else{\r
+                this.onContainerEvent(e, 'dblclick');    \r
+            }\r
         }\r
     },\r
 \r
     delegateContextMenu : function(e, t){\r
         }\r
     },\r
 \r
     delegateContextMenu : function(e, t){\r
-        if(this.beforeEvent(e) && this.getNodeTarget(e)){\r
-            this.onNodeContextMenu(e, this.getNode(e));\r
+        if(this.beforeEvent(e)){\r
+            if(this.getNodeTarget(e)){\r
+                this.onNodeContextMenu(e, this.getNode(e));\r
+            }else{\r
+                this.onContainerEvent(e, 'contextmenu');    \r
+            }\r
         }\r
     },\r
         }\r
     },\r
+    \r
+    onContainerEvent: function(e, type){\r
+        this.tree.fireEvent('container' + type, this.tree, e); \r
+    },\r
 \r
     onNodeClick : function(e, node){\r
         node.ui.onClick(e);\r
 \r
     onNodeClick : function(e, node){\r
         node.ui.onClick(e);\r