3
* Copyright(c) 2006-2008, Ext JS, LLC.
6
* http://extjs.com/license
9
Ext.tree.TreeEventModel = function(tree){
11
this.tree.on('render', this.initEvents, this);
14
Ext.tree.TreeEventModel.prototype = {
15
initEvents : function(){
16
var el = this.tree.getTreeEl();
17
el.on('click', this.delegateClick, this);
18
if(this.tree.trackMouseOver !== false){
19
el.on('mouseover', this.delegateOver, this);
20
el.on('mouseout', this.delegateOut, this);
22
el.on('dblclick', this.delegateDblClick, this);
23
el.on('contextmenu', this.delegateContextMenu, this);
26
getNode : function(e){
28
if(t = e.getTarget('.x-tree-node-el', 10)){
29
var id = Ext.fly(t, '_treeEvents').getAttributeNS('ext', 'tree-node-id');
31
return this.tree.getNodeById(id);
37
getNodeTarget : function(e){
38
var t = e.getTarget('.x-tree-node-icon', 1);
40
t = e.getTarget('.x-tree-node-el', 6);
45
delegateOut : function(e, t){
46
if(!this.beforeEvent(e)){
49
if(e.getTarget('.x-tree-ec-icon', 1)){
50
var n = this.getNode(e);
52
if(n == this.lastEcOver){
53
delete this.lastEcOver;
56
if((t = this.getNodeTarget(e)) && !e.within(t, true)){
57
this.onNodeOut(e, this.getNode(e));
61
delegateOver : function(e, t){
62
if(!this.beforeEvent(e)){
65
if(this.lastEcOver){ // prevent hung highlight
66
this.onIconOut(e, this.lastEcOver);
67
delete this.lastEcOver;
69
if(e.getTarget('.x-tree-ec-icon', 1)){
70
this.lastEcOver = this.getNode(e);
71
this.onIconOver(e, this.lastEcOver);
73
if(t = this.getNodeTarget(e)){
74
this.onNodeOver(e, this.getNode(e));
78
delegateClick : function(e, t){
79
if(!this.beforeEvent(e)){
83
if(e.getTarget('input[type=checkbox]', 1)){
84
this.onCheckboxClick(e, this.getNode(e));
86
else if(e.getTarget('.x-tree-ec-icon', 1)){
87
this.onIconClick(e, this.getNode(e));
89
else if(this.getNodeTarget(e)){
90
this.onNodeClick(e, this.getNode(e));
94
delegateDblClick : function(e, t){
95
if(this.beforeEvent(e) && this.getNodeTarget(e)){
96
this.onNodeDblClick(e, this.getNode(e));
100
delegateContextMenu : function(e, t){
101
if(this.beforeEvent(e) && this.getNodeTarget(e)){
102
this.onNodeContextMenu(e, this.getNode(e));
106
onNodeClick : function(e, node){
110
onNodeOver : function(e, node){
114
onNodeOut : function(e, node){
118
onIconOver : function(e, node){
119
node.ui.addClass('x-tree-ec-over');
122
onIconOut : function(e, node){
123
node.ui.removeClass('x-tree-ec-over');
126
onIconClick : function(e, node){
130
onCheckboxClick : function(e, node){
131
node.ui.onCheckChange(e);
134
onNodeDblClick : function(e, node){
135
node.ui.onDblClick(e);
138
onNodeContextMenu : function(e, node){
139
node.ui.onContextMenu(e);
142
beforeEvent : function(e){
151
this.disabled = true;
155
this.disabled = false;
b'\\ No newline at end of file'