]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/Tree.js
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
8 if(!dojo
._hasResource
["dijit.Tree"]){
9 dojo
._hasResource
["dijit.Tree"]=true;
10 dojo
.provide("dijit.Tree");
11 dojo
.require("dojo.fx");
12 dojo
.require("dojo.DeferredList");
13 dojo
.require("dijit._Widget");
14 dojo
.require("dijit._Templated");
15 dojo
.require("dijit._Container");
16 dojo
.require("dijit._Contained");
17 dojo
.require("dijit._CssStateMixin");
18 dojo
.require("dojo.cookie");
19 dojo
.declare("dijit._TreeNode",[dijit
._Widget
,dijit
._Templated
,dijit
._Container
,dijit
._Contained
,dijit
._CssStateMixin
],{item
:null,isTreeNode
:true,label
:"",isExpandable
:null,isExpanded
:false,state
:"UNCHECKED",templateString
:dojo
.cache("dijit","templates/TreeNode.html","<div class=\"dijitTreeNode\" waiRole=\"presentation\"\n\t><div dojoAttachPoint=\"rowNode\" class=\"dijitTreeRow\" waiRole=\"presentation\" dojoAttachEvent=\"onmouseenter:_onMouseEnter, onmouseleave:_onMouseLeave, onclick:_onClick, ondblclick:_onDblClick\"\n\t\t><img src=\"${_blankGif}\" alt=\"\" dojoAttachPoint=\"expandoNode\" class=\"dijitTreeExpando\" waiRole=\"presentation\"\n\t\t/><span dojoAttachPoint=\"expandoNodeText\" class=\"dijitExpandoText\" waiRole=\"presentation\"\n\t\t></span\n\t\t><span dojoAttachPoint=\"contentNode\"\n\t\t\tclass=\"dijitTreeContent\" waiRole=\"presentation\">\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" dojoAttachPoint=\"iconNode\" class=\"dijitIcon dijitTreeIcon\" waiRole=\"presentation\"\n\t\t\t/><span dojoAttachPoint=\"labelNode\" class=\"dijitTreeLabel\" wairole=\"treeitem\" tabindex=\"-1\" waiState=\"selected-false\" dojoAttachEvent=\"onfocus:_onLabelFocus\"></span>\n\t\t</span\n\t></div>\n\t<div dojoAttachPoint=\"containerNode\" class=\"dijitTreeContainer\" waiRole=\"presentation\" style=\"display: none;\"></div>\n</div>\n"),baseClass
:"dijitTreeNode",cssStateNodes
:{rowNode
:"dijitTreeRow",labelNode
:"dijitTreeLabel"},attributeMap
:dojo
.delegate(dijit
._Widget
.prototype.attributeMap
,{label
:{node
:"labelNode",type
:"innerText"},tooltip
:{node
:"rowNode",type
:"attribute",attribute
:"title"}}),postCreate:function(){
20 this.inherited(arguments
);
22 this._updateItemClasses(this.item
);
23 if(this.isExpandable
){
24 dijit
.setWaiState(this.labelNode
,"expanded",this.isExpanded
);
26 },_setIndentAttr:function(_1
){
28 var _2
=(Math
.max(_1
,0)*this.tree
._nodePixelIndent
)+"px";
29 dojo
.style(this.domNode
,"backgroundPosition",_2
+" 0px");
30 dojo
.style(this.rowNode
,this.isLeftToRight()?"paddingLeft":"paddingRight",_2
);
31 dojo
.forEach(this.getChildren(),function(_3
){
32 _3
.set("indent",_1
+1);
34 },markProcessing:function(){
36 this._setExpando(true);
37 },unmarkProcessing:function(){
38 this._setExpando(false);
39 },_updateItemClasses:function(_4
){
40 var _5
=this.tree
,_6
=_5
.model
;
41 if(_5
._v10Compat
&&_4
===_6
.root
){
44 this._applyClassAndStyle(_4
,"icon","Icon");
45 this._applyClassAndStyle(_4
,"label","Label");
46 this._applyClassAndStyle(_4
,"row","Row");
47 },_applyClassAndStyle:function(_7
,_8
,_9
){
48 var _a
="_"+_8
+"Class";
51 dojo
.removeClass(this[_b
],this[_a
]);
53 this[_a
]=this.tree
["get"+_9
+"Class"](_7
,this.isExpanded
);
55 dojo
.addClass(this[_b
],this[_a
]);
57 dojo
.style(this[_b
],this.tree
["get"+_9
+"Style"](_7
,this.isExpanded
)||{});
58 },_updateLayout:function(){
59 var _c
=this.getParent();
60 if(!_c
||_c
.rowNode
.style
.display
=="none"){
61 dojo
.addClass(this.domNode
,"dijitTreeIsRoot");
63 dojo
.toggleClass(this.domNode
,"dijitTreeIsLast",!this.getNextSibling());
65 },_setExpando:function(_d
){
66 var _e
=["dijitTreeExpandoLoading","dijitTreeExpandoOpened","dijitTreeExpandoClosed","dijitTreeExpandoLeaf"],_f
=["*","-","+","*"],idx
=_d
?0:(this.isExpandable
?(this.isExpanded
?1:2):3);
67 dojo
.removeClass(this.expandoNode
,_e
);
68 dojo
.addClass(this.expandoNode
,_e
[idx
]);
69 this.expandoNodeText
.innerHTML
=_f
[idx
];
71 if(this._expandDeferred
){
72 return this._expandDeferred
;
74 this._wipeOut
&&this._wipeOut
.stop();
76 dijit
.setWaiState(this.labelNode
,"expanded","true");
77 dijit
.setWaiRole(this.containerNode
,"group");
78 dojo
.addClass(this.contentNode
,"dijitTreeContentExpanded");
80 this._updateItemClasses(this.item
);
81 if(this==this.tree
.rootNode
){
82 dijit
.setWaiState(this.tree
.domNode
,"expanded","true");
84 var def
,_10
=dojo
.fx
.wipeIn({node
:this.containerNode
,duration
:dijit
.defaultDuration
,onEnd:function(){
87 def
=(this._expandDeferred
=new dojo
.Deferred(function(){
92 },collapse:function(){
96 if(this._expandDeferred
){
97 this._expandDeferred
.cancel();
98 delete this._expandDeferred
;
100 this.isExpanded
=false;
101 dijit
.setWaiState(this.labelNode
,"expanded","false");
102 if(this==this.tree
.rootNode
){
103 dijit
.setWaiState(this.tree
.domNode
,"expanded","false");
105 dojo
.removeClass(this.contentNode
,"dijitTreeContentExpanded");
107 this._updateItemClasses(this.item
);
109 this._wipeOut
=dojo
.fx
.wipeOut({node
:this.containerNode
,duration
:dijit
.defaultDuration
});
111 this._wipeOut
.play();
112 },indent
:0,setChildItems:function(_11
){
113 var _12
=this.tree
,_13
=_12
.model
,_14
=[];
114 dojo
.forEach(this.getChildren(),function(_15
){
115 dijit
._Container
.prototype.removeChild
.call(this,_15
);
118 if(_11
&&_11
.length
>0){
119 this.isExpandable
=true;
120 dojo
.forEach(_11
,function(_16
){
121 var id
=_13
.getIdentity(_16
),_17
=_12
._itemNodesMap
[id
],_18
;
123 for(var i
=0;i
<_17
.length
;i
++){
124 if(_17
[i
]&&!_17
[i
].getParent()){
126 _18
.set("indent",this.indent
+1);
132 _18
=this.tree
._createTreeNode({item
:_16
,tree
:_12
,isExpandable
:_13
.mayHaveChildren(_16
),label
:_12
.getLabel(_16
),tooltip
:_12
.getTooltip(_16
),dir
:_12
.dir
,lang
:_12
.lang
,indent
:this.indent
+1});
136 _12
._itemNodesMap
[id
]=[_18
];
140 if(this.tree
.autoExpand
||this.tree
._state(_16
)){
141 _14
.push(_12
._expandNode(_18
));
144 dojo
.forEach(this.getChildren(),function(_19
,idx
){
148 this.isExpandable
=false;
150 if(this._setExpando
){
151 this._setExpando(false);
153 this._updateItemClasses(this.item
);
154 if(this==_12
.rootNode
){
155 var fc
=this.tree
.showRoot
?this:this.getChildren()[0];
157 fc
.setFocusable(true);
160 _12
.domNode
.setAttribute("tabIndex","0");
163 return new dojo
.DeferredList(_14
);
164 },removeChild:function(_1a
){
165 this.inherited(arguments
);
166 var _1b
=this.getChildren();
168 this.isExpandable
=false;
171 dojo
.forEach(_1b
,function(_1c
){
174 },makeExpandable:function(){
175 this.isExpandable
=true;
176 this._setExpando(false);
177 },_onLabelFocus:function(evt
){
178 this.tree
._onNodeFocus(this);
179 },setSelected:function(_1d
){
180 dijit
.setWaiState(this.labelNode
,"selected",_1d
);
181 dojo
.toggleClass(this.rowNode
,"dijitTreeRowSelected",_1d
);
182 },setFocusable:function(_1e
){
183 this.labelNode
.setAttribute("tabIndex",_1e
?"0":"-1");
184 },_onClick:function(evt
){
185 this.tree
._onClick(this,evt
);
186 },_onDblClick:function(evt
){
187 this.tree
._onDblClick(this,evt
);
188 },_onMouseEnter:function(evt
){
189 this.tree
._onNodeMouseEnter(this,evt
);
190 },_onMouseLeave:function(evt
){
191 this.tree
._onNodeMouseLeave(this,evt
);
193 dojo
.declare("dijit.Tree",[dijit
._Widget
,dijit
._Templated
],{store
:null,model
:null,query
:null,label
:"",showRoot
:true,childrenAttr
:["children"],path
:[],selectedItem
:null,openOnClick
:false,openOnDblClick
:false,templateString
:dojo
.cache("dijit","templates/Tree.html","<div class=\"dijitTree dijitTreeContainer\" waiRole=\"tree\"\n\tdojoAttachEvent=\"onkeypress:_onKeyPress\">\n\t<div class=\"dijitInline dijitTreeIndent\" style=\"position: absolute; top: -9999px\" dojoAttachPoint=\"indentDetector\"></div>\n</div>\n"),persist
:true,autoExpand
:false,dndController
:null,dndParams
:["onDndDrop","itemCreator","onDndCancel","checkAcceptance","checkItemAcceptance","dragThreshold","betweenThreshold"],onDndDrop
:null,itemCreator
:null,onDndCancel
:null,checkAcceptance
:null,checkItemAcceptance
:null,dragThreshold
:5,betweenThreshold
:0,_nodePixelIndent
:19,_publish:function(_1f
,_20
){
194 dojo
.publish(this.id
,[dojo
.mixin({tree
:this,event
:_1f
},_20
||{})]);
195 },postMixInProperties:function(){
200 this._itemNodesMap
={};
201 if(!this.cookieName
){
202 this.cookieName
=this.id
+"SaveStateCookie";
204 this._loadDeferred
=new dojo
.Deferred();
205 this.inherited(arguments
);
206 },postCreate:function(){
211 this.connect(this.model
,"onChange","_onItemChange");
212 this.connect(this.model
,"onChildrenChange","_onItemChildrenChange");
213 this.connect(this.model
,"onDelete","_onItemDelete");
215 this.inherited(arguments
);
216 if(this.dndController
){
217 if(dojo
.isString(this.dndController
)){
218 this.dndController
=dojo
.getObject(this.dndController
);
221 for(var i
=0;i
<this.dndParams
.length
;i
++){
222 if(this[this.dndParams
[i
]]){
223 _21
[this.dndParams
[i
]]=this[this.dndParams
[i
]];
226 this.dndController
=new this.dndController(this,_21
);
228 },_store2model:function(){
229 this._v10Compat
=true;
230 dojo
.deprecated("Tree: from version 2.0, should specify a model object rather than a store/query");
231 var _22
={id
:this.id
+"_ForestStoreModel",store
:this.store
,query
:this.query
,childrenAttrs
:this.childrenAttr
};
232 if(this.params
.mayHaveChildren
){
233 _22
.mayHaveChildren
=dojo
.hitch(this,"mayHaveChildren");
235 if(this.params
.getItemChildren
){
236 _22
.getChildren
=dojo
.hitch(this,function(_23
,_24
,_25
){
237 this.getItemChildren((this._v10Compat
&&_23
===this.model
.root
)?null:_23
,_24
,_25
);
240 this.model
=new dijit
.tree
.ForestStoreModel(_22
);
241 this.showRoot
=Boolean(this.label
);
244 this.model
.getRoot(dojo
.hitch(this,function(_26
){
245 var rn
=(this.rootNode
=this.tree
._createTreeNode({item
:_26
,tree
:this,isExpandable
:true,label
:this.label
||this.getLabel(_26
),indent
:this.showRoot
?0:-1}));
247 rn
.rowNode
.style
.display
="none";
249 this.domNode
.appendChild(rn
.domNode
);
250 var _27
=this.model
.getIdentity(_26
);
251 if(this._itemNodesMap
[_27
]){
252 this._itemNodesMap
[_27
].push(rn
);
254 this._itemNodesMap
[_27
]=[rn
];
257 this._expandNode(rn
).addCallback(dojo
.hitch(this,function(){
258 this._loadDeferred
.callback(true);
262 console
.error(this,": error loading root: ",err
);
264 },getNodesByItem:function(_28
){
268 var _29
=dojo
.isString(_28
)?_28
:this.model
.getIdentity(_28
);
269 return [].concat(this._itemNodesMap
[_29
]);
270 },_setSelectedItemAttr:function(_2a
){
271 var _2b
=this.get("selectedItem");
272 var _2c
=(!_2a
||dojo
.isString(_2a
))?_2a
:this.model
.getIdentity(_2a
);
273 if(_2c
==_2b
?this.model
.getIdentity(_2b
):null){
276 var _2d
=this._itemNodesMap
[_2c
];
277 this._selectNode((_2d
&&_2d
[0])||null);
278 },_getSelectedItemAttr:function(){
279 return this.selectedNode
&&this.selectedNode
.item
;
280 },_setPathAttr:function(_2e
){
281 var d
=new dojo
.Deferred();
282 this._selectNode(null);
283 if(!_2e
||!_2e
.length
){
287 this._loadDeferred
.addCallback(dojo
.hitch(this,function(){
289 d
.reject(new Error("!this.rootNode"));
292 if(_2e
[0]!==this.rootNode
.item
&&(dojo
.isString(_2e
[0])&&_2e
[0]!=this.model
.getIdentity(this.rootNode
.item
))){
293 d
.reject(new Error(this.id
+":path[0] doesn't match this.rootNode.item. Maybe you are using the wrong tree."));
297 var _2f
=this.rootNode
;
299 var _31
=_2e
.shift(),_32
=dojo
.isString(_31
)?_31
:this.model
.getIdentity(_31
);
300 dojo
.some(this._itemNodesMap
[_32
],function(n
){
301 if(n
.getParent()==_2f
){
308 this._expandNode(_2f
).addCallback(dojo
.hitch(this,_30
));
310 this._selectNode(_2f
);
314 this._expandNode(_2f
).addCallback(dojo
.hitch(this,_30
));
317 },_getPathAttr:function(){
318 if(!this.selectedNode
){
322 var _33
=this.selectedNode
;
323 while(_33
&&_33
!==this.rootNode
){
324 res
.unshift(_33
.item
);
327 res
.unshift(this.rootNode
.item
);
329 },mayHaveChildren:function(_34
){
330 },getItemChildren:function(_35
,_36
){
331 },getLabel:function(_37
){
332 return this.model
.getLabel(_37
);
333 },getIconClass:function(_38
,_39
){
334 return (!_38
||this.model
.mayHaveChildren(_38
))?(_39
?"dijitFolderOpened":"dijitFolderClosed"):"dijitLeaf";
335 },getLabelClass:function(_3a
,_3b
){
336 },getRowClass:function(_3c
,_3d
){
337 },getIconStyle:function(_3e
,_3f
){
338 },getLabelStyle:function(_40
,_41
){
339 },getRowStyle:function(_42
,_43
){
340 },getTooltip:function(_44
){
342 },_onKeyPress:function(e
){
347 var _45
=dijit
.getEnclosingWidget(e
.target
);
351 var key
=e
.charOrCode
;
352 if(typeof key
=="string"){
353 if(!e
.altKey
&&!e
.ctrlKey
&&!e
.shiftKey
&&!e
.metaKey
){
354 this._onLetterKeyNav({node
:_45
,key
:key
.toLowerCase()});
359 clearTimeout(this._curSearch
.timer
);
360 delete this._curSearch
;
362 var map
=this._keyHandlerMap
;
365 map
[dk
.ENTER
]="_onEnterKey";
366 map
[this.isLeftToRight()?dk
.LEFT_ARROW
:dk
.RIGHT_ARROW
]="_onLeftArrow";
367 map
[this.isLeftToRight()?dk
.RIGHT_ARROW
:dk
.LEFT_ARROW
]="_onRightArrow";
368 map
[dk
.UP_ARROW
]="_onUpArrow";
369 map
[dk
.DOWN_ARROW
]="_onDownArrow";
370 map
[dk
.HOME
]="_onHomeKey";
371 map
[dk
.END
]="_onEndKey";
372 this._keyHandlerMap
=map
;
374 if(this._keyHandlerMap
[key
]){
375 this[this._keyHandlerMap
[key
]]({node
:_45
,item
:_45
.item
,evt
:e
});
379 },_onEnterKey:function(_46
,evt
){
380 this._publish("execute",{item
:_46
.item
,node
:_46
.node
});
381 this._selectNode(_46
.node
);
382 this.onClick(_46
.item
,_46
.node
,evt
);
383 },_onDownArrow:function(_47
){
384 var _48
=this._getNextNode(_47
.node
);
385 if(_48
&&_48
.isTreeNode
){
388 },_onUpArrow:function(_49
){
390 var _4b
=_4a
.getPreviousSibling();
393 while(_4a
.isExpandable
&&_4a
.isExpanded
&&_4a
.hasChildren()){
394 var _4c
=_4a
.getChildren();
395 _4a
=_4c
[_4c
.length
-1];
398 var _4d
=_4a
.getParent();
399 if(!(!this.showRoot
&&_4d
===this.rootNode
)){
403 if(_4a
&&_4a
.isTreeNode
){
406 },_onRightArrow:function(_4e
){
408 if(_4f
.isExpandable
&&!_4f
.isExpanded
){
409 this._expandNode(_4f
);
411 if(_4f
.hasChildren()){
412 _4f
=_4f
.getChildren()[0];
413 if(_4f
&&_4f
.isTreeNode
){
418 },_onLeftArrow:function(_50
){
420 if(_51
.isExpandable
&&_51
.isExpanded
){
421 this._collapseNode(_51
);
423 var _52
=_51
.getParent();
424 if(_52
&&_52
.isTreeNode
&&!(!this.showRoot
&&_52
===this.rootNode
)){
428 },_onHomeKey:function(){
429 var _53
=this._getRootOrFirstNode();
433 },_onEndKey:function(_54
){
434 var _55
=this.rootNode
;
435 while(_55
.isExpanded
){
436 var c
=_55
.getChildren();
439 if(_55
&&_55
.isTreeNode
){
442 },multiCharSearchDuration
:250,_onLetterKeyNav:function(_56
){
443 var cs
=this._curSearch
;
445 cs
.pattern
=cs
.pattern
+_56
.key
;
446 clearTimeout(cs
.timer
);
448 cs
=this._curSearch
={pattern
:_56
.key
,startNode
:_56
.node
};
451 cs
.timer
=setTimeout(function(){
452 delete _57
._curSearch
;
453 },this.multiCharSearchDuration
);
454 var _58
=cs
.startNode
;
456 _58
=this._getNextNode(_58
);
458 _58
=this._getRootOrFirstNode();
460 }while(_58
!==cs
.startNode
&&(_58
.label
.toLowerCase().substr(0,cs
.pattern
.length
)!=cs
.pattern
));
461 if(_58
&&_58
.isTreeNode
){
462 if(_58
!==cs
.startNode
){
466 },_onClick:function(_59
,e
){
467 var _5a
=e
.target
,_5b
=(_5a
==_59
.expandoNode
||_5a
==_59
.expandoNodeText
);
468 if((this.openOnClick
&&_59
.isExpandable
)||_5b
){
469 if(_59
.isExpandable
){
470 this._onExpandoClick({node
:_59
});
473 this._publish("execute",{item
:_59
.item
,node
:_59
,evt
:e
});
474 this.onClick(_59
.item
,_59
,e
);
478 this._selectNode(_59
);
481 },_onDblClick:function(_5c
,e
){
482 var _5d
=e
.target
,_5e
=(_5d
==_5c
.expandoNode
||_5d
==_5c
.expandoNodeText
);
483 if((this.openOnDblClick
&&_5c
.isExpandable
)||_5e
){
484 if(_5c
.isExpandable
){
485 this._onExpandoClick({node
:_5c
});
488 this._publish("execute",{item
:_5c
.item
,node
:_5c
,evt
:e
});
489 this.onDblClick(_5c
.item
,_5c
,e
);
493 this._selectNode(_5c
);
496 },_onExpandoClick:function(_5f
){
500 this._collapseNode(_60
);
502 this._expandNode(_60
);
504 },onClick:function(_61
,_62
,evt
){
505 },onDblClick:function(_63
,_64
,evt
){
506 },onOpen:function(_65
,_66
){
507 },onClose:function(_67
,_68
){
508 },_getNextNode:function(_69
){
509 if(_69
.isExpandable
&&_69
.isExpanded
&&_69
.hasChildren()){
510 return _69
.getChildren()[0];
512 while(_69
&&_69
.isTreeNode
){
513 var _6a
=_69
.getNextSibling();
521 },_getRootOrFirstNode:function(){
522 return this.showRoot
?this.rootNode
:this.rootNode
.getChildren()[0];
523 },_collapseNode:function(_6b
){
524 if(_6b
._expandNodeDeferred
){
525 delete _6b
._expandNodeDeferred
;
527 if(_6b
.isExpandable
){
528 if(_6b
.state
=="LOADING"){
532 this.onClose(_6b
.item
,_6b
);
534 this._state(_6b
.item
,false);
538 },_expandNode:function(_6c
,_6d
){
539 if(_6c
._expandNodeDeferred
&&!_6d
){
540 return _6c
._expandNodeDeferred
;
542 var _6e
=this.model
,_6f
=_6c
.item
,_70
=this;
545 _6c
.markProcessing();
546 var def
=(_6c
._expandNodeDeferred
=new dojo
.Deferred());
547 _6e
.getChildren(_6f
,function(_71
){
548 _6c
.unmarkProcessing();
549 var _72
=_6c
.setChildItems(_71
);
550 var ed
=_70
._expandNode(_6c
,true);
551 _72
.addCallback(function(){
552 ed
.addCallback(function(){
557 console
.error(_70
,": error loading root children: ",err
);
561 def
=(_6c
._expandNodeDeferred
=_6c
.expand());
562 this.onOpen(_6c
.item
,_6c
);
564 this._state(_6f
,true);
569 },focusNode:function(_73
){
570 dijit
.focus(_73
.labelNode
);
571 },_selectNode:function(_74
){
572 if(this.selectedNode
&&!this.selectedNode
._destroyed
){
573 this.selectedNode
.setSelected(false);
576 _74
.setSelected(true);
578 this.selectedNode
=_74
;
579 },_onNodeFocus:function(_75
){
580 if(_75
&&_75
!=this.lastFocused
){
581 if(this.lastFocused
&&!this.lastFocused
._destroyed
){
582 this.lastFocused
.setFocusable(false);
584 _75
.setFocusable(true);
585 this.lastFocused
=_75
;
587 },_onNodeMouseEnter:function(_76
){
588 },_onNodeMouseLeave:function(_77
){
589 },_onItemChange:function(_78
){
590 var _79
=this.model
,_7a
=_79
.getIdentity(_78
),_7b
=this._itemNodesMap
[_7a
];
592 var _7c
=this.getLabel(_78
),_7d
=this.getTooltip(_78
);
593 dojo
.forEach(_7b
,function(_7e
){
594 _7e
.set({item
:_78
,label
:_7c
,tooltip
:_7d
});
595 _7e
._updateItemClasses(_78
);
598 },_onItemChildrenChange:function(_7f
,_80
){
599 var _81
=this.model
,_82
=_81
.getIdentity(_7f
),_83
=this._itemNodesMap
[_82
];
601 dojo
.forEach(_83
,function(_84
){
602 _84
.setChildItems(_80
);
605 },_onItemDelete:function(_85
){
606 var _86
=this.model
,_87
=_86
.getIdentity(_85
),_88
=this._itemNodesMap
[_87
];
608 dojo
.forEach(_88
,function(_89
){
609 var _8a
=_89
.getParent();
611 _8a
.removeChild(_89
);
613 _89
.destroyRecursive();
615 delete this._itemNodesMap
[_87
];
617 },_initState:function(){
619 var _8b
=dojo
.cookie(this.cookieName
);
620 this._openedItemIds
={};
622 dojo
.forEach(_8b
.split(","),function(_8c
){
623 this._openedItemIds
[_8c
]=true;
627 },_state:function(_8d
,_8e
){
631 var id
=this.model
.getIdentity(_8d
);
632 if(arguments
.length
===1){
633 return this._openedItemIds
[id
];
636 this._openedItemIds
[id
]=true;
638 delete this._openedItemIds
[id
];
640 },_saveState:function(){
645 for(var id
in this._openedItemIds
){
648 dojo
.cookie(this.cookieName
,ary
.join(","),{expires
:365});
649 },destroy:function(){
651 clearTimeout(this._curSearch
.timer
);
652 delete this._curSearch
;
655 this.rootNode
.destroyRecursive();
657 if(this.dndController
&&!dojo
.isString(this.dndController
)){
658 this.dndController
.destroy();
661 this.inherited(arguments
);
662 },destroyRecursive:function(){
664 },resize:function(_8f
){
666 dojo
.marginBox(this.domNode
,_8f
);
667 dojo
.style(this.domNode
,"overflow","auto");
669 this._nodePixelIndent
=dojo
.marginBox(this.tree
.indentDetector
).w
;
670 if(this.tree
.rootNode
){
671 this.tree
.rootNode
.set("indent",this.showRoot
?0:-1);
673 },_createTreeNode:function(_90
){
674 return new dijit
._TreeNode(_90
);
676 dojo
.require("dijit.tree.TreeStoreModel");
677 dojo
.require("dijit.tree.ForestStoreModel");