0
-YUI.add("widget",function(C){var Q=C.Lang,K=C.Object,i=C.Node,M=C.ClassNameManager,J="content",d="visible",g="hidden",h="disabled",T="focused",F="width",a="height",k="",b="-",j="boundingBox",W="contentBox",P="parentNode",c="ownerDocument",f="srcNode",e="body",B="tabIndex",E="locale",G="initValue",R="id",S="render",A="rendered",Z="destroyed",V="Change",I="_after",U="_uiSet",H="contentUpdate",X={};function D(O){this._strings={};D.superclass.constructor.apply(this,arguments);var Y=this.get(S),L;if(Y){if(Y!==true){L=Y;}this.render(L);}}D._buildCfg={aggregates:["HTML_PARSER"]};D.NAME="widget";D.UI_SRC="ui";var N=D.UI_SRC;D.ATTRS={id:{valueFn:"_guid",writeOnce:true},rendered:{value:false,readOnly:true},boundingBox:{value:null,setter:"_setBoundingBox",writeOnce:true},contentBox:{value:null,setter:"_setContentBox",writeOnce:true},tabIndex:{value:0,validator:"_validTabIndex"},focused:{value:false,readOnly:true},disabled:{value:false},visible:{value:true},height:{value:k},width:{value:k},moveStyles:{value:false},locale:{value:"en"},strings:{setter:function(L){return this._setStrings(L,this.get(E));},getter:function(){return this.getStrings(this.get(E));}},render:{value:false,writeOnce:true},srcNode:{value:null,setter:C.Node.one,writeOnce:true}};D._NAME=D.NAME.toLowerCase();D.getClassName=function(){var L=C.Array(arguments,0,true);L.splice(0,0,this._NAME);return M.getClassName.apply(M,L);};D.getByNode=function(L){var Y,O=D.getClassName();L=i.get(L);if(L){L=(L.hasClass(O))?L:L.ancestor("."+O);if(L){Y=X[C.stamp(L,true)];}}return Y||null;};D.HTML_PARSER={};C.extend(D,C.Base,{getClassName:function(){var L=C.Array(arguments,0,true);L.splice(0,0,this._name);return M.getClassName.apply(M,L);},initializer:function(L){var O,Y;this._name=this.constructor.NAME.toLowerCase();X[C.stamp(this.get(j))]=this;this.publish(H,{preventable:false});O=this._getSrcNode();Y=this._parseNode(O);L=this._applyParsedConfig(O,L,Y);},destructor:function(){var O=this.get(j);var L=C.stamp(O,true);if(L&&L in X){delete X[L];}O.remove(true);},render:function(L){if(this.get(Z)){return;}if(!this.get(A)){this.publish(S,{queuable:false,defaultFn:this._defRenderFn});L=(L)?i.get(L):null;if(L&&!L.inDoc()){L=null;}this.fire(S,{parentNode:L});}return this;},_defRenderFn:function(L){this._renderUI(L.parentNode);this._bindUI();this._syncUI();this.renderer();this._set(A,true);},renderer:function(){this.renderUI();this.bindUI();this.syncUI();},bindUI:function(){},renderUI:function(){},syncUI:function(){},hide:function(){return this.set(d,false);},show:function(){return this.set(d,true);},focus:function(){return this._set(T,true);},blur:function(){return this._set(T,false);},enable:function(){return this.set(h,false);},disable:function(){return this.set(h,true);},_parseNode:function(O){var L=this._getHtmlParser(),Y,l;if(L&&O){K.each(L,function(n,m,p){l=null;if(Q.isFunction(n)){l=n.call(this,O);}else{if(Q.isArray(n)){l=O.queryAll(n[0]);}else{l=O.query(n);}}if(l!==null&&l!==undefined){Y=Y||{};Y[m]=l;}},this);}return Y;},_getSrcNode:function(){return this.get(f)||this.get(W);},_applyParsedConfig:function(Y,L,O){return(O)?C.aggregate(L,O,false):L;},_moveStyles:function(m,o){var l=this.WRAP_STYLES,p=m.getStyle("position"),O=this.get(W),n=[0,0],Y,L;if(!this.get("height")){Y=O.get("offsetHeight");}if(!this.get("width")){L=O.get("offsetWidth");}if(p==="absolute"){n=m.getXY();o.setStyles({right:"auto",bottom:"auto"});m.setStyles({right:"auto",bottom:"auto"});}C.each(l,function(r,q){var t=m.getStyle(q);o.setStyle(q,t);if(r===false){m.setStyle(q,"");}else{m.setStyle(q,r);}});if(p==="absolute"){o.setXY(n);}if(Y){this.set("height",Y);}if(L){this.set("width",L);}},_renderBox:function(O){var Y=this.get(W),l=this.get(j),n=this.get(f),m=(n&&n.get(c))||l.get(c)||Y.get(c),L;if(n&&!n.compareTo(Y)&&!Y.inDoc(m)){n.replace(Y);}if(!l.compareTo(Y.get(P))&&!l.compareTo(Y)){if(this.get("moveStyles")){this._moveStyles(Y,l);}if(Y.inDoc(m)){Y.replace(l);}l.appendChild(Y);}if(!l.inDoc(m)&&!O){L=i.one(e).insert(l,0);}else{if(O&&!O.compareTo(l.get(P))){O.appendChild(l);}}},_setBoundingBox:function(L){return this._setBox(this.get(R),L,this.BOUNDING_TEMPLATE);},_setContentBox:function(L){if(this.CONTENT_TEMPLATE===null){return this.get(j);}else{return this._setBox(this.get(R)+this.CONTENT_BOX_ID_SUFFIX,L,this.CONTENT_TEMPLATE);}},_setBox:function(Y,O,L){O=i.one(O)||i.create(L);if(!O.get(R)){Y=Y||C.guid();O.set(R,Y);}return O;},_renderUI:function(L){this._renderBoxClassNames();this._renderBox(L);},_renderBoxClassNames:function(){var m=this._getClasses(),Y=this.get(j),L=this.get(W),O,l;Y.addClass(D.getClassName());for(l=m.length-3;l>=0;l--){O=m[l].NAME;if(O){Y.addClass(M.getClassName(O.toLowerCase()));}}L.addClass(this.getClassName(J));},_bindUI:function(){this._bindAttrUI([d,h,a,F,T]);this._bindDOMListeners();},_bindAttrUI:function(Y){for(var m=0,O=Y.length;m<O;m++){var L=Y[m];this.after(L+V,this[I+L.substring(0,1).toUpperCase()+L.substring(1)+V]);}},_syncAttrUI:function(Y){for(var m=0,O=Y.length;m<O;m++){var L=Y[m];this[U+L.substring(0,1).toUpperCase()+L.substring(1)](this.get(L));}},_bindDOMListeners:function(){var L=this.get(j).get(c);L.on("focus",this._onFocus,this);if(C.UA.webkit){L.on("mousedown",this._onDocMouseDown,this);}},_syncUI:function(){this._syncAttrUI([d,h,a,F,T,B]);},_uiSetHeight:function(L){if(Q.isNumber(L)){L=L+this.DEF_UNIT;}this.get(j).setStyle(a,L);},_uiSetWidth:function(L){if(Q.isNumber(L)){L=L+this.DEF_UNIT;}this.get(j).setStyle(F,L);},_uiSetVisible:function(Y){var O=this.get(j),L=this.getClassName(g);if(Y){O.removeClass(L);}else{O.addClass(L);}},_uiSetDisabled:function(Y){var O=this.get(j),L=this.getClassName(h);if(Y){O.addClass(L);}else{O.removeClass(L);}},_uiSetTabIndex:function(O){var L=this.get(j);if(Q.isNumber(O)){L.set(B,O);}else{L.removeAttribute(B);}},_uiSetFocused:function(l,Y){var O=this.get(j),L=this.getClassName(T);if(l){O.addClass(L);if(Y!==N){O.focus();}}else{O.removeClass(L);if(Y!==N){O.blur();}}},_afterVisibleChange:function(L){this._uiSetVisible(L.newVal);
0
-},_afterDisabledChange:function(L){this._uiSetDisabled(L.newVal);},_afterHeightChange:function(L){this._uiSetHeight(L.newVal);},_afterWidthChange:function(L){this._uiSetWidth(L.newVal);},_afterFocusedChange:function(L){this._uiSetFocused(L.newVal,L.src);},_onDocMouseDown:function(L){if(this._hasDOMFocus){this._onFocus(L);}},_onFocus:function(O){var l=O.target,Y=this.get(j),L=(Y.compareTo(l)||Y.contains(l));this._hasDOMFocus=L;this._set(T,L,{src:N});},toString:function(){return this.constructor.NAME+"["+this.get(R)+"]";},DEF_UNIT:"px",CONTENT_TEMPLATE:"<div></div>",BOUNDING_TEMPLATE:"<div></div>",CONTENT_BOX_ID_SUFFIX:"_c",WRAP_STYLES:{height:"100%",width:"100%",zIndex:false,position:"static",top:"0",left:"0",bottom:"",right:"",padding:"",margin:""},_setStrings:function(O,L){var Y=this._strings;L=L.toLowerCase();if(!Y[L]){Y[L]={};}C.aggregate(Y[L],O,true);return Y[L];},_getStrings:function(L){return this._strings[L.toLowerCase()];},getStrings:function(r){r=(r||this.get(E)).toLowerCase();var p=this.getDefaultLocale().toLowerCase(),O=this._getStrings(p),q=(O)?C.merge(O):{},o=r.split(b);if(r!==p||o.length>1){var L="";for(var m=0,Y=o.length;m<Y;++m){L+=o[m];var n=this._getStrings(L);if(n){C.aggregate(q,n,true);}L+=b;}}return q;},getString:function(Y,O){O=(O||this.get(E)).toLowerCase();var l=(this.getDefaultLocale()).toLowerCase(),m=this._getStrings(l)||{},n=m[Y],L=O.lastIndexOf(b);if(O!==l||L!=-1){do{m=this._getStrings(O);if(m&&Y in m){n=m[Y];break;}L=O.lastIndexOf(b);if(L!=-1){O=O.substring(0,L);}}while(L!=-1);}return n;},getDefaultLocale:function(){return this._conf.get(E,G);},_strings:null,_getHtmlParser:function(){if(!this._HTML_PARSER){var O=this._getClasses(),l={},L,Y;for(L=O.length-1;L>=0;L--){Y=O[L].HTML_PARSER;if(Y){C.mix(l,Y,true);}}this._HTML_PARSER=l;}return this._HTML_PARSER;},_guid:function(){return C.guid();},_validTabIndex:function(L){return(Q.isNumber(L)||Q.isNull(L));}});C.Widget=D;},"@VERSION@",{requires:["attribute","event-focus","base","node","classnamemanager"]});
0
\ No newline at end of file