From 6832a56277c776c17d08437676922cef0a83796d Mon Sep 17 00:00:00 2001 From: Edward Date: Fri, 21 Mar 2014 20:13:23 +0800 Subject: [PATCH] roojs-core.js roojs-core-debug.js roojs-all.js roojs-debug.js --- roojs-all.js | 9 +++------ roojs-core-debug.js | 19 +++++++------------ roojs-core.js | 9 +++------ roojs-debug.js | 19 +++++++------------ 4 files changed, 20 insertions(+), 36 deletions(-) diff --git a/roojs-all.js b/roojs-all.js index e93a856b95..8fe08fbbd1 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -320,17 +320,14 @@ this.onResize(aw,ah,w,h);this.fireEvent('resize',this,aw,ah,w,h);}return this;}, this.onPosition(ax,ay);this.fireEvent('move',this,ax,ay);}return this;},setPagePosition:function(x,y){this.pageX=x;this.pageY=y;if(!this.boxReady){return;}if(x===undefined||y===undefined){return;}var p=this.el.translatePoints(x,y);this.setPosition(p.left,p.top);return this;},onRender:function(ct,A){Roo.BoxComponent.superclass.onRender.call(this,ct,A);if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl);}if(this.positionEl){this.positionEl=Roo.get(this.positionEl);}},afterRender:function(){Roo.BoxComponent.superclass.afterRender.call(this);this.boxReady=true;this.setSize(this.width,this.height);if(this.x||this.y){this.setPosition(this.x,this.y);}if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY);}},syncSize:function(){delete this.lastSize;this.setSize(this.el.getWidth(),this.el.getHeight());return this;},onResize:function(A,B,C,D){},onPosition:function(x,y){},adjustSize:function(w,h){if(this.autoWidth){w='auto';}if(this.autoHeight){h='auto';}return {width:w,height:h};},adjustPosition:function(x,y){return {x:x,y:y};}}); //Roo/XComponent.js Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true});this.region=this.region||'center';Roo.XComponent.register(this);this.modules=false;this.el=false;} -Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,_tree:false,render:function(el){el=el||false;var hp=this.parent?1:0;Roo.log('hp') -Roo.log(this.parent.substr(1));if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var A=this.parent.substr(1) -this.parent=(this.parent=='#bootstrap')?{el:true}:false;Roo.log('parent');el=Roo.get(A);Roo.log(el);if(!el&&!this.parent){Roo.log("Warning - element can not be found :#"+A);return;}} -Roo.log(el);if(!this.parent){el=el?Roo.get(el):false;this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})}}if(!this.parent.el){return;}var B=this._tree?this._tree():this.tree();B.region=B.region||this.region;if(this.parent.el===true){this.parent.el=Roo.factory(B);} +Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,_tree:false,render:function(el){el=el||false;var hp=this.parent?1:0;if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var A=this.parent.substr(1) +this.parent=(this.parent=='#bootstrap')?{el:true}:false;el=Roo.get(A);if(!el&&!this.parent){Roo.log("Warning - element can not be found :#"+A);return;}}if(!this.parent){el=el?Roo.get(el):false;this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})}}if(!this.parent.el){return;}var B=this._tree?this._tree():this.tree();Roo.log('tree');Roo.log(B);return;B.region=B.region||this.region;if(this.parent.el===true){this.parent.el=Roo.factory(B);} this.el=this.parent.el.addxtype(B);this.fireEvent('built',this);this.panel=this.el;this.layout=this.panel.layout;this.parentLayout=this.parent.layout||false;}});Roo.apply(Roo.XComponent,{hideProgress:false,buildCompleted:false,topModule:false,modules:[],elmodules:[],register:function(A){Roo.XComponent.event.fireEvent('register',A);switch(typeof(A.disabled)){case 'undefined':break;case 'function':if(A.disabled()){return;}break;default:if(A.disabled){return;}break;} this.modules.push(A);},toObject:function(str){if(!str||typeof(str)=='object'){return str;}if(str.substring(0,1)=='#'){return str;}var ar=str.split('.');var rt,o;rt=ar.shift();try{eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');}catch(e){throw "Module not found : "+str;}if(o===false){throw "Module not found : "+str;} Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+str;} o=o[e];});return o;},preBuild:function(){var _t=this;Roo.each(this.modules,function(A){Roo.XComponent.event.fireEvent('beforebuild',A);var B=A.parent;try{A.parent=this.toObject(B);}catch(e){Roo.log("parent:toObject failed: "+e.toString());return;}if(!A.parent){Roo.debug&&Roo.log("GOT top level module");Roo.debug&&Roo.log(A);A.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});this.topModule=A;return;}if(typeof(A.parent)=='string'){this.elmodules.push(A);return;}if(A.parent.constructor!=Roo.XComponent){Roo.log("Warning : Object Parent is not instance of XComponent:"+A.name)}if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}if(A.parent.disabled){A.disabled=true;} A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;};if((!this.topModule||!this.topModule.modules)&&!this.elmodules.length){throw "No top level modules to build";}var C=this.topModule?[this.topModule]:[];Roo.each(this.elmodules,function(e){C.push(e);if(!this.topModule&&typeof(e.parent)=='string'&&e.parent.substring(0,1)=='#'&&Roo.get(e.parent.substr(1))){A.topModule=e;}});var D=function(m){Roo.debug&&Roo.log("build Order: add: "+m.name);C.push(m);if(m.modules&&!m.disabled){Roo.debug&&Roo.log("build Order: "+m.modules.length+" child modules");m.modules.keySort('ASC',B);Roo.debug&&Roo.log("build Order: "+m.modules.length+" child modules (after sort)");m.modules.each(D);}else {Roo.debug&&Roo.log("build Order: no child modules");}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}};if(this.topModule&&this.topModule.modules){this.topModule.modules.keySort('ASC',B);this.topModule.modules.each(D);}return C;},build:function(){this.preBuild();var A=this.buildOrder();if(!A.length){throw "NO modules!!!";}var B="Building Interface...";if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:B,width:450,progress:true,closable:false,modal:false});}var C=A.length;var D=this;var E=function(){if(!A.length){Roo.debug&&Roo.log('hide?');if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.hide();} -Roo.XComponent.event.fireEvent('buildcomplete',D.topModule);return false;}var m=A.shift();Roo.log('m');Roo.log(m);Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return E.defer(10,D);}B="Building Interface "+(C-A.length)+" of "+C+(m.name?(' - '+m.name):'');Roo.debug&&Roo.log(B);if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.updateProgress((C-A.length)/C,B);} -Roo.log('msg');Roo.log(B);var F=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;Roo.log('disabled');Roo.log(F);if(F){return E();} +Roo.XComponent.event.fireEvent('buildcomplete',D.topModule);return false;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return E.defer(10,D);}B="Building Interface "+(C-A.length)+" of "+C+(m.name?(' - '+m.name):'');Roo.debug&&Roo.log(B);if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.updateProgress((C-A.length)/C,B);}var F=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(F){return E();} m.render();return E.defer(10,D);} E.defer(1,D);},event:false,on:false});Roo.XComponent.event=new Roo.util.Observable({events:{'register':true,'beforebuild':true,'buildcomplete':true}});Roo.XComponent.on=Roo.XComponent.event.on.createDelegate(Roo.XComponent.event); //Roo/dd/DragDrop.js diff --git a/roojs-core-debug.js b/roojs-core-debug.js index b1d0bc3315..35c2529f97 100644 --- a/roojs-core-debug.js +++ b/roojs-core-debug.js @@ -15853,23 +15853,19 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { el = el || false; var hp = this.parent ? 1 : 0; - Roo.log('hp') - Roo.log(this.parent.substr(1)); + if (!el && typeof(this.parent) == 'string' && this.parent.substring(0,1) == '#') { // if parent is a '#.....' string, then let's use that.. var ename = this.parent.substr(1) this.parent = (this.parent == '#bootstrap') ? { el : true} : false; // flags it as a top module... - Roo.log('parent'); - el = Roo.get(ename); - Roo.log(el); if (!el && !this.parent) { Roo.log("Warning - element can not be found :#" + ename ); return; } } - Roo.log(el); + if (!this.parent) { el = el ? Roo.get(el) : false; @@ -15900,6 +15896,8 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { // The 'tree' method is '_tree now' var tree = this._tree ? this._tree() : this.tree(); + Roo.log('tree'); + Roo.log(tree);return; tree.region = tree.region || this.region; if (this.parent.el === true) { // bootstrap... - body.. @@ -16201,8 +16199,7 @@ Roo.apply(Roo.XComponent, { var m = mods.shift(); - Roo.log('m'); - Roo.log(m); + Roo.debug && Roo.log(m); // not sure if this is supported any more.. - modules that are are just function if (typeof(m) == 'function') { @@ -16219,15 +16216,12 @@ Roo.apply(Roo.XComponent, { Roo.MessageBox.updateProgress( (total - mods.length)/total, msg ); } - Roo.log('msg'); - Roo.log(msg); // is the module disabled? var disabled = (typeof(m.disabled) == 'function') ? m.disabled.call(m.module.disabled) : m.disabled; - Roo.log('disabled'); - Roo.log(disabled); + if (disabled) { return progressRun(); // we do not update the display! } @@ -16235,6 +16229,7 @@ Roo.apply(Roo.XComponent, { // now build + m.render(); // it's 10 on top level, and 1 on others??? why... return progressRun.defer(10, _this); diff --git a/roojs-core.js b/roojs-core.js index 05229bd62a..34a9f46474 100644 --- a/roojs-core.js +++ b/roojs-core.js @@ -320,16 +320,13 @@ this.onResize(aw,ah,w,h);this.fireEvent('resize',this,aw,ah,w,h);}return this;}, this.onPosition(ax,ay);this.fireEvent('move',this,ax,ay);}return this;},setPagePosition:function(x,y){this.pageX=x;this.pageY=y;if(!this.boxReady){return;}if(x===undefined||y===undefined){return;}var p=this.el.translatePoints(x,y);this.setPosition(p.left,p.top);return this;},onRender:function(ct,A){Roo.BoxComponent.superclass.onRender.call(this,ct,A);if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl);}if(this.positionEl){this.positionEl=Roo.get(this.positionEl);}},afterRender:function(){Roo.BoxComponent.superclass.afterRender.call(this);this.boxReady=true;this.setSize(this.width,this.height);if(this.x||this.y){this.setPosition(this.x,this.y);}if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY);}},syncSize:function(){delete this.lastSize;this.setSize(this.el.getWidth(),this.el.getHeight());return this;},onResize:function(A,B,C,D){},onPosition:function(x,y){},adjustSize:function(w,h){if(this.autoWidth){w='auto';}if(this.autoHeight){h='auto';}return {width:w,height:h};},adjustPosition:function(x,y){return {x:x,y:y};}}); //Roo/XComponent.js Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true});this.region=this.region||'center';Roo.XComponent.register(this);this.modules=false;this.el=false;} -Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,_tree:false,render:function(el){el=el||false;var hp=this.parent?1:0;Roo.log('hp') -Roo.log(this.parent.substr(1));if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var A=this.parent.substr(1) -this.parent=(this.parent=='#bootstrap')?{el:true}:false;Roo.log('parent');el=Roo.get(A);Roo.log(el);if(!el&&!this.parent){Roo.log("Warning - element can not be found :#"+A);return;}} -Roo.log(el);if(!this.parent){el=el?Roo.get(el):false;this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})}}if(!this.parent.el){return;}var B=this._tree?this._tree():this.tree();B.region=B.region||this.region;if(this.parent.el===true){this.parent.el=Roo.factory(B);} +Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,_tree:false,render:function(el){el=el||false;var hp=this.parent?1:0;if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var A=this.parent.substr(1) +this.parent=(this.parent=='#bootstrap')?{el:true}:false;el=Roo.get(A);if(!el&&!this.parent){Roo.log("Warning - element can not be found :#"+A);return;}}if(!this.parent){el=el?Roo.get(el):false;this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})}}if(!this.parent.el){return;}var B=this._tree?this._tree():this.tree();Roo.log('tree');Roo.log(B);return;B.region=B.region||this.region;if(this.parent.el===true){this.parent.el=Roo.factory(B);} this.el=this.parent.el.addxtype(B);this.fireEvent('built',this);this.panel=this.el;this.layout=this.panel.layout;this.parentLayout=this.parent.layout||false;}});Roo.apply(Roo.XComponent,{hideProgress:false,buildCompleted:false,topModule:false,modules:[],elmodules:[],register:function(A){Roo.XComponent.event.fireEvent('register',A);switch(typeof(A.disabled)){case 'undefined':break;case 'function':if(A.disabled()){return;}break;default:if(A.disabled){return;}break;} this.modules.push(A);},toObject:function(str){if(!str||typeof(str)=='object'){return str;}if(str.substring(0,1)=='#'){return str;}var ar=str.split('.');var rt,o;rt=ar.shift();try{eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');}catch(e){throw "Module not found : "+str;}if(o===false){throw "Module not found : "+str;} Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+str;} o=o[e];});return o;},preBuild:function(){var _t=this;Roo.each(this.modules,function(A){Roo.XComponent.event.fireEvent('beforebuild',A);var B=A.parent;try{A.parent=this.toObject(B);}catch(e){Roo.log("parent:toObject failed: "+e.toString());return;}if(!A.parent){Roo.debug&&Roo.log("GOT top level module");Roo.debug&&Roo.log(A);A.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});this.topModule=A;return;}if(typeof(A.parent)=='string'){this.elmodules.push(A);return;}if(A.parent.constructor!=Roo.XComponent){Roo.log("Warning : Object Parent is not instance of XComponent:"+A.name)}if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}if(A.parent.disabled){A.disabled=true;} A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;};if((!this.topModule||!this.topModule.modules)&&!this.elmodules.length){throw "No top level modules to build";}var C=this.topModule?[this.topModule]:[];Roo.each(this.elmodules,function(e){C.push(e);if(!this.topModule&&typeof(e.parent)=='string'&&e.parent.substring(0,1)=='#'&&Roo.get(e.parent.substr(1))){A.topModule=e;}});var D=function(m){Roo.debug&&Roo.log("build Order: add: "+m.name);C.push(m);if(m.modules&&!m.disabled){Roo.debug&&Roo.log("build Order: "+m.modules.length+" child modules");m.modules.keySort('ASC',B);Roo.debug&&Roo.log("build Order: "+m.modules.length+" child modules (after sort)");m.modules.each(D);}else {Roo.debug&&Roo.log("build Order: no child modules");}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}};if(this.topModule&&this.topModule.modules){this.topModule.modules.keySort('ASC',B);this.topModule.modules.each(D);}return C;},build:function(){this.preBuild();var A=this.buildOrder();if(!A.length){throw "NO modules!!!";}var B="Building Interface...";if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:B,width:450,progress:true,closable:false,modal:false});}var C=A.length;var D=this;var E=function(){if(!A.length){Roo.debug&&Roo.log('hide?');if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.hide();} -Roo.XComponent.event.fireEvent('buildcomplete',D.topModule);return false;}var m=A.shift();Roo.log('m');Roo.log(m);Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return E.defer(10,D);}B="Building Interface "+(C-A.length)+" of "+C+(m.name?(' - '+m.name):'');Roo.debug&&Roo.log(B);if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.updateProgress((C-A.length)/C,B);} -Roo.log('msg');Roo.log(B);var F=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;Roo.log('disabled');Roo.log(F);if(F){return E();} +Roo.XComponent.event.fireEvent('buildcomplete',D.topModule);return false;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return E.defer(10,D);}B="Building Interface "+(C-A.length)+" of "+C+(m.name?(' - '+m.name):'');Roo.debug&&Roo.log(B);if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.updateProgress((C-A.length)/C,B);}var F=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(F){return E();} m.render();return E.defer(10,D);} E.defer(1,D);},event:false,on:false});Roo.XComponent.event=new Roo.util.Observable({events:{'register':true,'beforebuild':true,'buildcomplete':true}});Roo.XComponent.on=Roo.XComponent.event.on.createDelegate(Roo.XComponent.event); diff --git a/roojs-debug.js b/roojs-debug.js index 04ef3d99b8..81ac91611d 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -15853,23 +15853,19 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { el = el || false; var hp = this.parent ? 1 : 0; - Roo.log('hp') - Roo.log(this.parent.substr(1)); + if (!el && typeof(this.parent) == 'string' && this.parent.substring(0,1) == '#') { // if parent is a '#.....' string, then let's use that.. var ename = this.parent.substr(1) this.parent = (this.parent == '#bootstrap') ? { el : true} : false; // flags it as a top module... - Roo.log('parent'); - el = Roo.get(ename); - Roo.log(el); if (!el && !this.parent) { Roo.log("Warning - element can not be found :#" + ename ); return; } } - Roo.log(el); + if (!this.parent) { el = el ? Roo.get(el) : false; @@ -15900,6 +15896,8 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { // The 'tree' method is '_tree now' var tree = this._tree ? this._tree() : this.tree(); + Roo.log('tree'); + Roo.log(tree);return; tree.region = tree.region || this.region; if (this.parent.el === true) { // bootstrap... - body.. @@ -16201,8 +16199,7 @@ Roo.apply(Roo.XComponent, { var m = mods.shift(); - Roo.log('m'); - Roo.log(m); + Roo.debug && Roo.log(m); // not sure if this is supported any more.. - modules that are are just function if (typeof(m) == 'function') { @@ -16219,15 +16216,12 @@ Roo.apply(Roo.XComponent, { Roo.MessageBox.updateProgress( (total - mods.length)/total, msg ); } - Roo.log('msg'); - Roo.log(msg); // is the module disabled? var disabled = (typeof(m.disabled) == 'function') ? m.disabled.call(m.module.disabled) : m.disabled; - Roo.log('disabled'); - Roo.log(disabled); + if (disabled) { return progressRun(); // we do not update the display! } @@ -16235,6 +16229,7 @@ Roo.apply(Roo.XComponent, { // now build + m.render(); // it's 10 on top level, and 1 on others??? why... return progressRun.defer(10, _this); -- 2.39.2