-<html>
-<head>
- <title>The source code</title>
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
-</head>
-<body onload="prettyPrint();">
- <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-<div id="cls-Ext.layout.ContainerLayout"></div>/**
+<html>\r
+<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
+ <title>The source code</title>\r
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body onload="prettyPrint();">\r
+ <pre class="prettyprint lang-js"><div id="cls-Ext.layout.ContainerLayout"></div>/**
* @class Ext.layout.ContainerLayout
* <p>The ContainerLayout class is the default layout manager delegated by {@link Ext.Container} to
* render any child Components when no <tt>{@link Ext.Container#layout layout}</tt> is configured into
* <p>This class is intended to be extended or created via the <tt><b>{@link Ext.Container#layout layout}</b></tt>
* configuration property. See <tt><b>{@link Ext.Container#layout}</b></tt> for additional details.</p>
*/
-Ext.layout.ContainerLayout = function(config){
- Ext.apply(this, config);
-};
-
-Ext.layout.ContainerLayout.prototype = {
+Ext.layout.ContainerLayout = Ext.extend(Object, {
<div id="cfg-Ext.layout.ContainerLayout-extraCls"></div>/**
* @cfg {String} extraCls
* <p>An optional extra CSS class that will be added to the container. This can be useful for adding
// 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
// private
isValidParent : function(c, target){
- return target && c.getDomPositionEl().dom.parentNode == (target.dom || target);
+ return target && c.getPositionEl().dom.parentNode == (target.dom || target);
},
// private
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;
// 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;
this.resizeTask.delay(this.resizeBuffer);
}
}else{
- ct.doLayout();
+ ct.doLayout(false, this.forceLayout);
}
},
-
+
// private
runLayout: function(){
var ct = this.container;
// 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){
ct.on(ct.resizeEvent, this.onResize, this);
}
}
+ */
this.container = ct;
},
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;</pre>
-</body>
+ 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;
+</pre> \r
+</body>\r
</html>
\ No newline at end of file