//>>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(o,e,l,h,j,m,n,k){var i=l("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(a){if(this._store!==
a)this.forEach("onSetStore",[a,this._store]),this._store=a}))},startup:function(){this.forEach("onStartUp")},preInit:function(){this.grid.focus.destroy();this.grid.focus=new n(this.grid);new m(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(j.connect(this.grid.views,"addView",e.hitch(this,this._initView)));if(0<this._plugins.length){var a=this.grid.edit;if(a)a.styleRow=function(){}}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=i.registry;for(b in a)a[b]&&this._normalize(b,a,g,c);if(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;if(g)e.isArray(g)||(g=f[a].dependency=[g]),h.forEach(g,function(a){if(!this._normalize(a,b,c,d))throw Error("Plugin "+a+" is required.");},this);delete d[a];return f[a]},_init:function(a){var b,c,d=this._options;for(b in d)c=d[b].preInit,(a?c:!c)&&d[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(a){if(!this.loadPlugin(a))throw Error("Plugin "+
a+" 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&&(k.funnelEvents(a.contentNode,a,"doContentEvent",["mouseup","mousemove"]),k.funnelEvents(a.headerNode,a,"doHeaderEvent",["mouseup"]))},pluginExisted:function(a){return!!this.getPlugin(a)},getPlugin:function(a){for(var b=this._plugins,a=a.toLowerCase(),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,j.disconnect);this.forEach("destroy");this.grid.unwrap&&this.grid.unwrap();delete this._connects;delete this._plugins;delete this._options}});i.registerPlugin=function(a,b){if(a){var c=i;c.registry=c.registry||{};c.registry[a.prototype.name]=e.mixin({"class":a},
b?b:{})}};return i});