//>>built
define("dojox/grid/enhanced/_PluginManager","dojo/_base/kernel dojo/_base/lang dojo/_base/declare dojo/_base/array dojo/_base/connect ./_Events ./_FocusManager ../util".split(" "),function(t,e,p,h,l,q,r,m){var k=p("dojox.grid.enhanced._PluginManager",null,{_options:null,_plugins:null,_connects:null,constructor:function(a){this.grid=a;this._store=a.store;this._options={};this._plugins=[];this._connects=[];this._parseProps(this.grid.plugins);a.connect(a,"_setStore",e.hitch(this,function(b){this._store!==
b&&(this.forEach("onSetStore",[b,this._store]),this._store=b)}))},startup:function(){this.forEach("onStartUp")},preInit:function(){this.grid.focus.destroy();this.grid.focus=new r(this.grid);new q(this.grid);this._init(!0);this.forEach("onPreInit")},postInit:function(){this._init(!1);h.forEach(this.grid.views.views,this._initView,this);this._connects.push(l.connect(this.grid.views,"addView",e.hitch(this,this._initView)));if(0<this._plugins.length){var a=this.grid.edit;a&&(a.styleRow=function(b){})}this.forEach("onPostInit")},
forEach:function(a,b){h.forEach(this._plugins,function(c){c&&c[a]&&c[a].apply(c,b?b:[])})},_parseProps:function(a){if(a){var b,c={},d=this._options,f=this.grid,g=k.registry;for(b in a)a[b]&&this._normalize(b,a,g,c);d.dnd&&(d.columnReordering=!1);e.mixin(f,d)}},_normalize:function(a,b,c,d){if(!c[a])throw Error("Plugin "+a+" is required.");if(d[a])throw Error("Recursive cycle dependency is not supported.");var f=this._options;if(f[a])return f[a];d[a]=!0;f[a]=e.mixin({},c[a],e.isObject(b[a])?b[a]:{});
var g=f[a].dependency;g&&(e.isArray(g)||(g=f[a].dependency=[g]),h.forEach(g,function(n){if(!this._normalize(n,b,c,d))throw Error("Plugin "+n+" is required.");},this));delete d[a];return f[a]},_init:function(a){var b,c=this._options;for(b in c){var d=c[b].preInit;(a?d:!d)&&c[b]["class"]&&!this.pluginExisted(b)&&this.loadPlugin(b)}},loadPlugin:function(a){var b=this._options[a];if(!b)return null;if(a=this.getPlugin(a))return a;h.forEach(b.dependency,function(c){if(!this.loadPlugin(c))throw Error("Plugin "+
c+" is required.");},this);a=b["class"];delete b["class"];a=(new this.getPluginClazz(a))(this.grid,b);this._plugins.push(a);return a},_initView:function(a){a&&(m.funnelEvents(a.contentNode,a,"doContentEvent",["mouseup","mousemove"]),m.funnelEvents(a.headerNode,a,"doHeaderEvent",["mouseup"]))},pluginExisted:function(a){return!!this.getPlugin(a)},getPlugin:function(a){var b=this._plugins;a=a.toLowerCase();for(var c=0,d=b.length;c<d;c++)if(a==b[c].name.toLowerCase())return b[c];return null},getPluginClazz:function(a){if(e.isFunction(a))return a;
var b='Please make sure Plugin "'+a+'" is existed.';try{var c=e.getObject(a);if(!c)throw Error(b);return c}catch(d){throw Error(b);}},isFixedCell:function(a){return a&&(a.isRowSelector||a.fixedPos)},destroy:function(){h.forEach(this._connects,l.disconnect);this.forEach("destroy");this.grid.unwrap&&this.grid.unwrap();delete this._connects;delete this._plugins;delete this._options}});k.registerPlugin=function(a,b){if(a){var c=k;c.registry=c.registry||{};c.registry[a.prototype.name]=e.mixin({"class":a},
b?b:{})}};return k});