1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
dojo.provide("dojo.widget.TreeLinkExtension");
|
|
|
12 |
dojo.require("dojo.widget.HtmlWidget");
|
|
|
13 |
dojo.require("dojo.widget.TreeExtension");
|
|
|
14 |
dojo.widget.defineWidget("dojo.widget.TreeLinkExtension", dojo.widget.TreeExtension, function () {
|
|
|
15 |
this.params = {};
|
|
|
16 |
}, {listenTreeEvents:["afterChangeTree"], listenTree:function (tree) {
|
|
|
17 |
dojo.widget.TreeCommon.prototype.listenTree.call(this, tree);
|
|
|
18 |
var labelNode = tree.labelNodeTemplate;
|
|
|
19 |
var newLabel = this.makeALabel();
|
|
|
20 |
dojo.html.setClass(newLabel, dojo.html.getClass(labelNode));
|
|
|
21 |
labelNode.parentNode.replaceChild(newLabel, labelNode);
|
|
|
22 |
}, makeALabel:function () {
|
|
|
23 |
var newLabel = document.createElement("a");
|
|
|
24 |
for (var key in this.params) {
|
|
|
25 |
if (key in {}) {
|
|
|
26 |
continue;
|
|
|
27 |
}
|
|
|
28 |
newLabel.setAttribute(key, this.params[key]);
|
|
|
29 |
}
|
|
|
30 |
return newLabel;
|
|
|
31 |
}, onAfterChangeTree:function (message) {
|
|
|
32 |
var _this = this;
|
|
|
33 |
if (!message.oldTree) {
|
|
|
34 |
this.listenNode(message.node);
|
|
|
35 |
}
|
|
|
36 |
}, listenNode:function (node) {
|
|
|
37 |
for (var key in node.object) {
|
|
|
38 |
if (key in {}) {
|
|
|
39 |
continue;
|
|
|
40 |
}
|
|
|
41 |
node.labelNode.setAttribute(key, node.object[key]);
|
|
|
42 |
}
|
|
|
43 |
}});
|
|
|
44 |
|