X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FBorderLayout.js;h=8228cedb34bef6696992b7287b641e08e059d2c5;hb=refs%2Fheads%2Fwip_leon_T7094_logo_image_upload_in_boilerplate;hp=8fede2485bba2e1d0a0f2b5a88ef790aaa15dbfc;hpb=92fd2523491ad56716704de310a9a6f6dbc2949a;p=roojs1
diff --git a/Roo/BorderLayout.js b/Roo/BorderLayout.js
index 8fede2485b..8228cedb34 100644
--- a/Roo/BorderLayout.js
+++ b/Roo/BorderLayout.js
@@ -11,6 +11,7 @@
/**
* @class Roo.BorderLayout
* @extends Roo.LayoutManager
+ * @children Roo.ContentPanel
* This class represents a common layout manager used in desktop applications. For screenshots and more details,
* please see:
* Cross Browser Layouts - Part 1
@@ -92,6 +93,22 @@ Roo.BorderLayout = function(container, config){
};
Roo.extend(Roo.BorderLayout, Roo.LayoutManager, {
+
+ /**
+ * @cfg {Roo.LayoutRegion} east
+ */
+ /**
+ * @cfg {Roo.LayoutRegion} west
+ */
+ /**
+ * @cfg {Roo.LayoutRegion} north
+ */
+ /**
+ * @cfg {Roo.LayoutRegion} south
+ */
+ /**
+ * @cfg {Roo.LayoutRegion} center
+ */
/**
* Creates and adds a new region if it doesn't already exist.
* @param {String} target The target region key (north, south, east, west or center).
@@ -122,7 +139,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 +418,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,37 +484,55 @@ layout.addxtype({
}
break;
-
+
+
- default:
- alert("Can not add '" + cfg.xtype + "' to BorderLayout");
- return null;
+
+ 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;
+ }
+
// 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) {
- region.setActivePanel(nb[r]);
+ // tried using nb[r], but it does not work..
+
+ region.showPanel(abn[r]);
+
}
}
}