dojo.provide("parus.tabPage");dojo.require("dijit._Widget");dojo.require("dijit._Templated");dojo.require("dijit.layout.BorderContainer");dojo.require("dijit.layout.ContentPane");dojo.require("dijit.layout.TabContainer");dojo.require("dijit.form.Button");dojo.declare("parus.tabPage",[dijit._Widget,dijit._TemplatedMixin],{widgetsInTemplate:false,destroyOnClose:true,contentPane:null,ownerTabContainer:null,title:null,kind:null,previouslySelected:null,postMixInProperties:function(){this.inherited(arguments);var a=this.declaredClass.split(".");this.templateString=dojo.cache(dojo.moduleUrl(a[0],a[1]+".html"))},postCreate:function(){this.inherited(arguments);var a=dojo.parser.parse({rootNode:this.domNode,template:true});dojo.mixin(this,{contentPane:a[0]});if(!this.contentPane){throw new Error("ContentPane element is not defined for class "+this.declaredClass+".")}if(this.title){this.contentPane.title=this.title}dojo.forEach(a,dojo.hitch(this,function(c){dojo.mixin(c,{tabPageObject:this,contentPane:this.contentPane});var b=c.dojoAttachPoint;if(b&&(dojo.indexOf(this._attachPoints,b)!=-1)){this[b]=c}}));this.onLoad()},_removeChildConnect:null,show:function(){this.onShow();if(this.ownerTabContainer){this.contentPane.attr("closable",true);this.previouslySelected=this.ownerTabContainer.selectedChildWidget;this._removeChildConnect=dojo.connect(this.ownerTabContainer,"removeChild",dojo.hitch(this,function(a){if(a==this.previouslySelected){this.previouslySelected=null}}));this.ownerTabContainer.addChild(this.contentPane);this.ownerTabContainer.selectChild(this.contentPane);this.contentPane.onClose=dojo.hitch(this,this.close)}else{this.contentPane.resize()}},close:function(){if(this.onClose()){if(this.ownerTabContainer){parus.balance.TabContainer.selectChild(this.previouslySelected||(this.kind=="1"?parus.balance.consolidatedPage:parus.balance.primaryPage));if(this.kind=="1"){parus.balance.consolidatedMasterGrid.views.views[0].doscroll()}else{parus.balance.primaryMasterGrid.views.views[0].doscroll()}dojo.disconnect(this._removeChildConnect);this.ownerTabContainer.removeChild(this.contentPane);if(this.destroyOnClose){setTimeout(dojo.hitch(this,function(){this.contentPane.destroyRecursive();this.contentPane=null;this.destroyRecursive()}),100)}}}},onLoad:function(){},onShow:function(){},onClose:function(){return true}});