X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..10a866c12701c0a0afd0ac85dcdcf32a421514ac:/docs/source/ContainerLayout.html?ds=inline diff --git a/docs/source/ContainerLayout.html b/docs/source/ContainerLayout.html index 04cfdc35..270cac57 100644 --- a/docs/source/ContainerLayout.html +++ b/docs/source/ContainerLayout.html @@ -1,17 +1,12 @@ - - - The source code - - - - -
/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-
/** + + + + The source code + + + + +
/** * @class Ext.layout.ContainerLayout *

The ContainerLayout class is the default layout manager delegated by {@link Ext.Container} to * render any child Components when no {@link Ext.Container#layout layout} is configured into @@ -22,11 +17,7 @@ *

This class is intended to be extended or created via the {@link Ext.Container#layout layout} * configuration property. See {@link Ext.Container#layout} for additional details.

*/ -Ext.layout.ContainerLayout = function(config){ - Ext.apply(this, config); -}; - -Ext.layout.ContainerLayout.prototype = { +Ext.layout.ContainerLayout = Ext.extend(Object, {
/** * @cfg {String} extraCls *

An optional extra CSS class that will be added to the container. This can be useful for adding @@ -66,11 +57,19 @@ Ext.layout.ContainerLayout.prototype = { // private activeItem : null, + constructor : function(config){ + Ext.apply(this, config); + }, + // private layout : function(){ var target = this.container.getLayoutTarget(); + if(!(this.hasLayout || Ext.isEmpty(this.targetCls))){ + target.addClass(this.targetCls) + } this.onLayout(this.container, target); this.container.fireEvent('afterlayout', this.container, this); + this.hasLayout = true; }, // private @@ -80,7 +79,7 @@ Ext.layout.ContainerLayout.prototype = { // private isValidParent : function(c, target){ - return target && c.getDomPositionEl().dom.parentNode == (target.dom || target); + return target && c.getPositionEl().dom.parentNode == (target.dom || target); }, // private @@ -103,26 +102,27 @@ Ext.layout.ContainerLayout.prototype = { if(Ext.isNumber(position)){ position = target.dom.childNodes[position]; } - target.dom.insertBefore(c.getDomPositionEl().dom, position || null); + target.dom.insertBefore(c.getPositionEl().dom, position || null); c.container = target; this.configureItem(c, position); } }, - + // private configureItem: function(c, position){ if(this.extraCls){ var t = c.getPositionEl ? c.getPositionEl() : c; t.addClass(this.extraCls); } - if (this.renderHidden && c != this.activeItem) { - c.hide(); - } + // If we are forcing a layout, do so *before* we hide so elements have height/width if(c.doLayout && this.forceLayout){ c.doLayout(false, true); } + if (this.renderHidden && c != this.activeItem) { + c.hide(); + } }, - + onRemove: function(c){ if(this.activeItem == c){ delete this.activeItem; @@ -136,14 +136,19 @@ Ext.layout.ContainerLayout.prototype = { // private onResize: function(){ var ct = this.container, - b; - - if(ct.collapsed){ + b = ct.bufferResize; + + if (ct.collapsed){ return; } - if(b = ct.bufferResize){ - // Only allow if we should buffer the layout - if(ct.shouldBufferLayout()){ + + // Not having an ownerCt negates the buffering: floating and top level + // Containers (Viewport, Window, ToolTip, Menu) need to lay out ASAP. + if (b && ct.ownerCt) { + // If we do NOT already have a layout pending from an ancestor, schedule one. + // If there is a layout pending, we do nothing here. + // buffering to be deprecated soon + if (!ct.hasLayoutPending()){ if(!this.resizeTask){ this.resizeTask = new Ext.util.DelayedTask(this.runLayout, this); this.resizeBuffer = Ext.isNumber(b) ? b : 50; @@ -152,10 +157,10 @@ Ext.layout.ContainerLayout.prototype = { this.resizeTask.delay(this.resizeBuffer); } }else{ - ct.doLayout(); + ct.doLayout(false, this.forceLayout); } }, - + // private runLayout: function(){ var ct = this.container; @@ -165,6 +170,8 @@ Ext.layout.ContainerLayout.prototype = { // private setContainer : function(ct){ + // No longer use events to handle resize. Instead this will be handled through a direct function call. + /* if(this.monitorResize && ct != this.container){ var old = this.container; if(old){ @@ -174,6 +181,7 @@ Ext.layout.ContainerLayout.prototype = { ct.on(ct.resizeEvent, this.onResize, this); } } + */ this.container = ct; }, @@ -224,14 +232,22 @@ Ext.layout.ContainerLayout.prototype = { t.disableFormats = true; return t.compile(); })(), - + /* * Destroys this layout. This is a template method that is empty by default, but should be implemented * by subclasses that require explicit destruction to purge event handlers or remove DOM nodes. * @protected */ - destroy : Ext.emptyFn -}; -Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout;

- + destroy : function(){ + if(!Ext.isEmpty(this.targetCls)){ + var target = this.container.getLayoutTarget(); + if(target){ + target.removeClass(this.targetCls); + } + } + } +}); +Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout; +
+ \ No newline at end of file