//>>built
require({cache:{"url:dijit/templates/TreeNode.html":"
\n","url:dijit/templates/Tree.html":"\n"}});
define("dijit/Tree",["dojo/_base/array","dojo/aspect","dojo/cookie","dojo/_base/declare","dojo/Deferred","dojo/promise/all","dojo/dom","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/errors/create","dojo/fx","dojo/has","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/on","dojo/topic","dojo/touch","dojo/when","./a11yclick","./focus","./registry","./_base/manager","./_Widget","./_TemplatedMixin","./_Container","./_Contained","./_CssStateMixin","./_KeyNavMixin","dojo/text!./templates/TreeNode.html","dojo/text!./templates/Tree.html","./tree/TreeStoreModel","./tree/ForestStoreModel","./tree/_dndSelector","dojo/query!css2"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,on,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c,_1d,_1e,_1f,_20,_21,_22){
function _23(d){
return _10.delegate(d.promise||d,{addCallback:function(_24){
this.then(_24);
},addErrback:function(_25){
this.otherwise(_25);
}});
};
var _26=_4("dijit._TreeNode",[_18,_19,_1a,_1b,_1c],{item:null,isTreeNode:true,label:"",_setLabelAttr:function(val){
this.labelNode[this.labelType=="html"?"innerHTML":"innerText" in this.labelNode?"innerText":"textContent"]=val;
this._set("label",val);
if(_d("dojo-bidi")){
this.applyTextDir(this.labelNode);
}
},labelType:"text",isExpandable:null,isExpanded:false,state:"NotLoaded",templateString:_1e,baseClass:"dijitTreeNode",cssStateNodes:{rowNode:"dijitTreeRow"},_setTooltipAttr:{node:"rowNode",type:"attribute",attribute:"title"},buildRendering:function(){
this.inherited(arguments);
this._setExpando();
this._updateItemClasses(this.item);
if(this.isExpandable){
this.labelNode.setAttribute("aria-expanded",this.isExpanded);
}
this.setSelected(false);
},_setIndentAttr:function(_27){
var _28=(Math.max(_27,0)*this.tree._nodePixelIndent)+"px";
_a.set(this.domNode,"backgroundPosition",_28+" 0px");
_a.set(this.rowNode,this.isLeftToRight()?"paddingLeft":"paddingRight",_28);
_1.forEach(this.getChildren(),function(_29){
_29.set("indent",_27+1);
});
this._set("indent",_27);
},markProcessing:function(){
this.state="Loading";
this._setExpando(true);
},unmarkProcessing:function(){
this._setExpando(false);
},_updateItemClasses:function(_2a){
var _2b=this.tree,_2c=_2b.model;
if(_2b._v10Compat&&_2a===_2c.root){
_2a=null;
}
this._applyClassAndStyle(_2a,"icon","Icon");
this._applyClassAndStyle(_2a,"label","Label");
this._applyClassAndStyle(_2a,"row","Row");
this.tree._startPaint(true);
},_applyClassAndStyle:function(_2d,_2e,_2f){
var _30="_"+_2e+"Class";
var _31=_2e+"Node";
var _32=this[_30];
this[_30]=this.tree["get"+_2f+"Class"](_2d,this.isExpanded);
_8.replace(this[_31],this[_30]||"",_32||"");
_a.set(this[_31],this.tree["get"+_2f+"Style"](_2d,this.isExpanded)||{});
},_updateLayout:function(){
var _33=this.getParent(),_34=!_33||!_33.rowNode||_33.rowNode.style.display=="none";
_8.toggle(this.domNode,"dijitTreeIsRoot",_34);
_8.toggle(this.domNode,"dijitTreeIsLast",!_34&&!this.getNextSibling());
},_setExpando:function(_35){
var _36=["dijitTreeExpandoLoading","dijitTreeExpandoOpened","dijitTreeExpandoClosed","dijitTreeExpandoLeaf"],_37=["*","-","+","*"],idx=_35?0:(this.isExpandable?(this.isExpanded?1:2):3);
_8.replace(this.expandoNode,_36[idx],_36);
this.expandoNodeText.innerHTML=_37[idx];
},expand:function(){
if(this._expandDeferred){
return _23(this._expandDeferred);
}
if(this._collapseDeferred){
this._collapseDeferred.cancel();
delete this._collapseDeferred;
}
this.isExpanded=true;
this.labelNode.setAttribute("aria-expanded","true");
if(this.tree.showRoot||this!==this.tree.rootNode){
this.containerNode.setAttribute("role","group");
}
_8.add(this.contentNode,"dijitTreeContentExpanded");
this._setExpando();
this._updateItemClasses(this.item);
if(this==this.tree.rootNode&&this.tree.showRoot){
this.tree.domNode.setAttribute("aria-expanded","true");
}
var _38=_c.wipeIn({node:this.containerNode,duration:_17.defaultDuration});
var def=(this._expandDeferred=new _5(function(){
_38.stop();
}));
_2.after(_38,"onEnd",function(){
def.resolve(true);
},true);
_38.play();
return _23(def);
},collapse:function(){
if(this._collapseDeferred){
return _23(this._collapseDeferred);
}
if(this._expandDeferred){
this._expandDeferred.cancel();
delete this._expandDeferred;
}
this.isExpanded=false;
this.labelNode.setAttribute("aria-expanded","false");
if(this==this.tree.rootNode&&this.tree.showRoot){
this.tree.domNode.setAttribute("aria-expanded","false");
}
_8.remove(this.contentNode,"dijitTreeContentExpanded");
this._setExpando();
this._updateItemClasses(this.item);
var _39=_c.wipeOut({node:this.containerNode,duration:_17.defaultDuration});
var def=(this._collapseDeferred=new _5(function(){
_39.stop();
}));
_2.after(_39,"onEnd",function(){
def.resolve(true);
},true);
_39.play();
return _23(def);
},indent:0,setChildItems:function(_3a){
var _3b=this.tree,_3c=_3b.model,_3d=[];
var _3e=_3b.focusedChild;
var _3f=this.getChildren();
_1.forEach(_3f,function(_40){
_1a.prototype.removeChild.call(this,_40);
},this);
this.defer(function(){
_1.forEach(_3f,function(_41){
if(!_41._destroyed&&!_41.getParent()){
_3b.dndController.removeTreeNode(_41);
function _42(_43){
var id=_3c.getIdentity(_43.item),ary=_3b._itemNodesMap[id];
if(ary.length==1){
delete _3b._itemNodesMap[id];
}else{
var _44=_1.indexOf(ary,_43);
if(_44!=-1){
ary.splice(_44,1);
}
}
_1.forEach(_43.getChildren(),_42);
};
_42(_41);
if(_3b.persist){
var _45=_1.map(_41.getTreePath(),function(_46){
return _3b.model.getIdentity(_46);
}).join("/");
for(var _47 in _3b._openedNodes){
if(_47.substr(0,_45.length)==_45){
delete _3b._openedNodes[_47];
}
}
_3b._saveExpandedNodes();
}
if(_3b.lastFocusedChild&&!_7.isDescendant(_3b.lastFocusedChild.domNode,_3b.domNode)){
delete _3b.lastFocusedChild;
}
if(_3e&&!_7.isDescendant(_3e.domNode,_3b.domNode)){
_3b.focus();
}
_41.destroyRecursive();
}
});
});
this.state="Loaded";
if(_3a&&_3a.length>0){
this.isExpandable=true;
_1.forEach(_3a,function(_48){
var id=_3c.getIdentity(_48),_49=_3b._itemNodesMap[id],_4a;
if(_49){
for(var i=0;i<_49.length;i++){
if(_49[i]&&!_49[i].getParent()){
_4a=_49[i];
_4a.set("indent",this.indent+1);
break;
}
}
}
if(!_4a){
_4a=this.tree._createTreeNode({item:_48,tree:_3b,isExpandable:_3c.mayHaveChildren(_48),label:_3b.getLabel(_48),labelType:(_3b.model&&_3b.model.labelType)||"text",tooltip:_3b.getTooltip(_48),ownerDocument:_3b.ownerDocument,dir:_3b.dir,lang:_3b.lang,textDir:_3b.textDir,indent:this.indent+1});
if(_49){
_49.push(_4a);
}else{
_3b._itemNodesMap[id]=[_4a];
}
}
this.addChild(_4a);
if(this.tree.autoExpand||this.tree._state(_4a)){
_3d.push(_3b._expandNode(_4a));
}
},this);
_1.forEach(this.getChildren(),function(_4b){
_4b._updateLayout();
});
}else{
this.isExpandable=false;
}
if(this._setExpando){
this._setExpando(false);
}
this._updateItemClasses(this.item);
var def=_6(_3d);
this.tree._startPaint(def);
return _23(def);
},getTreePath:function(){
var _4c=this;
var _4d=[];
while(_4c&&_4c!==this.tree.rootNode){
_4d.unshift(_4c.item);
_4c=_4c.getParent();
}
_4d.unshift(this.tree.rootNode.item);
return _4d;
},getIdentity:function(){
return this.tree.model.getIdentity(this.item);
},removeChild:function(_4e){
this.inherited(arguments);
var _4f=this.getChildren();
if(_4f.length==0){
this.isExpandable=false;
this.collapse();
}
_1.forEach(_4f,function(_50){
_50._updateLayout();
});
},makeExpandable:function(){
this.isExpandable=true;
this._setExpando(false);
},setSelected:function(_51){
this.labelNode.setAttribute("aria-selected",_51?"true":"false");
_8.toggle(this.rowNode,"dijitTreeRowSelected",_51);
},focus:function(){
_15.focus(this.focusNode);
}});
if(_d("dojo-bidi")){
_26.extend({_setTextDirAttr:function(_52){
if(_52&&((this.textDir!=_52)||!this._created)){
this._set("textDir",_52);
this.applyTextDir(this.labelNode);
_1.forEach(this.getChildren(),function(_53){
_53.set("textDir",_52);
},this);
}
}});
}
var _54=_4("dijit.Tree",[_18,_1d,_19,_1c],{baseClass:"dijitTree",store:null,model:null,query:null,label:"",showRoot:true,childrenAttr:["children"],paths:[],path:[],selectedItems:null,selectedItem:null,openOnClick:false,openOnDblClick:false,templateString:_1f,persist:false,autoExpand:false,dndController:_22,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(_55,_56){
_11.publish(this.id,_10.mixin({tree:this,event:_55},_56||{}));
},postMixInProperties:function(){
this.tree=this;
if(this.autoExpand){
this.persist=false;
}
this._itemNodesMap={};
if(!this.cookieName&&this.id){
this.cookieName=this.id+"SaveStateCookie";
}
this.expandChildrenDeferred=new _5();
this.pendingCommandsPromise=this.expandChildrenDeferred.promise;
this.inherited(arguments);
},postCreate:function(){
this._initState();
var _57=this;
this.own(on(this.containerNode,on.selector(".dijitTreeNode",_12.enter),function(evt){
_57._onNodeMouseEnter(_16.byNode(this),evt);
}),on(this.containerNode,on.selector(".dijitTreeNode",_12.leave),function(evt){
_57._onNodeMouseLeave(_16.byNode(this),evt);
}),on(this.containerNode,on.selector(".dijitTreeRow",_14.press),function(evt){
_57._onNodePress(_16.getEnclosingWidget(this),evt);
}),on(this.containerNode,on.selector(".dijitTreeRow",_14),function(evt){
_57._onClick(_16.getEnclosingWidget(this),evt);
}),on(this.containerNode,on.selector(".dijitTreeRow","dblclick"),function(evt){
_57._onDblClick(_16.getEnclosingWidget(this),evt);
}));
if(!this.model){
this._store2model();
}
this.own(_2.after(this.model,"onChange",_10.hitch(this,"_onItemChange"),true),_2.after(this.model,"onChildrenChange",_10.hitch(this,"_onItemChildrenChange"),true),_2.after(this.model,"onDelete",_10.hitch(this,"_onItemDelete"),true));
this.inherited(arguments);
if(this.dndController){
if(_10.isString(this.dndController)){
this.dndController=_10.getObject(this.dndController);
}
var _58={};
for(var i=0;ithis.domNode.offsetWidth?"auto":"100%";
},_createTreeNode:function(_c2){
return new _26(_c2);
},focus:function(){
if(this.lastFocusedChild){
this.focusNode(this.lastFocusedChild);
}else{
this.focusFirstChild();
}
}});
if(_d("dojo-bidi")){
_54.extend({_setTextDirAttr:function(_c3){
if(_c3&&this.textDir!=_c3){
this._set("textDir",_c3);
this.rootNode.set("textDir",_c3);
}
}});
}
_54.PathError=_b("TreePathError");
_54._TreeNode=_26;
return _54;
});