1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/**
* Copyright (c) 2008-2009 The Open Source Geospatial Foundation
*
* Published under the BSD license.
* See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
* of the license.
*/
Ext.namespace("GeoExt.tree");
/** api: (define)
* module = GeoExt.tree
* class = TreeNodeUIEventMixin
*/
/** api: constructor
* A mixin that adds events to TreeNodeUIs. With these events, tree plugins
* can modify the node ui's DOM when it is rendered, and react to raw click
* events on tree nodes.
*/
/** api: example
* Sample code to create a tree with a node that uses the
* :class:`GeoExt.tree.TreeNodeUIEventMixin`:
*
* .. code-block:: javascript
*
* var UIClass = Ext.extend(
* Ext.tree.TreeNodeUI,
* GeoExt.tree.TreeNodeUIEventMixin
* );
* var tree = new Ext.tree.TreePanel({
* root: {
* nodeType: "node",
* uiProvider: UIClass,
* text: "My Node"
* }
* }
*/
GeoExt.tree.TreeNodeUIEventMixin = function(){
return {
constructor: function(node) {
node.addEvents(
/** api: event[rendernode]
* Fires on the tree when a node is rendered.
*
* Listener arguments:
*
* * node - ``Ext.TreeNode`` The rendered node.
*/
"rendernode",
/** api: event[rawclicknode]
* Fires on the tree when a node is clicked.
*
* Listener arguments:
*
* * node - ``Ext.TreeNode`` The clicked node.
* * event - ``Ext.EventObject`` The click event.
*/
"rawclicknode"
);
this.superclass = arguments.callee.superclass;
this.superclass.constructor.apply(this, arguments);
},
/** private: method[render]
* :param bulkRender: ``Boolean``
*/
render: function(bulkRender) {
if(!this.rendered) {
this.superclass.render.apply(this, arguments);
this.fireEvent("rendernode", this.node);
}
},
/** private: method[onClick]
* :param e: ``Ext.EventObject``
*/
onClick: function(e) {
if(this.fireEvent("rawclicknode", this.node, e) !== false) {
this.superclass.onClick.apply(this, arguments);
}
}
};
};
|