]> git.wh0rd.org - tt-rss.git/blame - lib/dijit/Tree.js
add dijit/dojo stuff; initial ui mockup
[tt-rss.git] / lib / dijit / Tree.js
CommitLineData
2f01fe57
AD
1/*
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
5*/
6
7
8if(!dojo._hasResource["dijit.Tree"]){
9dojo._hasResource["dijit.Tree"]=true;
10dojo.provide("dijit.Tree");
11dojo.require("dojo.fx");
12dojo.require("dojo.DeferredList");
13dojo.require("dijit._Widget");
14dojo.require("dijit._Templated");
15dojo.require("dijit._Container");
16dojo.require("dijit._Contained");
17dojo.require("dijit._CssStateMixin");
18dojo.require("dojo.cookie");
19dojo.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(){
20this.inherited(arguments);
21this._setExpando();
22this._updateItemClasses(this.item);
23if(this.isExpandable){
24dijit.setWaiState(this.labelNode,"expanded",this.isExpanded);
25}
26},_setIndentAttr:function(_1){
27this.indent=_1;
28var _2=(Math.max(_1,0)*this.tree._nodePixelIndent)+"px";
29dojo.style(this.domNode,"backgroundPosition",_2+" 0px");
30dojo.style(this.rowNode,this.isLeftToRight()?"paddingLeft":"paddingRight",_2);
31dojo.forEach(this.getChildren(),function(_3){
32_3.set("indent",_1+1);
33});
34},markProcessing:function(){
35this.state="LOADING";
36this._setExpando(true);
37},unmarkProcessing:function(){
38this._setExpando(false);
39},_updateItemClasses:function(_4){
40var _5=this.tree,_6=_5.model;
41if(_5._v10Compat&&_4===_6.root){
42_4=null;
43}
44this._applyClassAndStyle(_4,"icon","Icon");
45this._applyClassAndStyle(_4,"label","Label");
46this._applyClassAndStyle(_4,"row","Row");
47},_applyClassAndStyle:function(_7,_8,_9){
48var _a="_"+_8+"Class";
49var _b=_8+"Node";
50if(this[_a]){
51dojo.removeClass(this[_b],this[_a]);
52}
53this[_a]=this.tree["get"+_9+"Class"](_7,this.isExpanded);
54if(this[_a]){
55dojo.addClass(this[_b],this[_a]);
56}
57dojo.style(this[_b],this.tree["get"+_9+"Style"](_7,this.isExpanded)||{});
58},_updateLayout:function(){
59var _c=this.getParent();
60if(!_c||_c.rowNode.style.display=="none"){
61dojo.addClass(this.domNode,"dijitTreeIsRoot");
62}else{
63dojo.toggleClass(this.domNode,"dijitTreeIsLast",!this.getNextSibling());
64}
65},_setExpando:function(_d){
66var _e=["dijitTreeExpandoLoading","dijitTreeExpandoOpened","dijitTreeExpandoClosed","dijitTreeExpandoLeaf"],_f=["*","-","+","*"],idx=_d?0:(this.isExpandable?(this.isExpanded?1:2):3);
67dojo.removeClass(this.expandoNode,_e);
68dojo.addClass(this.expandoNode,_e[idx]);
69this.expandoNodeText.innerHTML=_f[idx];
70},expand:function(){
71if(this._expandDeferred){
72return this._expandDeferred;
73}
74this._wipeOut&&this._wipeOut.stop();
75this.isExpanded=true;
76dijit.setWaiState(this.labelNode,"expanded","true");
77dijit.setWaiRole(this.containerNode,"group");
78dojo.addClass(this.contentNode,"dijitTreeContentExpanded");
79this._setExpando();
80this._updateItemClasses(this.item);
81if(this==this.tree.rootNode){
82dijit.setWaiState(this.tree.domNode,"expanded","true");
83}
84var def,_10=dojo.fx.wipeIn({node:this.containerNode,duration:dijit.defaultDuration,onEnd:function(){
85def.callback(true);
86}});
87def=(this._expandDeferred=new dojo.Deferred(function(){
88_10.stop();
89}));
90_10.play();
91return def;
92},collapse:function(){
93if(!this.isExpanded){
94return;
95}
96if(this._expandDeferred){
97this._expandDeferred.cancel();
98delete this._expandDeferred;
99}
100this.isExpanded=false;
101dijit.setWaiState(this.labelNode,"expanded","false");
102if(this==this.tree.rootNode){
103dijit.setWaiState(this.tree.domNode,"expanded","false");
104}
105dojo.removeClass(this.contentNode,"dijitTreeContentExpanded");
106this._setExpando();
107this._updateItemClasses(this.item);
108if(!this._wipeOut){
109this._wipeOut=dojo.fx.wipeOut({node:this.containerNode,duration:dijit.defaultDuration});
110}
111this._wipeOut.play();
112},indent:0,setChildItems:function(_11){
113var _12=this.tree,_13=_12.model,_14=[];
114dojo.forEach(this.getChildren(),function(_15){
115dijit._Container.prototype.removeChild.call(this,_15);
116},this);
117this.state="LOADED";
118if(_11&&_11.length>0){
119this.isExpandable=true;
120dojo.forEach(_11,function(_16){
121var id=_13.getIdentity(_16),_17=_12._itemNodesMap[id],_18;
122if(_17){
123for(var i=0;i<_17.length;i++){
124if(_17[i]&&!_17[i].getParent()){
125_18=_17[i];
126_18.set("indent",this.indent+1);
127break;
128}
129}
130}
131if(!_18){
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});
133if(_17){
134_17.push(_18);
135}else{
136_12._itemNodesMap[id]=[_18];
137}
138}
139this.addChild(_18);
140if(this.tree.autoExpand||this.tree._state(_16)){
141_14.push(_12._expandNode(_18));
142}
143},this);
144dojo.forEach(this.getChildren(),function(_19,idx){
145_19._updateLayout();
146});
147}else{
148this.isExpandable=false;
149}
150if(this._setExpando){
151this._setExpando(false);
152}
153this._updateItemClasses(this.item);
154if(this==_12.rootNode){
155var fc=this.tree.showRoot?this:this.getChildren()[0];
156if(fc){
157fc.setFocusable(true);
158_12.lastFocused=fc;
159}else{
160_12.domNode.setAttribute("tabIndex","0");
161}
162}
163return new dojo.DeferredList(_14);
164},removeChild:function(_1a){
165this.inherited(arguments);
166var _1b=this.getChildren();
167if(_1b.length==0){
168this.isExpandable=false;
169this.collapse();
170}
171dojo.forEach(_1b,function(_1c){
172_1c._updateLayout();
173});
174},makeExpandable:function(){
175this.isExpandable=true;
176this._setExpando(false);
177},_onLabelFocus:function(evt){
178this.tree._onNodeFocus(this);
179},setSelected:function(_1d){
180dijit.setWaiState(this.labelNode,"selected",_1d);
181dojo.toggleClass(this.rowNode,"dijitTreeRowSelected",_1d);
182},setFocusable:function(_1e){
183this.labelNode.setAttribute("tabIndex",_1e?"0":"-1");
184},_onClick:function(evt){
185this.tree._onClick(this,evt);
186},_onDblClick:function(evt){
187this.tree._onDblClick(this,evt);
188},_onMouseEnter:function(evt){
189this.tree._onNodeMouseEnter(this,evt);
190},_onMouseLeave:function(evt){
191this.tree._onNodeMouseLeave(this,evt);
192}});
193dojo.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){
194dojo.publish(this.id,[dojo.mixin({tree:this,event:_1f},_20||{})]);
195},postMixInProperties:function(){
196this.tree=this;
197if(this.autoExpand){
198this.persist=false;
199}
200this._itemNodesMap={};
201if(!this.cookieName){
202this.cookieName=this.id+"SaveStateCookie";
203}
204this._loadDeferred=new dojo.Deferred();
205this.inherited(arguments);
206},postCreate:function(){
207this._initState();
208if(!this.model){
209this._store2model();
210}
211this.connect(this.model,"onChange","_onItemChange");
212this.connect(this.model,"onChildrenChange","_onItemChildrenChange");
213this.connect(this.model,"onDelete","_onItemDelete");
214this._load();
215this.inherited(arguments);
216if(this.dndController){
217if(dojo.isString(this.dndController)){
218this.dndController=dojo.getObject(this.dndController);
219}
220var _21={};
221for(var i=0;i<this.dndParams.length;i++){
222if(this[this.dndParams[i]]){
223_21[this.dndParams[i]]=this[this.dndParams[i]];
224}
225}
226this.dndController=new this.dndController(this,_21);
227}
228},_store2model:function(){
229this._v10Compat=true;
230dojo.deprecated("Tree: from version 2.0, should specify a model object rather than a store/query");
231var _22={id:this.id+"_ForestStoreModel",store:this.store,query:this.query,childrenAttrs:this.childrenAttr};
232if(this.params.mayHaveChildren){
233_22.mayHaveChildren=dojo.hitch(this,"mayHaveChildren");
234}
235if(this.params.getItemChildren){
236_22.getChildren=dojo.hitch(this,function(_23,_24,_25){
237this.getItemChildren((this._v10Compat&&_23===this.model.root)?null:_23,_24,_25);
238});
239}
240this.model=new dijit.tree.ForestStoreModel(_22);
241this.showRoot=Boolean(this.label);
242},onLoad:function(){
243},_load:function(){
244this.model.getRoot(dojo.hitch(this,function(_26){
245var rn=(this.rootNode=this.tree._createTreeNode({item:_26,tree:this,isExpandable:true,label:this.label||this.getLabel(_26),indent:this.showRoot?0:-1}));
246if(!this.showRoot){
247rn.rowNode.style.display="none";
248}
249this.domNode.appendChild(rn.domNode);
250var _27=this.model.getIdentity(_26);
251if(this._itemNodesMap[_27]){
252this._itemNodesMap[_27].push(rn);
253}else{
254this._itemNodesMap[_27]=[rn];
255}
256rn._updateLayout();
257this._expandNode(rn).addCallback(dojo.hitch(this,function(){
258this._loadDeferred.callback(true);
259this.onLoad();
260}));
261}),function(err){
262console.error(this,": error loading root: ",err);
263});
264},getNodesByItem:function(_28){
265if(!_28){
266return [];
267}
268var _29=dojo.isString(_28)?_28:this.model.getIdentity(_28);
269return [].concat(this._itemNodesMap[_29]);
270},_setSelectedItemAttr:function(_2a){
271var _2b=this.get("selectedItem");
272var _2c=(!_2a||dojo.isString(_2a))?_2a:this.model.getIdentity(_2a);
273if(_2c==_2b?this.model.getIdentity(_2b):null){
274return;
275}
276var _2d=this._itemNodesMap[_2c];
277this._selectNode((_2d&&_2d[0])||null);
278},_getSelectedItemAttr:function(){
279return this.selectedNode&&this.selectedNode.item;
280},_setPathAttr:function(_2e){
281var d=new dojo.Deferred();
282this._selectNode(null);
283if(!_2e||!_2e.length){
284d.resolve(true);
285return d;
286}
287this._loadDeferred.addCallback(dojo.hitch(this,function(){
288if(!this.rootNode){
289d.reject(new Error("!this.rootNode"));
290return;
291}
292if(_2e[0]!==this.rootNode.item&&(dojo.isString(_2e[0])&&_2e[0]!=this.model.getIdentity(this.rootNode.item))){
293d.reject(new Error(this.id+":path[0] doesn't match this.rootNode.item. Maybe you are using the wrong tree."));
294return;
295}
296_2e.shift();
297var _2f=this.rootNode;
298function _30(){
299var _31=_2e.shift(),_32=dojo.isString(_31)?_31:this.model.getIdentity(_31);
300dojo.some(this._itemNodesMap[_32],function(n){
301if(n.getParent()==_2f){
302_2f=n;
303return true;
304}
305return false;
306});
307if(_2e.length){
308this._expandNode(_2f).addCallback(dojo.hitch(this,_30));
309}else{
310this._selectNode(_2f);
311d.resolve(true);
312}
313};
314this._expandNode(_2f).addCallback(dojo.hitch(this,_30));
315}));
316return d;
317},_getPathAttr:function(){
318if(!this.selectedNode){
319return;
320}
321var res=[];
322var _33=this.selectedNode;
323while(_33&&_33!==this.rootNode){
324res.unshift(_33.item);
325_33=_33.getParent();
326}
327res.unshift(this.rootNode.item);
328return res;
329},mayHaveChildren:function(_34){
330},getItemChildren:function(_35,_36){
331},getLabel:function(_37){
332return this.model.getLabel(_37);
333},getIconClass:function(_38,_39){
334return (!_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){
341return "";
342},_onKeyPress:function(e){
343if(e.altKey){
344return;
345}
346var dk=dojo.keys;
347var _45=dijit.getEnclosingWidget(e.target);
348if(!_45){
349return;
350}
351var key=e.charOrCode;
352if(typeof key=="string"){
353if(!e.altKey&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey){
354this._onLetterKeyNav({node:_45,key:key.toLowerCase()});
355dojo.stopEvent(e);
356}
357}else{
358if(this._curSearch){
359clearTimeout(this._curSearch.timer);
360delete this._curSearch;
361}
362var map=this._keyHandlerMap;
363if(!map){
364map={};
365map[dk.ENTER]="_onEnterKey";
366map[this.isLeftToRight()?dk.LEFT_ARROW:dk.RIGHT_ARROW]="_onLeftArrow";
367map[this.isLeftToRight()?dk.RIGHT_ARROW:dk.LEFT_ARROW]="_onRightArrow";
368map[dk.UP_ARROW]="_onUpArrow";
369map[dk.DOWN_ARROW]="_onDownArrow";
370map[dk.HOME]="_onHomeKey";
371map[dk.END]="_onEndKey";
372this._keyHandlerMap=map;
373}
374if(this._keyHandlerMap[key]){
375this[this._keyHandlerMap[key]]({node:_45,item:_45.item,evt:e});
376dojo.stopEvent(e);
377}
378}
379},_onEnterKey:function(_46,evt){
380this._publish("execute",{item:_46.item,node:_46.node});
381this._selectNode(_46.node);
382this.onClick(_46.item,_46.node,evt);
383},_onDownArrow:function(_47){
384var _48=this._getNextNode(_47.node);
385if(_48&&_48.isTreeNode){
386this.focusNode(_48);
387}
388},_onUpArrow:function(_49){
389var _4a=_49.node;
390var _4b=_4a.getPreviousSibling();
391if(_4b){
392_4a=_4b;
393while(_4a.isExpandable&&_4a.isExpanded&&_4a.hasChildren()){
394var _4c=_4a.getChildren();
395_4a=_4c[_4c.length-1];
396}
397}else{
398var _4d=_4a.getParent();
399if(!(!this.showRoot&&_4d===this.rootNode)){
400_4a=_4d;
401}
402}
403if(_4a&&_4a.isTreeNode){
404this.focusNode(_4a);
405}
406},_onRightArrow:function(_4e){
407var _4f=_4e.node;
408if(_4f.isExpandable&&!_4f.isExpanded){
409this._expandNode(_4f);
410}else{
411if(_4f.hasChildren()){
412_4f=_4f.getChildren()[0];
413if(_4f&&_4f.isTreeNode){
414this.focusNode(_4f);
415}
416}
417}
418},_onLeftArrow:function(_50){
419var _51=_50.node;
420if(_51.isExpandable&&_51.isExpanded){
421this._collapseNode(_51);
422}else{
423var _52=_51.getParent();
424if(_52&&_52.isTreeNode&&!(!this.showRoot&&_52===this.rootNode)){
425this.focusNode(_52);
426}
427}
428},_onHomeKey:function(){
429var _53=this._getRootOrFirstNode();
430if(_53){
431this.focusNode(_53);
432}
433},_onEndKey:function(_54){
434var _55=this.rootNode;
435while(_55.isExpanded){
436var c=_55.getChildren();
437_55=c[c.length-1];
438}
439if(_55&&_55.isTreeNode){
440this.focusNode(_55);
441}
442},multiCharSearchDuration:250,_onLetterKeyNav:function(_56){
443var cs=this._curSearch;
444if(cs){
445cs.pattern=cs.pattern+_56.key;
446clearTimeout(cs.timer);
447}else{
448cs=this._curSearch={pattern:_56.key,startNode:_56.node};
449}
450var _57=this;
451cs.timer=setTimeout(function(){
452delete _57._curSearch;
453},this.multiCharSearchDuration);
454var _58=cs.startNode;
455do{
456_58=this._getNextNode(_58);
457if(!_58){
458_58=this._getRootOrFirstNode();
459}
460}while(_58!==cs.startNode&&(_58.label.toLowerCase().substr(0,cs.pattern.length)!=cs.pattern));
461if(_58&&_58.isTreeNode){
462if(_58!==cs.startNode){
463this.focusNode(_58);
464}
465}
466},_onClick:function(_59,e){
467var _5a=e.target,_5b=(_5a==_59.expandoNode||_5a==_59.expandoNodeText);
468if((this.openOnClick&&_59.isExpandable)||_5b){
469if(_59.isExpandable){
470this._onExpandoClick({node:_59});
471}
472}else{
473this._publish("execute",{item:_59.item,node:_59,evt:e});
474this.onClick(_59.item,_59,e);
475this.focusNode(_59);
476}
477if(!_5b){
478this._selectNode(_59);
479}
480dojo.stopEvent(e);
481},_onDblClick:function(_5c,e){
482var _5d=e.target,_5e=(_5d==_5c.expandoNode||_5d==_5c.expandoNodeText);
483if((this.openOnDblClick&&_5c.isExpandable)||_5e){
484if(_5c.isExpandable){
485this._onExpandoClick({node:_5c});
486}
487}else{
488this._publish("execute",{item:_5c.item,node:_5c,evt:e});
489this.onDblClick(_5c.item,_5c,e);
490this.focusNode(_5c);
491}
492if(!_5e){
493this._selectNode(_5c);
494}
495dojo.stopEvent(e);
496},_onExpandoClick:function(_5f){
497var _60=_5f.node;
498this.focusNode(_60);
499if(_60.isExpanded){
500this._collapseNode(_60);
501}else{
502this._expandNode(_60);
503}
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){
509if(_69.isExpandable&&_69.isExpanded&&_69.hasChildren()){
510return _69.getChildren()[0];
511}else{
512while(_69&&_69.isTreeNode){
513var _6a=_69.getNextSibling();
514if(_6a){
515return _6a;
516}
517_69=_69.getParent();
518}
519return null;
520}
521},_getRootOrFirstNode:function(){
522return this.showRoot?this.rootNode:this.rootNode.getChildren()[0];
523},_collapseNode:function(_6b){
524if(_6b._expandNodeDeferred){
525delete _6b._expandNodeDeferred;
526}
527if(_6b.isExpandable){
528if(_6b.state=="LOADING"){
529return;
530}
531_6b.collapse();
532this.onClose(_6b.item,_6b);
533if(_6b.item){
534this._state(_6b.item,false);
535this._saveState();
536}
537}
538},_expandNode:function(_6c,_6d){
539if(_6c._expandNodeDeferred&&!_6d){
540return _6c._expandNodeDeferred;
541}
542var _6e=this.model,_6f=_6c.item,_70=this;
543switch(_6c.state){
544case "UNCHECKED":
545_6c.markProcessing();
546var def=(_6c._expandNodeDeferred=new dojo.Deferred());
547_6e.getChildren(_6f,function(_71){
548_6c.unmarkProcessing();
549var _72=_6c.setChildItems(_71);
550var ed=_70._expandNode(_6c,true);
551_72.addCallback(function(){
552ed.addCallback(function(){
553def.callback();
554});
555});
556},function(err){
557console.error(_70,": error loading root children: ",err);
558});
559break;
560default:
561def=(_6c._expandNodeDeferred=_6c.expand());
562this.onOpen(_6c.item,_6c);
563if(_6f){
564this._state(_6f,true);
565this._saveState();
566}
567}
568return def;
569},focusNode:function(_73){
570dijit.focus(_73.labelNode);
571},_selectNode:function(_74){
572if(this.selectedNode&&!this.selectedNode._destroyed){
573this.selectedNode.setSelected(false);
574}
575if(_74){
576_74.setSelected(true);
577}
578this.selectedNode=_74;
579},_onNodeFocus:function(_75){
580if(_75&&_75!=this.lastFocused){
581if(this.lastFocused&&!this.lastFocused._destroyed){
582this.lastFocused.setFocusable(false);
583}
584_75.setFocusable(true);
585this.lastFocused=_75;
586}
587},_onNodeMouseEnter:function(_76){
588},_onNodeMouseLeave:function(_77){
589},_onItemChange:function(_78){
590var _79=this.model,_7a=_79.getIdentity(_78),_7b=this._itemNodesMap[_7a];
591if(_7b){
592var _7c=this.getLabel(_78),_7d=this.getTooltip(_78);
593dojo.forEach(_7b,function(_7e){
594_7e.set({item:_78,label:_7c,tooltip:_7d});
595_7e._updateItemClasses(_78);
596});
597}
598},_onItemChildrenChange:function(_7f,_80){
599var _81=this.model,_82=_81.getIdentity(_7f),_83=this._itemNodesMap[_82];
600if(_83){
601dojo.forEach(_83,function(_84){
602_84.setChildItems(_80);
603});
604}
605},_onItemDelete:function(_85){
606var _86=this.model,_87=_86.getIdentity(_85),_88=this._itemNodesMap[_87];
607if(_88){
608dojo.forEach(_88,function(_89){
609var _8a=_89.getParent();
610if(_8a){
611_8a.removeChild(_89);
612}
613_89.destroyRecursive();
614});
615delete this._itemNodesMap[_87];
616}
617},_initState:function(){
618if(this.persist){
619var _8b=dojo.cookie(this.cookieName);
620this._openedItemIds={};
621if(_8b){
622dojo.forEach(_8b.split(","),function(_8c){
623this._openedItemIds[_8c]=true;
624},this);
625}
626}
627},_state:function(_8d,_8e){
628if(!this.persist){
629return false;
630}
631var id=this.model.getIdentity(_8d);
632if(arguments.length===1){
633return this._openedItemIds[id];
634}
635if(_8e){
636this._openedItemIds[id]=true;
637}else{
638delete this._openedItemIds[id];
639}
640},_saveState:function(){
641if(!this.persist){
642return;
643}
644var ary=[];
645for(var id in this._openedItemIds){
646ary.push(id);
647}
648dojo.cookie(this.cookieName,ary.join(","),{expires:365});
649},destroy:function(){
650if(this._curSearch){
651clearTimeout(this._curSearch.timer);
652delete this._curSearch;
653}
654if(this.rootNode){
655this.rootNode.destroyRecursive();
656}
657if(this.dndController&&!dojo.isString(this.dndController)){
658this.dndController.destroy();
659}
660this.rootNode=null;
661this.inherited(arguments);
662},destroyRecursive:function(){
663this.destroy();
664},resize:function(_8f){
665if(_8f){
666dojo.marginBox(this.domNode,_8f);
667dojo.style(this.domNode,"overflow","auto");
668}
669this._nodePixelIndent=dojo.marginBox(this.tree.indentDetector).w;
670if(this.tree.rootNode){
671this.tree.rootNode.set("indent",this.showRoot?0:-1);
672}
673},_createTreeNode:function(_90){
674return new dijit._TreeNode(_90);
675}});
676dojo.require("dijit.tree.TreeStoreModel");
677dojo.require("dijit.tree.ForestStoreModel");
678}