dojo.provide("parus.treeDialog");dojo.require("dijit.Dialog");dojo.require("dijit.form.Button");dojo.require("parus.parus8");dojo.require("parus.dialog");dojo.declare("parus.treeDialog",[parus.Dialog],{validate:function(){return(this.catalogTree.model.isValid(this.catalogTree.selectedItem))},treeChange:function(){this.OKButton.attr("disabled",this.validate()?false:true);if(this.menu){this._checkTreePopupMenu()}},title:"Выбор каталога",model:null,key:null,restoreSelected:true,menu:null,checkPopupMenu:null,postCreate:function(){this.inherited(arguments);if(this.menu){this.menu.dialogObject=this;this.menu.bindDomNode(this.catalogTree.domNode)}},_checkTreePopupMenu:function(){parus.catalogActions.checkPopupMenuItemAction(this.menu,this.catalogTree);if(this.checkPopupMenu){this.checkPopupMenu.call(this,this,this.menu,this.catalogTree)}},onDefaultNeeded:function(){return null},onSingle:function(){return null},onPerform:function(b,a){return true},value:null,show:function(){var b=this.onSingle();if(b){if(this.onPerform(b,null)){return new dojo.DeferredList([])}}var a=parus.userdata.get(this.declaredClass+(this.key?"-"+this.key:""))||{};this.userSize=a.userSize||null;this.value=this.value||(this.restoreSelected?a.selected:null)||this.onDefaultNeeded()||null;return this.inherited(arguments)},_onShow:function(){this.catalogTree.model=this.model;if(this.catalogTree.dndController&&!dojo.isString(this.catalogTree.dndController)){var a=this.catalogTree.dndController.declaredClass;this.catalogTree.dndController.destroy();this.catalogTree.tree.dndController=a}this.catalogTree.postMixInProperties();this.catalogTree.postCreate();if(this.value){this.catalogTree.attr("path",this.value.split(";")).then(dojo.hitch(this,this.treeChange))}this.inherited(arguments)},onApply:function(){return this.onPerform(this.catalogTree.model.getIdentity(this.catalogTree.selectedItem),this.catalogTree.model.getLabel(this.catalogTree.selectedItem))},_onClose:function(){var a=[];if(this.restoreSelected){a=dojo.map(this.catalogTree.path||[],dojo.hitch(this,function(b){return this.catalogTree.model.getIdentity(b)}))}parus.userdata.set(this.declaredClass+(this.key?"-"+this.key:""),{selected:a.length?a.join(";"):null,userSize:this.userSize},true);this.inherited(arguments)}});