From: Alan Knowles Date: Sun, 31 Jul 2011 11:35:43 +0000 (+0000) Subject: Minor CS fixes X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=1af62c29c5a2824176b2fc017e6697ba1cc38e53 Minor CS fixes --- diff --git a/Roo/BorderLayout.js b/Roo/BorderLayout.js index 3c6ac1b209..dd58d95965 100644 --- a/Roo/BorderLayout.js +++ b/Roo/BorderLayout.js @@ -463,7 +463,7 @@ layout.addxtype({ default: alert("Can not add '" + cfg.xtype + "' to BorderLayout"); - return; + return null; // GridPanel (grid, cfg) } diff --git a/Roo/ContentPanel.js b/Roo/ContentPanel.js index 4c02e8676d..399efd7ea1 100644 --- a/Roo/ContentPanel.js +++ b/Roo/ContentPanel.js @@ -12,20 +12,22 @@ * @class Roo.ContentPanel * @extends Roo.util.Observable * A basic ContentPanel element. - * @cfg {Boolean} fitToFrame True for this panel to adjust its size to fit when the region resizes (defaults to false) - * @cfg {Boolean} fitContainer When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container (defaults to false) + * @cfg {Boolean} fitToFrame True for this panel to adjust its size to fit when the region resizes (defaults to false) + * @cfg {Boolean} fitContainer When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container (defaults to false) * @cfg {Boolean/Object} autoCreate True to auto generate the DOM element for this panel, or a {@link Roo.DomHelper} config of the element to create - * @cfg {Boolean} closable True if the panel can be closed/removed - * @cfg {Boolean} background True if the panel should not be activated when it is added (defaults to false) + * @cfg {Boolean} closable True if the panel can be closed/removed + * @cfg {Boolean} background True if the panel should not be activated when it is added (defaults to false) * @cfg {String/HTMLElement/Element} resizeEl An element to resize if {@link #fitToFrame} is true (instead of this panel's element) - * @cfg {Toolbar} toolbar A toolbar for this panel - * @cfg {Boolean} autoScroll True to scroll overflow in this panel (use with {@link #fitToFrame}) - * @cfg {String} title The title for this panel - * @cfg {Array} adjustments Values to add to the width/height when doing a {@link #fitToFrame} (default is [0, 0]) - * @cfg {String} url Calls {@link #setUrl} with this value - * @cfg {String} region (center|north|south|east|west) which region to put this panel on (when used with xtype constructors) - * @cfg {String/Object} params When used with {@link #url}, calls {@link #setUrl} with this value - * @cfg {Boolean} loadOnce When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {Toolbar} toolbar A toolbar for this panel + * @cfg {Boolean} autoScroll True to scroll overflow in this panel (use with {@link #fitToFrame}) + * @cfg {String} title The title for this panel + * @cfg {Array} adjustments Values to add to the width/height when doing a {@link #fitToFrame} (default is [0, 0]) + * @cfg {String} url Calls {@link #setUrl} with this value + * @cfg {String} region (center|north|south|east|west) which region to put this panel on (when used with xtype constructors) + * @cfg {String/Object} params When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {Boolean} loadOnce When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {String} content Raw content to fill content panel with (uses setContent on construction.) + * @constructor * Create a new ContentPanel. * @param {String/HTMLElement/Roo.Element} el The container element for this panel diff --git a/roojs-all.js b/roojs-all.js index 40085d8cb3..cabf9dd1ad 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -425,15 +425,16 @@ this.mpYears.item(i-1)[y2==this.mpSelYear?'addClass':'removeClass']('x-date-mp-s this.mbtn.setText(this.monthNames[A.getMonth()]+" "+A.getFullYear());if(!this.internalRender){var T=this.el.dom.firstChild;var w=T.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));Roo.fly(T).setWidth(w);this.internalRender=true;if(Roo.isOpera&&!this.secondPass){T.rows[0].cells[1].style.width=(w-(T.rows[0].cells[0].offsetWidth+T.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[A]);}}}}); Roo.TabPanel=function(A,B){this.el=Roo.get(A,true);if(B){if(typeof B=="boolean"){this.tabPosition=B?"bottom":"top";}else {Roo.apply(this,B);}}if(this.tabPosition=="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-bottom");} this.stripWrap=Roo.get(this.createStrip(this.el.dom),true);this.stripEl=Roo.get(this.createStripList(this.stripWrap.dom),true);this.stripBody=Roo.get(this.stripWrap.dom.firstChild.firstChild,true);if(Roo.isIE){Roo.fly(this.stripWrap.dom.firstChild).setStyle("overflow-x","hidden");}if(this.tabPosition!="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-top");} -this.items=[];this.bodyEl.setStyle("position","relative");this.active=null;this.activateDelegate=this.activate.createDelegate(this);this.addEvents({"tabchange":true,"beforetabchange":true});Roo.EventManager.onWindowResize(this.onResize,this);this.cpad=this.el.getPadding("lr");this.hiddenCount=0;Roo.TabPanel.superclass.constructor.call(this);};Roo.extend(Roo.TabPanel,Roo.util.Observable,{tabPosition:"top",currentTabWidth:0,minTabWidth:40,maxTabWidth:250,preferredTabWidth:175,resizeTabs:false,monitorResize:true,addTab:function(id,A,B,C){var D=new Roo.TabPanelItem(this,id,A,C);this.addTabItem(D);if(B){D.setContent(B);}return D;},getTab:function(id){return this.items[id];},hideTab:function(id){var t=this.items[id];if(!t.isHidden()){t.setHidden(true);this.hiddenCount++;this.autoSizeTabs();}},unhideTab:function(id){var t=this.items[id];if(t.isHidden()){t.setHidden(false);this.hiddenCount--;this.autoSizeTabs();}},addTabItem:function(A){this.items[A.id]=A;this.items.push(A);if(this.resizeTabs){A.setWidth(this.currentTabWidth||this.preferredTabWidth);this.autoSizeTabs();}else {A.autoSize();}},removeTab:function(id){var A=this.items;var B=A[id];if(!B){return;}var C=A.indexOf(B);if(this.active==B&&A.length>1){var D=this.getNextAvailable(C);if(D){D.activate();}} +this.items=[];this.bodyEl.setStyle("position","relative");this.active=null;this.activateDelegate=this.activate.createDelegate(this);this.addEvents({"tabchange":true,"beforetabchange":true});Roo.EventManager.onWindowResize(this.onResize,this);this.cpad=this.el.getPadding("lr");this.hiddenCount=0;if(this.toolbar){var C=this.toolbar;C.container=this.stripEl.child('td.x-tab-strip-toolbar');this.toolbar=new Roo.Toolbar(C);if(Roo.isSafari){var D=C.container.child('table',true);D.setAttribute('width','100%');}} +Roo.TabPanel.superclass.constructor.call(this);};Roo.extend(Roo.TabPanel,Roo.util.Observable,{tabPosition:"top",currentTabWidth:0,minTabWidth:40,maxTabWidth:250,preferredTabWidth:175,resizeTabs:false,monitorResize:true,toolbar:false,addTab:function(id,A,B,C){var D=new Roo.TabPanelItem(this,id,A,C);this.addTabItem(D);if(B){D.setContent(B);}return D;},getTab:function(id){return this.items[id];},hideTab:function(id){var t=this.items[id];if(!t.isHidden()){t.setHidden(true);this.hiddenCount++;this.autoSizeTabs();}},unhideTab:function(id){var t=this.items[id];if(t.isHidden()){t.setHidden(false);this.hiddenCount--;this.autoSizeTabs();}},addTabItem:function(A){this.items[A.id]=A;this.items.push(A);if(this.resizeTabs){A.setWidth(this.currentTabWidth||this.preferredTabWidth);this.autoSizeTabs();}else {A.autoSize();}},removeTab:function(id){var A=this.items;var B=A[id];if(!B){return;}var C=A.indexOf(B);if(this.active==B&&A.length>1){var D=this.getNextAvailable(C);if(D){D.activate();}} this.stripEl.dom.removeChild(B.pnode.dom);if(B.bodyEl.dom.parentNode==this.bodyEl.dom){this.bodyEl.dom.removeChild(B.bodyEl.dom);} A.splice(C,1);delete this.items[B.id];B.fireEvent("close",B);B.purgeListeners();this.autoSizeTabs();},getNextAvailable:function(A){var B=this.items;var C=A;while(C=0){var D=B[--C];if(D&&!D.isHidden()){return D;}}return null;},disableTab:function(id){var A=this.items[id];if(A&&this.active!=A){A.disable();}},enableTab:function(id){var A=this.items[id];A.enable();},activate:function(id){var A=this.items[id];if(!A){return null;}if(A==this.active||A.disabled){return A;}var e={};this.fireEvent("beforetabchange",this,e,A);if(e.cancel!==true&&!A.disabled){if(this.active){this.active.hide();} this.active=this.items[id];this.active.show();this.fireEvent("tabchange",this,this.active);}return A;},getActiveTab:function(){return this.active;},syncHeight:function(A){var B=(A||this.el.getHeight())-this.el.getBorderWidth("tb")-this.el.getPadding("tb");var bm=this.bodyEl.getMargins();var C=B-(this.stripWrap.getHeight()||0)-(bm.top+bm.bottom);this.bodyEl.setHeight(C);return C;},onResize:function(){if(this.monitorResize){this.autoSizeTabs();}},beginUpdate:function(){this.updating=true;},endUpdate:function(){this.updating=false;this.autoSizeTabs();},autoSizeTabs:function(){var A=this.items.length;var B=A-this.hiddenCount;if(!this.resizeTabs||A<1||B<1||this.updating)return;var w=Math.max(this.el.getWidth()-this.cpad,10);var C=Math.floor(w/B);var b=this.stripBody;if(b.getWidth()>w){var D=this.items;this.setTabWidth(Math.max(C,this.minTabWidth)-2);if(C
';return A.firstChild.firstChild.firstChild.firstChild;};Roo.TabPanel.prototype.createBody=function(A){var B=document.createElement("div");Roo.id(B,"tab-body");Roo.fly(B).addClass("x-tabs-body");A.appendChild(B);return B;};Roo.TabPanel.prototype.createItemBody=function(A,id){var B=Roo.getDom(id);if(!B){B=document.createElement("div");B.id=id;} -Roo.fly(B).addClass("x-tabs-item-body");A.insertBefore(B,A.firstChild);return B;};Roo.TabPanel.prototype.createStripElements=function(A,B,C){var td=document.createElement("td");A.appendChild(td);if(C){td.className="x-tabs-closable";if(!this.closeTpl){this.closeTpl=new Roo.Template(''+'{text}'+'
 
');}var el=this.closeTpl.overwrite(td,{"text":B});var D=el.getElementsByTagName("div")[0];var E=el.getElementsByTagName("em")[0];return {"el":el,"close":D,"inner":E};}else {if(!this.tabTpl){this.tabTpl=new Roo.Template(''+'{text}');}var el=this.tabTpl.overwrite(td,{"text":B});var E=el.getElementsByTagName("em")[0];return {"el":el,"inner":E};}}; +this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);this.on("activate",this.refreshDelegate);return this.bodyEl.getUpdateManager();},_handleRefresh:function(A,B,C){if(!C||!this.loaded){var D=this.bodyEl.getUpdateManager();D.update(A,B,this._setLoaded.createDelegate(this));}},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate();}},_setLoaded:function(){this.loaded=true;},closeClick:function(e){var o={};e.stopEvent();this.fireEvent("beforeclose",this,o);if(o.cancel!==true){this.tabPanel.removeTab(this.id);}},closeText:"Close this tab"});Roo.TabPanel.prototype.createStrip=function(A){var B=document.createElement("div");B.className="x-tabs-wrap";A.appendChild(B);return B;};Roo.TabPanel.prototype.createStripList=function(A){A.innerHTML='
'+''+'
';return A.firstChild.firstChild.firstChild.firstChild;};Roo.TabPanel.prototype.createBody=function(A){var B=document.createElement("div");Roo.id(B,"tab-body");Roo.fly(B).addClass("x-tabs-body");A.appendChild(B);return B;};Roo.TabPanel.prototype.createItemBody=function(A,id){var B=Roo.getDom(id);if(!B){B=document.createElement("div");B.id=id;} +Roo.fly(B).addClass("x-tabs-item-body");A.insertBefore(B,A.firstChild);return B;};Roo.TabPanel.prototype.createStripElements=function(A,B,C){var td=document.createElement("td");A.insertBefore(td,A.childNodes[A.childNodes.length-1]);if(C){td.className="x-tabs-closable";if(!this.closeTpl){this.closeTpl=new Roo.Template(''+'{text}'+'
 
');}var el=this.closeTpl.overwrite(td,{"text":B});var D=el.getElementsByTagName("div")[0];var E=el.getElementsByTagName("em")[0];return {"el":el,"close":D,"inner":E};}else {if(!this.tabTpl){this.tabTpl=new Roo.Template(''+'{text}');}var el=this.tabTpl.overwrite(td,{"text":B});var E=el.getElementsByTagName("em")[0];return {"el":el,"inner":E};}}; Roo.Button=function(A,B){if(!B){B=A;A=B.renderTo||false;} Roo.apply(this,B);this.addEvents({"click":true,"toggle":true,'mouseover':true,'mouseout':true,'render':true});if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);} Roo.util.Observable.call(this);if(A){this.render(A);}};Roo.extend(Roo.Button,Roo.util.Observable,{hidden:false,disabled:false,pressed:false,tabIndex:undefined,enableToggle:false,menu:undefined,menuAlign:"tl-bl?",iconCls:undefined,type:'button',menuClassTarget:'tr',clickEvent:'click',handleMouseEvents:true,tooltipType:'qtip',render:function(A){var B;if(this.hideParent){this.parentEl=Roo.get(A);}if(!this.dhconfig){if(!this.template){if(!Roo.Button.buttonTemplate){Roo.Button.buttonTemplate=new Roo.Template('','',"
  
");} @@ -794,7 +795,7 @@ Roo.BorderLayout=function(A,B){B=B||{};Roo.BorderLayout.superclass.constructor.c this.el.repaint();this.fireEvent("layout",this);},safeBox:function(A){A.width=Math.max(0,A.width);A.height=Math.max(0,A.height);return A;},add:function(A,B){A=A.toLowerCase();return this.regions[A].add(B);},remove:function(A,B){A=A.toLowerCase();return this.regions[A].remove(B);},findPanel:function(A){var rs=this.regions;for(var B in rs){if(typeof rs[B]!="function"){var p=rs[B].getPanel(A);if(p){return p;}}}return null;},showPanel:function(A){var rs=this.regions;for(var B in rs){var r=rs[B];if(typeof r!="function"){if(r.hasPanel(A)){return r.showPanel(A);}}}return null;},restoreState:function(A){if(!A){A=Roo.state.Manager;}var sm=new Roo.LayoutStateManager();sm.init(this,A);},batchAdd:function(A){this.beginUpdate();for(var B in A){var lr=this.regions[B];if(lr){this.addTypedPanels(lr,A[B]);}} this.endUpdate();},addTypedPanels:function(lr,ps){if(typeof ps=='string'){lr.add(new Roo.ContentPanel(ps));}else if(ps instanceof Array){for(var i=0,A=ps.length;i0?A:" ");}},setActivePanel:function(A){A=this.getPanel(A);if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);} this.activePanel=A;A.setActiveState(true);if(this.panelSize){A.setSize(this.panelSize.width,this.panelSize.height);}if(this.closeBtn){this.closeBtn.setVisible(!this.config.closeOnTab&&!this.isSlid&&A.isClosable());} @@ -956,10 +957,10 @@ Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,argumen D.push({id:id,target:G,exec:F,test:fn,body:m[1]||''});s=s.replace(m[0],'{xtpl'+id+'}');++id;}for(var i=D.length-1;i>=0;--i){this.compileTpl(D[i]);} this.master=D[D.length-1];this.tpls=D;};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,applySubTemplate:function(id,A,B){var t=this.tpls[id];if(t.test&&!t.test.call(this,A,B)){return '';}if(t.exec&&t.exec.call(this,A,B)){return '';}var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;iString(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)});var D=function(m){C.push(m);if(m.modules){m.modules.keySort('ASC',B);m.modules.each(D);}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}};if(this.topModule){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!!!";} Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var B=A.length;var C=this;var D=function(){if(!A.length){Roo.debug&&Roo.log('hide?');Roo.MessageBox.hide();if(C.topModule){C.topModule.fireEvent('buildcomplete',C.topModule);}return false;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return D.defer(10,C);}Roo.MessageBox.updateProgress((B-A.length)/B,"Building Interface "+(B-A.length)+" of "+B+(m.name?(' - '+m.name):''));var E=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(E){return D();} m.render();return D.defer(10,C);} diff --git a/roojs-debug.js b/roojs-debug.js index c132f2c8dd..30bd9f4bdf 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -25144,7 +25144,7 @@ Roo.extend(Roo.DatePicker, Roo.Component, { } } } -});/* +}); /* * Based on: * Ext JS Library 1.1.1 * Copyright(c) 2006-2007, Ext JS, LLC. @@ -25216,11 +25216,11 @@ Roo.TabPanel = function(container, config){ Roo.fly(this.stripWrap.dom.firstChild).setStyle("overflow-x", "hidden"); } if(this.tabPosition != "bottom"){ - /** The body element that contains {@link Roo.TabPanelItem} bodies. - * @type Roo.Element - */ - this.bodyEl = Roo.get(this.createBody(this.el.dom)); - this.el.addClass("x-tabs-top"); + /** The body element that contains {@link Roo.TabPanelItem} bodies. + + * @type Roo.Element + */ + this.bodyEl = Roo.get(this.createBody(this.el.dom)); + this.el.addClass("x-tabs-top"); } this.items = []; @@ -25251,38 +25251,57 @@ Roo.TabPanel = function(container, config){ this.cpad = this.el.getPadding("lr"); this.hiddenCount = 0; + + // toolbar on the tabbar support... + if (this.toolbar) { + var tcfg = this.toolbar; + tcfg.container = this.stripEl.child('td.x-tab-strip-toolbar'); + this.toolbar = new Roo.Toolbar(tcfg); + if (Roo.isSafari) { + var tbl = tcfg.container.child('table', true); + tbl.setAttribute('width', '100%'); + } + + } + + + Roo.TabPanel.superclass.constructor.call(this); }; Roo.extend(Roo.TabPanel, Roo.util.Observable, { - /* - *@cfg {String} tabPosition "top" or "bottom" (defaults to "top") - */ + /* + *@cfg {String} tabPosition "top" or "bottom" (defaults to "top") + */ tabPosition : "top", - /* - *@cfg {Number} currentTabWidth The width of the current tab (defaults to 0) - */ + /* + *@cfg {Number} currentTabWidth The width of the current tab (defaults to 0) + */ currentTabWidth : 0, - /* - *@cfg {Number} minTabWidth The minimum width of a tab (defaults to 40) (ignored if {@link #resizeTabs} is not true) - */ + /* + *@cfg {Number} minTabWidth The minimum width of a tab (defaults to 40) (ignored if {@link #resizeTabs} is not true) + */ minTabWidth : 40, - /* - *@cfg {Number} maxTabWidth The maximum width of a tab (defaults to 250) (ignored if {@link #resizeTabs} is not true) - */ + /* + *@cfg {Number} maxTabWidth The maximum width of a tab (defaults to 250) (ignored if {@link #resizeTabs} is not true) + */ maxTabWidth : 250, - /* - *@cfg {Number} preferredTabWidth The preferred (default) width of a tab (defaults to 175) (ignored if {@link #resizeTabs} is not true) - */ + /* + *@cfg {Number} preferredTabWidth The preferred (default) width of a tab (defaults to 175) (ignored if {@link #resizeTabs} is not true) + */ preferredTabWidth : 175, - /* - *@cfg {Boolean} resizeTabs True to enable dynamic tab resizing (defaults to false) - */ + /* + *@cfg {Boolean} resizeTabs True to enable dynamic tab resizing (defaults to false) + */ resizeTabs : false, - /* - *@cfg {Boolean} monitorResize Set this to true to turn on window resize monitoring (ignored if {@link #resizeTabs} is not true) (defaults to true) - */ + /* + *@cfg {Boolean} monitorResize Set this to true to turn on window resize monitoring (ignored if {@link #resizeTabs} is not true) (defaults to true) + */ monitorResize : true, + /* + *@cfg {Object} toolbar xtype description of toolbar to show at the right of the tab bar. + */ + toolbar : false, /** * Creates a new {@link Roo.TabPanelItem} by looking for an existing element with the provided id -- if it's not found it creates one. @@ -25872,7 +25891,10 @@ Roo.TabPanel.prototype.createStrip = function(container){ /** @private */ Roo.TabPanel.prototype.createStripList = function(strip){ // div wrapper for retard IE - strip.innerHTML = '
'; + // returns the "tr" element. + strip.innerHTML = '
'+ + ''+ + '
'; return strip.firstChild.firstChild.firstChild.firstChild; }; /** @private */ @@ -25897,7 +25919,8 @@ Roo.TabPanel.prototype.createItemBody = function(bodyEl, id){ /** @private */ Roo.TabPanel.prototype.createStripElements = function(stripEl, text, closable){ var td = document.createElement("td"); - stripEl.appendChild(td); + stripEl.insertBefore(td, stripEl.childNodes[stripEl.childNodes.length-1]); + //stripEl.appendChild(td); if(closable){ td.className = "x-tabs-closable"; if(!this.closeTpl){ @@ -43944,7 +43967,7 @@ layout.addxtype({ default: alert("Can not add '" + cfg.xtype + "' to BorderLayout"); - return; + return null; // GridPanel (grid, cfg) } @@ -44383,33 +44406,34 @@ Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, { * @class Roo.LayoutRegion * @extends Roo.BasicLayoutRegion * This class represents a region in a layout manager. - * @cfg {Boolean} collapsible False to disable collapsing (defaults to true) - * @cfg {Boolean} collapsed True to set the initial display to collapsed (defaults to false) - * @cfg {Boolean} floatable False to disable floating (defaults to true) - * @cfg {Object} margins Margins for the element (defaults to {top: 0, left: 0, right:0, bottom: 0}) - * @cfg {Object} cmargins Margins for the element when collapsed (defaults to: north/south {top: 2, left: 0, right:0, bottom: 2} or east/west {top: 0, left: 2, right:2, bottom: 0}) - * @cfg {String} tabPosition "top" or "bottom" (defaults to "bottom") - * @cfg {String} collapsedTitle Optional string message to display in the collapsed block of a north or south region - * @cfg {Boolean} alwaysShowTabs True to always display tabs even when there is only 1 panel (defaults to false) - * @cfg {Boolean} autoScroll True to enable overflow scrolling (defaults to false) - * @cfg {Boolean} titlebar True to display a title bar (defaults to true) - * @cfg {String} title The title for the region (overrides panel titles) - * @cfg {Boolean} animate True to animate expand/collapse (defaults to false) - * @cfg {Boolean} autoHide False to disable auto hiding when the mouse leaves the "floated" region (defaults to true) - * @cfg {Boolean} preservePanels True to preserve removed panels so they can be readded later (defaults to false) - * @cfg {Boolean} closeOnTab True to place the close icon on the tabs instead of the region titlebar (defaults to false) - * @cfg {Boolean} hideTabs True to hide the tab strip (defaults to false) - * @cfg {Boolean} resizeTabs True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within - * the space available, similar to FireFox 1.5 tabs (defaults to false) - * @cfg {Number} minTabWidth The minimum tab width (defaults to 40) - * @cfg {Number} preferredTabWidth The preferred tab width (defaults to 150) - * @cfg {Boolean} showPin True to show a pin button -* @cfg {Boolean} hidden True to start the region hidden (defaults to false) -* @cfg {Boolean} hideWhenEmpty True to hide the region when it has no panels -* @cfg {Boolean} disableTabTips True to disable tab tooltips -* @cfg {Number} width For East/West panels -* @cfg {Number} height For North/South panels -* @cfg {Boolean} split To show the splitter + * @cfg {Boolean} collapsible False to disable collapsing (defaults to true) + * @cfg {Boolean} collapsed True to set the initial display to collapsed (defaults to false) + * @cfg {Boolean} floatable False to disable floating (defaults to true) + * @cfg {Object} margins Margins for the element (defaults to {top: 0, left: 0, right:0, bottom: 0}) + * @cfg {Object} cmargins Margins for the element when collapsed (defaults to: north/south {top: 2, left: 0, right:0, bottom: 2} or east/west {top: 0, left: 2, right:2, bottom: 0}) + * @cfg {String} tabPosition "top" or "bottom" (defaults to "bottom") + * @cfg {String} collapsedTitle Optional string message to display in the collapsed block of a north or south region + * @cfg {Boolean} alwaysShowTabs True to always display tabs even when there is only 1 panel (defaults to false) + * @cfg {Boolean} autoScroll True to enable overflow scrolling (defaults to false) + * @cfg {Boolean} titlebar True to display a title bar (defaults to true) + * @cfg {String} title The title for the region (overrides panel titles) + * @cfg {Boolean} animate True to animate expand/collapse (defaults to false) + * @cfg {Boolean} autoHide False to disable auto hiding when the mouse leaves the "floated" region (defaults to true) + * @cfg {Boolean} preservePanels True to preserve removed panels so they can be readded later (defaults to false) + * @cfg {Boolean} closeOnTab True to place the close icon on the tabs instead of the region titlebar (defaults to false) + * @cfg {Boolean} hideTabs True to hide the tab strip (defaults to false) + * @cfg {Boolean} resizeTabs True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within + * the space available, similar to FireFox 1.5 tabs (defaults to false) + * @cfg {Number} minTabWidth The minimum tab width (defaults to 40) + * @cfg {Number} preferredTabWidth The preferred tab width (defaults to 150) + * @cfg {Boolean} showPin True to show a pin button + * @cfg {Boolean} hidden True to start the region hidden (defaults to false) + * @cfg {Boolean} hideWhenEmpty True to hide the region when it has no panels + * @cfg {Boolean} disableTabTips True to disable tab tooltips + * @cfg {Number} width For East/West panels + * @cfg {Number} height For North/South panels + * @cfg {Boolean} split To show the splitter + * @cfg {Boolean} toolbar xtype configuration for a toolbar - shows on right of tabbar */ Roo.LayoutRegion = function(mgr, config, pos){ Roo.LayoutRegion.superclass.constructor.call(this, mgr, config, pos, true); @@ -44724,12 +44748,17 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { // overridden }, - initTabs : function(){ + initTabs : function() + { this.bodyEl.setStyle("overflow", "hidden"); - var ts = new Roo.TabPanel(this.bodyEl.dom, { - tabPosition: this.bottomTabs ? 'bottom' : 'top', - disableTooltips: this.config.disableTabTips - }); + var ts = new Roo.TabPanel( + this.bodyEl.dom, + { + tabPosition: this.bottomTabs ? 'bottom' : 'top', + disableTooltips: this.config.disableTabTips, + toolbar : this.config.toolbar + } + ); if(this.config.hideTabs){ ts.stripWrap.setDisplayed(false); } @@ -45603,20 +45632,22 @@ Roo.LayoutStateManager.prototype = { * @class Roo.ContentPanel * @extends Roo.util.Observable * A basic ContentPanel element. - * @cfg {Boolean} fitToFrame True for this panel to adjust its size to fit when the region resizes (defaults to false) - * @cfg {Boolean} fitContainer When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container (defaults to false) + * @cfg {Boolean} fitToFrame True for this panel to adjust its size to fit when the region resizes (defaults to false) + * @cfg {Boolean} fitContainer When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container (defaults to false) * @cfg {Boolean/Object} autoCreate True to auto generate the DOM element for this panel, or a {@link Roo.DomHelper} config of the element to create - * @cfg {Boolean} closable True if the panel can be closed/removed - * @cfg {Boolean} background True if the panel should not be activated when it is added (defaults to false) + * @cfg {Boolean} closable True if the panel can be closed/removed + * @cfg {Boolean} background True if the panel should not be activated when it is added (defaults to false) * @cfg {String/HTMLElement/Element} resizeEl An element to resize if {@link #fitToFrame} is true (instead of this panel's element) - * @cfg {Toolbar} toolbar A toolbar for this panel - * @cfg {Boolean} autoScroll True to scroll overflow in this panel (use with {@link #fitToFrame}) - * @cfg {String} title The title for this panel - * @cfg {Array} adjustments Values to add to the width/height when doing a {@link #fitToFrame} (default is [0, 0]) - * @cfg {String} url Calls {@link #setUrl} with this value - * @cfg {String} region (center|north|south|east|west) which region to put this panel on (when used with xtype constructors) - * @cfg {String/Object} params When used with {@link #url}, calls {@link #setUrl} with this value - * @cfg {Boolean} loadOnce When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {Toolbar} toolbar A toolbar for this panel + * @cfg {Boolean} autoScroll True to scroll overflow in this panel (use with {@link #fitToFrame}) + * @cfg {String} title The title for this panel + * @cfg {Array} adjustments Values to add to the width/height when doing a {@link #fitToFrame} (default is [0, 0]) + * @cfg {String} url Calls {@link #setUrl} with this value + * @cfg {String} region (center|north|south|east|west) which region to put this panel on (when used with xtype constructors) + * @cfg {String/Object} params When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {Boolean} loadOnce When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {String} content Raw content to fill content panel with (uses setContent on construction.) + * @constructor * Create a new ContentPanel. * @param {String/HTMLElement/Roo.Element} el The container element for this panel @@ -51395,6 +51426,7 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { { el = el || false; + var hp = this.parent ? 1 : 0; if (!el && typeof(this.parent) == 'string' && this.parent[0] == '#') { // if parent is a '#.....' string, then let's use that.. @@ -51406,6 +51438,8 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { return; } } + + if (!this.parent) { el = el ? Roo.get(el) : false; @@ -51420,8 +51454,8 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { closeOnTab: true, tabPosition: 'top', //resizeTabs: true, - alwaysShowTabs: el ? false : true, - hideTabs: el ? true : false, + alwaysShowTabs: el && hp? false : true, + hideTabs: el || !hp ? true : false, minTabWidth: 140 } }) @@ -51529,6 +51563,7 @@ Roo.apply(Roo.XComponent, { } o = o[e]; }); + return o; }, @@ -51540,10 +51575,11 @@ Roo.apply(Roo.XComponent, { */ preBuild : function () { - + var _t = this; Roo.each(this.modules , function (obj) { - obj.parent = this.toObject(obj.parent); + var opar = obj.parent; + obj.parent = this.toObject(opar); if (!obj.parent) { this.topModule = obj; @@ -51553,7 +51589,9 @@ Roo.apply(Roo.XComponent, { this.elmodules.push(obj); return; } - + if (obj.parent.constructor != Roo.XComponent) { + Roo.log("Object Parent is not instance of XComponent:" + obj.name) + } if (!obj.parent.modules) { obj.parent.modules = new Roo.util.MixedCollection(false, function(o) { return o.order + '' } diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index bb877c7724..77edbfc608 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -10684,7 +10684,7 @@ Roo.extend(Roo.DatePicker, Roo.Component, { } } } -});/* +}); /* * Based on: * Ext JS Library 1.1.1 * Copyright(c) 2006-2007, Ext JS, LLC. @@ -10756,11 +10756,11 @@ Roo.TabPanel = function(container, config){ Roo.fly(this.stripWrap.dom.firstChild).setStyle("overflow-x", "hidden"); } if(this.tabPosition != "bottom"){ - /** The body element that contains {@link Roo.TabPanelItem} bodies. - * @type Roo.Element - */ - this.bodyEl = Roo.get(this.createBody(this.el.dom)); - this.el.addClass("x-tabs-top"); + /** The body element that contains {@link Roo.TabPanelItem} bodies. + + * @type Roo.Element + */ + this.bodyEl = Roo.get(this.createBody(this.el.dom)); + this.el.addClass("x-tabs-top"); } this.items = []; @@ -10791,38 +10791,57 @@ Roo.TabPanel = function(container, config){ this.cpad = this.el.getPadding("lr"); this.hiddenCount = 0; + + // toolbar on the tabbar support... + if (this.toolbar) { + var tcfg = this.toolbar; + tcfg.container = this.stripEl.child('td.x-tab-strip-toolbar'); + this.toolbar = new Roo.Toolbar(tcfg); + if (Roo.isSafari) { + var tbl = tcfg.container.child('table', true); + tbl.setAttribute('width', '100%'); + } + + } + + + Roo.TabPanel.superclass.constructor.call(this); }; Roo.extend(Roo.TabPanel, Roo.util.Observable, { - /* - *@cfg {String} tabPosition "top" or "bottom" (defaults to "top") - */ + /* + *@cfg {String} tabPosition "top" or "bottom" (defaults to "top") + */ tabPosition : "top", - /* - *@cfg {Number} currentTabWidth The width of the current tab (defaults to 0) - */ + /* + *@cfg {Number} currentTabWidth The width of the current tab (defaults to 0) + */ currentTabWidth : 0, - /* - *@cfg {Number} minTabWidth The minimum width of a tab (defaults to 40) (ignored if {@link #resizeTabs} is not true) - */ + /* + *@cfg {Number} minTabWidth The minimum width of a tab (defaults to 40) (ignored if {@link #resizeTabs} is not true) + */ minTabWidth : 40, - /* - *@cfg {Number} maxTabWidth The maximum width of a tab (defaults to 250) (ignored if {@link #resizeTabs} is not true) - */ + /* + *@cfg {Number} maxTabWidth The maximum width of a tab (defaults to 250) (ignored if {@link #resizeTabs} is not true) + */ maxTabWidth : 250, - /* - *@cfg {Number} preferredTabWidth The preferred (default) width of a tab (defaults to 175) (ignored if {@link #resizeTabs} is not true) - */ + /* + *@cfg {Number} preferredTabWidth The preferred (default) width of a tab (defaults to 175) (ignored if {@link #resizeTabs} is not true) + */ preferredTabWidth : 175, - /* - *@cfg {Boolean} resizeTabs True to enable dynamic tab resizing (defaults to false) - */ + /* + *@cfg {Boolean} resizeTabs True to enable dynamic tab resizing (defaults to false) + */ resizeTabs : false, - /* - *@cfg {Boolean} monitorResize Set this to true to turn on window resize monitoring (ignored if {@link #resizeTabs} is not true) (defaults to true) - */ + /* + *@cfg {Boolean} monitorResize Set this to true to turn on window resize monitoring (ignored if {@link #resizeTabs} is not true) (defaults to true) + */ monitorResize : true, + /* + *@cfg {Object} toolbar xtype description of toolbar to show at the right of the tab bar. + */ + toolbar : false, /** * Creates a new {@link Roo.TabPanelItem} by looking for an existing element with the provided id -- if it's not found it creates one. @@ -11412,7 +11431,10 @@ Roo.TabPanel.prototype.createStrip = function(container){ /** @private */ Roo.TabPanel.prototype.createStripList = function(strip){ // div wrapper for retard IE - strip.innerHTML = '
'; + // returns the "tr" element. + strip.innerHTML = '
'+ + ''+ + '
'; return strip.firstChild.firstChild.firstChild.firstChild; }; /** @private */ @@ -11437,7 +11459,8 @@ Roo.TabPanel.prototype.createItemBody = function(bodyEl, id){ /** @private */ Roo.TabPanel.prototype.createStripElements = function(stripEl, text, closable){ var td = document.createElement("td"); - stripEl.appendChild(td); + stripEl.insertBefore(td, stripEl.childNodes[stripEl.childNodes.length-1]); + //stripEl.appendChild(td); if(closable){ td.className = "x-tabs-closable"; if(!this.closeTpl){ @@ -29484,7 +29507,7 @@ layout.addxtype({ default: alert("Can not add '" + cfg.xtype + "' to BorderLayout"); - return; + return null; // GridPanel (grid, cfg) } @@ -29923,33 +29946,34 @@ Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, { * @class Roo.LayoutRegion * @extends Roo.BasicLayoutRegion * This class represents a region in a layout manager. - * @cfg {Boolean} collapsible False to disable collapsing (defaults to true) - * @cfg {Boolean} collapsed True to set the initial display to collapsed (defaults to false) - * @cfg {Boolean} floatable False to disable floating (defaults to true) - * @cfg {Object} margins Margins for the element (defaults to {top: 0, left: 0, right:0, bottom: 0}) - * @cfg {Object} cmargins Margins for the element when collapsed (defaults to: north/south {top: 2, left: 0, right:0, bottom: 2} or east/west {top: 0, left: 2, right:2, bottom: 0}) - * @cfg {String} tabPosition "top" or "bottom" (defaults to "bottom") - * @cfg {String} collapsedTitle Optional string message to display in the collapsed block of a north or south region - * @cfg {Boolean} alwaysShowTabs True to always display tabs even when there is only 1 panel (defaults to false) - * @cfg {Boolean} autoScroll True to enable overflow scrolling (defaults to false) - * @cfg {Boolean} titlebar True to display a title bar (defaults to true) - * @cfg {String} title The title for the region (overrides panel titles) - * @cfg {Boolean} animate True to animate expand/collapse (defaults to false) - * @cfg {Boolean} autoHide False to disable auto hiding when the mouse leaves the "floated" region (defaults to true) - * @cfg {Boolean} preservePanels True to preserve removed panels so they can be readded later (defaults to false) - * @cfg {Boolean} closeOnTab True to place the close icon on the tabs instead of the region titlebar (defaults to false) - * @cfg {Boolean} hideTabs True to hide the tab strip (defaults to false) - * @cfg {Boolean} resizeTabs True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within - * the space available, similar to FireFox 1.5 tabs (defaults to false) - * @cfg {Number} minTabWidth The minimum tab width (defaults to 40) - * @cfg {Number} preferredTabWidth The preferred tab width (defaults to 150) - * @cfg {Boolean} showPin True to show a pin button -* @cfg {Boolean} hidden True to start the region hidden (defaults to false) -* @cfg {Boolean} hideWhenEmpty True to hide the region when it has no panels -* @cfg {Boolean} disableTabTips True to disable tab tooltips -* @cfg {Number} width For East/West panels -* @cfg {Number} height For North/South panels -* @cfg {Boolean} split To show the splitter + * @cfg {Boolean} collapsible False to disable collapsing (defaults to true) + * @cfg {Boolean} collapsed True to set the initial display to collapsed (defaults to false) + * @cfg {Boolean} floatable False to disable floating (defaults to true) + * @cfg {Object} margins Margins for the element (defaults to {top: 0, left: 0, right:0, bottom: 0}) + * @cfg {Object} cmargins Margins for the element when collapsed (defaults to: north/south {top: 2, left: 0, right:0, bottom: 2} or east/west {top: 0, left: 2, right:2, bottom: 0}) + * @cfg {String} tabPosition "top" or "bottom" (defaults to "bottom") + * @cfg {String} collapsedTitle Optional string message to display in the collapsed block of a north or south region + * @cfg {Boolean} alwaysShowTabs True to always display tabs even when there is only 1 panel (defaults to false) + * @cfg {Boolean} autoScroll True to enable overflow scrolling (defaults to false) + * @cfg {Boolean} titlebar True to display a title bar (defaults to true) + * @cfg {String} title The title for the region (overrides panel titles) + * @cfg {Boolean} animate True to animate expand/collapse (defaults to false) + * @cfg {Boolean} autoHide False to disable auto hiding when the mouse leaves the "floated" region (defaults to true) + * @cfg {Boolean} preservePanels True to preserve removed panels so they can be readded later (defaults to false) + * @cfg {Boolean} closeOnTab True to place the close icon on the tabs instead of the region titlebar (defaults to false) + * @cfg {Boolean} hideTabs True to hide the tab strip (defaults to false) + * @cfg {Boolean} resizeTabs True to enable automatic tab resizing. This will resize the tabs so they are all the same size and fit within + * the space available, similar to FireFox 1.5 tabs (defaults to false) + * @cfg {Number} minTabWidth The minimum tab width (defaults to 40) + * @cfg {Number} preferredTabWidth The preferred tab width (defaults to 150) + * @cfg {Boolean} showPin True to show a pin button + * @cfg {Boolean} hidden True to start the region hidden (defaults to false) + * @cfg {Boolean} hideWhenEmpty True to hide the region when it has no panels + * @cfg {Boolean} disableTabTips True to disable tab tooltips + * @cfg {Number} width For East/West panels + * @cfg {Number} height For North/South panels + * @cfg {Boolean} split To show the splitter + * @cfg {Boolean} toolbar xtype configuration for a toolbar - shows on right of tabbar */ Roo.LayoutRegion = function(mgr, config, pos){ Roo.LayoutRegion.superclass.constructor.call(this, mgr, config, pos, true); @@ -30264,12 +30288,17 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { // overridden }, - initTabs : function(){ + initTabs : function() + { this.bodyEl.setStyle("overflow", "hidden"); - var ts = new Roo.TabPanel(this.bodyEl.dom, { - tabPosition: this.bottomTabs ? 'bottom' : 'top', - disableTooltips: this.config.disableTabTips - }); + var ts = new Roo.TabPanel( + this.bodyEl.dom, + { + tabPosition: this.bottomTabs ? 'bottom' : 'top', + disableTooltips: this.config.disableTabTips, + toolbar : this.config.toolbar + } + ); if(this.config.hideTabs){ ts.stripWrap.setDisplayed(false); } @@ -31143,20 +31172,22 @@ Roo.LayoutStateManager.prototype = { * @class Roo.ContentPanel * @extends Roo.util.Observable * A basic ContentPanel element. - * @cfg {Boolean} fitToFrame True for this panel to adjust its size to fit when the region resizes (defaults to false) - * @cfg {Boolean} fitContainer When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container (defaults to false) + * @cfg {Boolean} fitToFrame True for this panel to adjust its size to fit when the region resizes (defaults to false) + * @cfg {Boolean} fitContainer When using {@link #fitToFrame} and {@link #resizeEl}, you can also fit the parent container (defaults to false) * @cfg {Boolean/Object} autoCreate True to auto generate the DOM element for this panel, or a {@link Roo.DomHelper} config of the element to create - * @cfg {Boolean} closable True if the panel can be closed/removed - * @cfg {Boolean} background True if the panel should not be activated when it is added (defaults to false) + * @cfg {Boolean} closable True if the panel can be closed/removed + * @cfg {Boolean} background True if the panel should not be activated when it is added (defaults to false) * @cfg {String/HTMLElement/Element} resizeEl An element to resize if {@link #fitToFrame} is true (instead of this panel's element) - * @cfg {Toolbar} toolbar A toolbar for this panel - * @cfg {Boolean} autoScroll True to scroll overflow in this panel (use with {@link #fitToFrame}) - * @cfg {String} title The title for this panel - * @cfg {Array} adjustments Values to add to the width/height when doing a {@link #fitToFrame} (default is [0, 0]) - * @cfg {String} url Calls {@link #setUrl} with this value - * @cfg {String} region (center|north|south|east|west) which region to put this panel on (when used with xtype constructors) - * @cfg {String/Object} params When used with {@link #url}, calls {@link #setUrl} with this value - * @cfg {Boolean} loadOnce When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {Toolbar} toolbar A toolbar for this panel + * @cfg {Boolean} autoScroll True to scroll overflow in this panel (use with {@link #fitToFrame}) + * @cfg {String} title The title for this panel + * @cfg {Array} adjustments Values to add to the width/height when doing a {@link #fitToFrame} (default is [0, 0]) + * @cfg {String} url Calls {@link #setUrl} with this value + * @cfg {String} region (center|north|south|east|west) which region to put this panel on (when used with xtype constructors) + * @cfg {String/Object} params When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {Boolean} loadOnce When used with {@link #url}, calls {@link #setUrl} with this value + * @cfg {String} content Raw content to fill content panel with (uses setContent on construction.) + * @constructor * Create a new ContentPanel. * @param {String/HTMLElement/Roo.Element} el The container element for this panel @@ -36935,6 +36966,7 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { { el = el || false; + var hp = this.parent ? 1 : 0; if (!el && typeof(this.parent) == 'string' && this.parent[0] == '#') { // if parent is a '#.....' string, then let's use that.. @@ -36946,6 +36978,8 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { return; } } + + if (!this.parent) { el = el ? Roo.get(el) : false; @@ -36960,8 +36994,8 @@ Roo.extend(Roo.XComponent, Roo.util.Observable, { closeOnTab: true, tabPosition: 'top', //resizeTabs: true, - alwaysShowTabs: el ? false : true, - hideTabs: el ? true : false, + alwaysShowTabs: el && hp? false : true, + hideTabs: el || !hp ? true : false, minTabWidth: 140 } }) @@ -37069,6 +37103,7 @@ Roo.apply(Roo.XComponent, { } o = o[e]; }); + return o; }, @@ -37080,10 +37115,11 @@ Roo.apply(Roo.XComponent, { */ preBuild : function () { - + var _t = this; Roo.each(this.modules , function (obj) { - obj.parent = this.toObject(obj.parent); + var opar = obj.parent; + obj.parent = this.toObject(opar); if (!obj.parent) { this.topModule = obj; @@ -37093,7 +37129,9 @@ Roo.apply(Roo.XComponent, { this.elmodules.push(obj); return; } - + if (obj.parent.constructor != Roo.XComponent) { + Roo.log("Object Parent is not instance of XComponent:" + obj.name) + } if (!obj.parent.modules) { obj.parent.modules = new Roo.util.MixedCollection(false, function(o) { return o.order + '' } diff --git a/roojs-ui.js b/roojs-ui.js index 1ada6dc4a2..d32da80b80 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -181,15 +181,16 @@ this.mpYears.item(i-1)[y2==this.mpSelYear?'addClass':'removeClass']('x-date-mp-s this.mbtn.setText(this.monthNames[A.getMonth()]+" "+A.getFullYear());if(!this.internalRender){var T=this.el.dom.firstChild;var w=T.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));Roo.fly(T).setWidth(w);this.internalRender=true;if(Roo.isOpera&&!this.secondPass){T.rows[0].cells[1].style.width=(w-(T.rows[0].cells[0].offsetWidth+T.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[A]);}}}}); Roo.TabPanel=function(A,B){this.el=Roo.get(A,true);if(B){if(typeof B=="boolean"){this.tabPosition=B?"bottom":"top";}else {Roo.apply(this,B);}}if(this.tabPosition=="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-bottom");} this.stripWrap=Roo.get(this.createStrip(this.el.dom),true);this.stripEl=Roo.get(this.createStripList(this.stripWrap.dom),true);this.stripBody=Roo.get(this.stripWrap.dom.firstChild.firstChild,true);if(Roo.isIE){Roo.fly(this.stripWrap.dom.firstChild).setStyle("overflow-x","hidden");}if(this.tabPosition!="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-top");} -this.items=[];this.bodyEl.setStyle("position","relative");this.active=null;this.activateDelegate=this.activate.createDelegate(this);this.addEvents({"tabchange":true,"beforetabchange":true});Roo.EventManager.onWindowResize(this.onResize,this);this.cpad=this.el.getPadding("lr");this.hiddenCount=0;Roo.TabPanel.superclass.constructor.call(this);};Roo.extend(Roo.TabPanel,Roo.util.Observable,{tabPosition:"top",currentTabWidth:0,minTabWidth:40,maxTabWidth:250,preferredTabWidth:175,resizeTabs:false,monitorResize:true,addTab:function(id,A,B,C){var D=new Roo.TabPanelItem(this,id,A,C);this.addTabItem(D);if(B){D.setContent(B);}return D;},getTab:function(id){return this.items[id];},hideTab:function(id){var t=this.items[id];if(!t.isHidden()){t.setHidden(true);this.hiddenCount++;this.autoSizeTabs();}},unhideTab:function(id){var t=this.items[id];if(t.isHidden()){t.setHidden(false);this.hiddenCount--;this.autoSizeTabs();}},addTabItem:function(A){this.items[A.id]=A;this.items.push(A);if(this.resizeTabs){A.setWidth(this.currentTabWidth||this.preferredTabWidth);this.autoSizeTabs();}else {A.autoSize();}},removeTab:function(id){var A=this.items;var B=A[id];if(!B){return;}var C=A.indexOf(B);if(this.active==B&&A.length>1){var D=this.getNextAvailable(C);if(D){D.activate();}} +this.items=[];this.bodyEl.setStyle("position","relative");this.active=null;this.activateDelegate=this.activate.createDelegate(this);this.addEvents({"tabchange":true,"beforetabchange":true});Roo.EventManager.onWindowResize(this.onResize,this);this.cpad=this.el.getPadding("lr");this.hiddenCount=0;if(this.toolbar){var C=this.toolbar;C.container=this.stripEl.child('td.x-tab-strip-toolbar');this.toolbar=new Roo.Toolbar(C);if(Roo.isSafari){var D=C.container.child('table',true);D.setAttribute('width','100%');}} +Roo.TabPanel.superclass.constructor.call(this);};Roo.extend(Roo.TabPanel,Roo.util.Observable,{tabPosition:"top",currentTabWidth:0,minTabWidth:40,maxTabWidth:250,preferredTabWidth:175,resizeTabs:false,monitorResize:true,toolbar:false,addTab:function(id,A,B,C){var D=new Roo.TabPanelItem(this,id,A,C);this.addTabItem(D);if(B){D.setContent(B);}return D;},getTab:function(id){return this.items[id];},hideTab:function(id){var t=this.items[id];if(!t.isHidden()){t.setHidden(true);this.hiddenCount++;this.autoSizeTabs();}},unhideTab:function(id){var t=this.items[id];if(t.isHidden()){t.setHidden(false);this.hiddenCount--;this.autoSizeTabs();}},addTabItem:function(A){this.items[A.id]=A;this.items.push(A);if(this.resizeTabs){A.setWidth(this.currentTabWidth||this.preferredTabWidth);this.autoSizeTabs();}else {A.autoSize();}},removeTab:function(id){var A=this.items;var B=A[id];if(!B){return;}var C=A.indexOf(B);if(this.active==B&&A.length>1){var D=this.getNextAvailable(C);if(D){D.activate();}} this.stripEl.dom.removeChild(B.pnode.dom);if(B.bodyEl.dom.parentNode==this.bodyEl.dom){this.bodyEl.dom.removeChild(B.bodyEl.dom);} A.splice(C,1);delete this.items[B.id];B.fireEvent("close",B);B.purgeListeners();this.autoSizeTabs();},getNextAvailable:function(A){var B=this.items;var C=A;while(C=0){var D=B[--C];if(D&&!D.isHidden()){return D;}}return null;},disableTab:function(id){var A=this.items[id];if(A&&this.active!=A){A.disable();}},enableTab:function(id){var A=this.items[id];A.enable();},activate:function(id){var A=this.items[id];if(!A){return null;}if(A==this.active||A.disabled){return A;}var e={};this.fireEvent("beforetabchange",this,e,A);if(e.cancel!==true&&!A.disabled){if(this.active){this.active.hide();} this.active=this.items[id];this.active.show();this.fireEvent("tabchange",this,this.active);}return A;},getActiveTab:function(){return this.active;},syncHeight:function(A){var B=(A||this.el.getHeight())-this.el.getBorderWidth("tb")-this.el.getPadding("tb");var bm=this.bodyEl.getMargins();var C=B-(this.stripWrap.getHeight()||0)-(bm.top+bm.bottom);this.bodyEl.setHeight(C);return C;},onResize:function(){if(this.monitorResize){this.autoSizeTabs();}},beginUpdate:function(){this.updating=true;},endUpdate:function(){this.updating=false;this.autoSizeTabs();},autoSizeTabs:function(){var A=this.items.length;var B=A-this.hiddenCount;if(!this.resizeTabs||A<1||B<1||this.updating)return;var w=Math.max(this.el.getWidth()-this.cpad,10);var C=Math.floor(w/B);var b=this.stripBody;if(b.getWidth()>w){var D=this.items;this.setTabWidth(Math.max(C,this.minTabWidth)-2);if(C
';return A.firstChild.firstChild.firstChild.firstChild;};Roo.TabPanel.prototype.createBody=function(A){var B=document.createElement("div");Roo.id(B,"tab-body");Roo.fly(B).addClass("x-tabs-body");A.appendChild(B);return B;};Roo.TabPanel.prototype.createItemBody=function(A,id){var B=Roo.getDom(id);if(!B){B=document.createElement("div");B.id=id;} -Roo.fly(B).addClass("x-tabs-item-body");A.insertBefore(B,A.firstChild);return B;};Roo.TabPanel.prototype.createStripElements=function(A,B,C){var td=document.createElement("td");A.appendChild(td);if(C){td.className="x-tabs-closable";if(!this.closeTpl){this.closeTpl=new Roo.Template(''+'{text}'+'
 
');}var el=this.closeTpl.overwrite(td,{"text":B});var D=el.getElementsByTagName("div")[0];var E=el.getElementsByTagName("em")[0];return {"el":el,"close":D,"inner":E};}else {if(!this.tabTpl){this.tabTpl=new Roo.Template(''+'{text}');}var el=this.tabTpl.overwrite(td,{"text":B});var E=el.getElementsByTagName("em")[0];return {"el":el,"inner":E};}}; +this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);this.on("activate",this.refreshDelegate);return this.bodyEl.getUpdateManager();},_handleRefresh:function(A,B,C){if(!C||!this.loaded){var D=this.bodyEl.getUpdateManager();D.update(A,B,this._setLoaded.createDelegate(this));}},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate();}},_setLoaded:function(){this.loaded=true;},closeClick:function(e){var o={};e.stopEvent();this.fireEvent("beforeclose",this,o);if(o.cancel!==true){this.tabPanel.removeTab(this.id);}},closeText:"Close this tab"});Roo.TabPanel.prototype.createStrip=function(A){var B=document.createElement("div");B.className="x-tabs-wrap";A.appendChild(B);return B;};Roo.TabPanel.prototype.createStripList=function(A){A.innerHTML='
'+''+'
';return A.firstChild.firstChild.firstChild.firstChild;};Roo.TabPanel.prototype.createBody=function(A){var B=document.createElement("div");Roo.id(B,"tab-body");Roo.fly(B).addClass("x-tabs-body");A.appendChild(B);return B;};Roo.TabPanel.prototype.createItemBody=function(A,id){var B=Roo.getDom(id);if(!B){B=document.createElement("div");B.id=id;} +Roo.fly(B).addClass("x-tabs-item-body");A.insertBefore(B,A.firstChild);return B;};Roo.TabPanel.prototype.createStripElements=function(A,B,C){var td=document.createElement("td");A.insertBefore(td,A.childNodes[A.childNodes.length-1]);if(C){td.className="x-tabs-closable";if(!this.closeTpl){this.closeTpl=new Roo.Template(''+'{text}'+'
 
');}var el=this.closeTpl.overwrite(td,{"text":B});var D=el.getElementsByTagName("div")[0];var E=el.getElementsByTagName("em")[0];return {"el":el,"close":D,"inner":E};}else {if(!this.tabTpl){this.tabTpl=new Roo.Template(''+'{text}');}var el=this.tabTpl.overwrite(td,{"text":B});var E=el.getElementsByTagName("em")[0];return {"el":el,"inner":E};}}; Roo.Button=function(A,B){if(!B){B=A;A=B.renderTo||false;} Roo.apply(this,B);this.addEvents({"click":true,"toggle":true,'mouseover':true,'mouseout':true,'render':true});if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);} Roo.util.Observable.call(this);if(A){this.render(A);}};Roo.extend(Roo.Button,Roo.util.Observable,{hidden:false,disabled:false,pressed:false,tabIndex:undefined,enableToggle:false,menu:undefined,menuAlign:"tl-bl?",iconCls:undefined,type:'button',menuClassTarget:'tr',clickEvent:'click',handleMouseEvents:true,tooltipType:'qtip',render:function(A){var B;if(this.hideParent){this.parentEl=Roo.get(A);}if(!this.dhconfig){if(!this.template){if(!Roo.Button.buttonTemplate){Roo.Button.buttonTemplate=new Roo.Template('','',"
  
");} @@ -550,7 +551,7 @@ Roo.BorderLayout=function(A,B){B=B||{};Roo.BorderLayout.superclass.constructor.c this.el.repaint();this.fireEvent("layout",this);},safeBox:function(A){A.width=Math.max(0,A.width);A.height=Math.max(0,A.height);return A;},add:function(A,B){A=A.toLowerCase();return this.regions[A].add(B);},remove:function(A,B){A=A.toLowerCase();return this.regions[A].remove(B);},findPanel:function(A){var rs=this.regions;for(var B in rs){if(typeof rs[B]!="function"){var p=rs[B].getPanel(A);if(p){return p;}}}return null;},showPanel:function(A){var rs=this.regions;for(var B in rs){var r=rs[B];if(typeof r!="function"){if(r.hasPanel(A)){return r.showPanel(A);}}}return null;},restoreState:function(A){if(!A){A=Roo.state.Manager;}var sm=new Roo.LayoutStateManager();sm.init(this,A);},batchAdd:function(A){this.beginUpdate();for(var B in A){var lr=this.regions[B];if(lr){this.addTypedPanels(lr,A[B]);}} this.endUpdate();},addTypedPanels:function(lr,ps){if(typeof ps=='string'){lr.add(new Roo.ContentPanel(ps));}else if(ps instanceof Array){for(var i=0,A=ps.length;i0?A:" ");}},setActivePanel:function(A){A=this.getPanel(A);if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);} this.activePanel=A;A.setActiveState(true);if(this.panelSize){A.setSize(this.panelSize.width,this.panelSize.height);}if(this.closeBtn){this.closeBtn.setVisible(!this.config.closeOnTab&&!this.isSlid&&A.isClosable());} @@ -712,10 +713,10 @@ Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,argumen D.push({id:id,target:G,exec:F,test:fn,body:m[1]||''});s=s.replace(m[0],'{xtpl'+id+'}');++id;}for(var i=D.length-1;i>=0;--i){this.compileTpl(D[i]);} this.master=D[D.length-1];this.tpls=D;};Roo.extend(Roo.XTemplate,Roo.Template,{re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,applySubTemplate:function(id,A,B){var t=this.tpls[id];if(t.test&&!t.test.call(this,A,B)){return '';}if(t.exec&&t.exec.call(this,A,B)){return '';}var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;iString(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)});var D=function(m){C.push(m);if(m.modules){m.modules.keySort('ASC',B);m.modules.each(D);}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}};if(this.topModule){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!!!";} Roo.MessageBox.show({title:'loading'});Roo.MessageBox.show({title:"Please wait...",msg:"Building Interface...",width:450,progress:true,closable:false,modal:false});var B=A.length;var C=this;var D=function(){if(!A.length){Roo.debug&&Roo.log('hide?');Roo.MessageBox.hide();if(C.topModule){C.topModule.fireEvent('buildcomplete',C.topModule);}return false;}var m=A.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return D.defer(10,C);}Roo.MessageBox.updateProgress((B-A.length)/B,"Building Interface "+(B-A.length)+" of "+B+(m.name?(' - '+m.name):''));var E=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(E){return D();} m.render();return D.defer(10,C);}