X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FBorderLayout.js;h=aeda210f7c200362e509c851de83886ab41bfa94;hb=61bc45258e16a779856dd2ad0862630b489e4583;hp=c0f97fe42b08497e18ad4440c94514bb6a3db78c;hpb=2ee93766a3358b38f35eb2cd99e5b32ba3447e5e;p=roojs1 diff --git a/Roo/BorderLayout.js b/Roo/BorderLayout.js index c0f97fe42b..aeda210f7c 100644 --- a/Roo/BorderLayout.js +++ b/Roo/BorderLayout.js @@ -122,7 +122,9 @@ Roo.extend(Roo.BorderLayout, Roo.LayoutManager, { * Performs a layout update. */ layout : function(){ - if(this.updating) return; + if(this.updating) { + return; + } var size = this.getViewSize(); var w = size.width; var h = size.height; @@ -399,6 +401,7 @@ layout.addxtype({ { case 'ContentPanel': // ContentPanel (el, cfg) case 'ScrollPanel': // ContentPanel (el, cfg) + case 'ViewPanel': if(cfg.autoCreate) { ret = new Roo[cfg.xtype](cfg); // new panel!!!!! } else { @@ -464,41 +467,55 @@ layout.addxtype({ } break; - + + + + + default: + if (typeof(Roo[cfg.xtype]) != 'undefined') { + + ret = new Roo[cfg.xtype](cfg); // new panel!!!!! + this.add(region, ret); + } else { + + alert("Can not add '" + cfg.xtype + "' to BorderLayout"); + return null; + } - default: - alert("Can not add '" + cfg.xtype + "' to BorderLayout"); - return null; // GridPanel (grid, cfg) } this.beginUpdate(); // add children.. var region = ''; + var abn = {}; Roo.each(xitems, function(i) { - region = nb && i.region && !i.background ? i.region : false; + region = nb && i.region ? i.region : false; var add = ret.addxtype(i); if (region) { - nb[region] = add; + nb[region] = nb[region] == undefined ? 0 : nb[region]+1; + if (!i.background) { + abn[region] = nb[region] ; + } } }); this.endUpdate(); // make the last non-background panel active.. - //if (nb) { Roo.log(nb); } + //if (nb) { Roo.log(abn); } if (nb) { - for(var r in nb) { + for(var r in abn) { region = this.getRegion(r); if (region) { // tried using nb[r], but it does not work.. - if(region.panels.getCount() > 1 ) { - region.showPanel(nb[r]); - } + + region.showPanel(abn[r]); + } } }