base-base-min.js revision 9f7c20b894a93b0da425b8b9470043abefb6d7de
YUI.add("base-base",function(A){var J=A.Lang;function D(L){this._plugins={};this.after("init",function(O){this._initPlugins(O.cfg);});this.after("destroy",this._destroyPlugins);}D.prototype={plug:function(Q,L){if(Q){if(J.isFunction(Q)){this._plug(Q,L);}else{if(J.isArray(Q)){for(var O=0,P=Q.length;O<P;O++){this.plug(Q[O]);}}else{this._plug(Q.fn,Q.cfg);}}}return this;},unplug:function(O){if(O){this._unplug(O);}else{var L;for(L in this._plugins){if(this._plugins.hasOwnProperty(L)){this._unplug(L);}}}return this;},hasPlugin:function(L){return(this._plugins[L]&&this[L]);},_initPlugins:function(L){var P=this._getClasses(),Q,O;for(O=P.length-1;O>=0;O--){Q=P[O];if(Q.PLUGINS){this.plug(Q.PLUGINS);}}if(L&&L.plugins){this.plug(L.plugins);}},_destroyPlugins:function(){this._unplug();},_plug:function(P,L){if(P&&P.NS){var O=P.NS;L=L||{};L.host=this;if(this.hasPlugin(O)){this[O].setAttrs(L);}else{this[O]=new P(L);this._plugins[O]=P;}}},_unplug:function(P){var O=P,L=this._plugins;if(J.isFunction(P)){O=P.NS;if(O&&(!L[O]||L[O]!==P)){O=null;}}if(O){if(this[O]){this[O].destroy();delete this[O];}if(L[O]){delete L[O];}}}};A.namespace("Plugin").Host=D;var H=A.Object,I=".",F="destroy",N="init",M="initialized",G="destroyed",C="initializer",B=Object.prototype.constructor,K="destructor";function E(){A.Attribute.call(this);this.init.apply(this,arguments);}E.NAME="base";E.ATTRS={initialized:{readOnly:true,value:false},destroyed:{readOnly:true,value:false}};E.prototype={init:function(L){this._yuievt.config.prefix=this.name=this.constructor.NAME;this.publish(N,{queuable:false,defaultFn:this._defInitFn});A.Plugin.Host.call(this);this.fire(N,{cfg:L});return this;},destroy:function(){this.publish(F,{queuable:false,defaultFn:this._defDestroyFn});this.fire(F);return this;},_defInitFn:function(L){this._initHierarchy(L.cfg);this._set(M,true);},_defDestroyFn:function(L){this._destroyHierarchy();this._set(G,true);},_getClasses:function(){if(!this._classes){this._initHierarchyData();}return this._classes;},_getAttrCfgs:function(){if(!this._attrs){this._initHierarchyData();}return this._attrs;},_filterAttrCfgs:function(P,L){var O={};if(P.ATTRS){A.each(P.ATTRS,function(R,Q){if(L[Q]){O[Q]=L[Q];delete L[Q];}});}return O;},_initHierarchyData:function(){var P=this.constructor,O=[],L=[];while(P&&P.prototype){O[O.length]=P;if(P.ATTRS){L[L.length]=P.ATTRS;}P=P.superclass?P.superclass.constructor:null;}this._classes=O;this._attrs=this._aggregateAttrs(L);},_aggregateAttrs:function(R){var L,P,O,U,T,Q,S={};if(R){for(Q=R.length-1;Q>=0;--Q){P=R[Q];for(L in P){if(P.hasOwnProperty(L)){O=A.merge(P[L]);U=O.value;if(U&&!O.useRef&&(B===U.constructor||J.isArray(U))){O.value=A.clone(U);}T=null;if(L.indexOf(I)!==-1){T=L.split(I);L=T.shift();}if(T&&S[L]&&S[L].value){H.setValue(S[L].value,T,U);}else{if(!T){if(!S[L]){S[L]=O;}else{S[L]=A.mix(S[L],O,true);}}}}}}}return S;},_initHierarchy:function(S){var R,L,P,U,Q,O=this._getClasses(),T=this._getAttrCfgs();this._userCfgs=S;for(P=O.length-1;P>=0;P--){R=O[P];L=R.prototype;if(R._yuibuild&&R._yuibuild.exts&&!R._yuibuild.dynamic){for(U=0,Q=R._yuibuild.exts.length;U<Q;U++){R._yuibuild.exts[U].apply(this,arguments);}}this._classCfgs=this._filterAttrCfgs(R,T);this.addAttrs(this._classCfgs,S);this._classCfgs=null;if(L.hasOwnProperty(C)){L[C].apply(this,arguments);}}},_destroyHierarchy:function(){var R,O,Q,L,P=this._getClasses();for(Q=0,L=P.length;Q<L;Q++){R=P[Q];O=R.prototype;if(O.hasOwnProperty(K)){O[K].apply(this,arguments);}}},get:function(L){if(this._classCfgs){var O=L;if(L.indexOf(I)!==-1){var R=L.split(I);O=R.shift();}if(this._classCfgs[O]&&!this.attrAdded(O)){var S=this._classCfgs[O],Q=this._userCfgs,P;if(S){P={};P[O]=S;this.addAttrs(P,Q);}}}return A.Attribute.prototype.get.call(this,L);},toString:function(){return this.constructor.NAME+"["+A.stamp(this)+"]";}};A.mix(E,A.Attribute,false,null,1);A.mix(E,A.Plugin.Host,false,null,1);E.prototype.constructor=E;A.Base=E;},"@VERSION@",{requires:["attribute"]});