+++ /dev/null
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-/**\r
- * @class Ext.layout.ContainerLayout\r
- * <p>Every {@link Ext.Container Container} delegates the rendering of its child {@link Ext.Component Component}s\r
- * to a layout manager class which must be {@link Ext.Container#layout configured} into the Container.</p> Some\r
- * layouts also provide sizing and positioning of child Components/\r
- *\r
- * <p>The ContainerLayout class is the default layout manager used when no layout is configured into a Container.\r
- * It provides the basic foundation for all other layout classes in Ext. It simply renders all child Components\r
- * into the Container, performing no sizing os positioning services. This class is intended to be extended and should\r
- * generally not need to be created directly via the new keyword.\r
- */\r
-Ext.layout.ContainerLayout = function(config){\r
- Ext.apply(this, config);\r
-};\r
-\r
-Ext.layout.ContainerLayout.prototype = {\r
- /**\r
- * @cfg {String} extraCls\r
- * An optional extra CSS class that will be added to the container (defaults to ''). This can be useful for\r
- * adding customized styles to the container or any of its children using standard CSS rules.\r
- */\r
- /**\r
- * @cfg {Boolean} renderHidden\r
- * True to hide each contained item on render (defaults to false).\r
- */\r
-\r
- /**\r
- * A reference to the {@link Ext.Component} that is active. For example,\r
- * if(myPanel.layout.activeItem.id == 'item-1') { ... }. activeItem only applies to layout styles that can\r
- * display items one at a time (like {@link Ext.layout.Accordion}, {@link Ext.layout.CardLayout}\r
- * and {@link Ext.layout.FitLayout}). Read-only. Related to {@link Ext.Container#activeItem}.\r
- * @type {Ext.Component}\r
- * @property activeItem\r
- */\r
-\r
- // private\r
- monitorResize:false,\r
- // private\r
- activeItem : null,\r
-\r
- // private\r
- layout : function(){\r
- var target = this.container.getLayoutTarget();\r
- this.onLayout(this.container, target);\r
- this.container.fireEvent('afterlayout', this.container, this);\r
- },\r
-\r
- // private\r
- onLayout : function(ct, target){\r
- this.renderAll(ct, target);\r
- },\r
-\r
- // private\r
- isValidParent : function(c, target){\r
- var el = c.getPositionEl ? c.getPositionEl() : c.getEl();\r
- return el.dom.parentNode == target.dom;\r
- },\r
-\r
- // private\r
- renderAll : function(ct, target){\r
- var items = ct.items.items;\r
- for(var i = 0, len = items.length; i < len; i++) {\r
- var c = items[i];\r
- if(c && (!c.rendered || !this.isValidParent(c, target))){\r
- this.renderItem(c, i, target);\r
- }\r
- }\r
- },\r
-\r
- // private\r
- renderItem : function(c, position, target){\r
- if(c && !c.rendered){\r
- c.render(target, position);\r
- if(this.extraCls){\r
- var t = c.getPositionEl ? c.getPositionEl() : c;\r
- t.addClass(this.extraCls);\r
- }\r
- if (this.renderHidden && c != this.activeItem) {\r
- c.hide();\r
- }\r
- }else if(c && !this.isValidParent(c, target)){\r
- if(this.extraCls){\r
- var t = c.getPositionEl ? c.getPositionEl() : c;\r
- t.addClass(this.extraCls);\r
- }\r
- if(typeof position == 'number'){\r
- position = target.dom.childNodes[position];\r
- }\r
- target.dom.insertBefore(c.getEl().dom, position || null);\r
- if (this.renderHidden && c != this.activeItem) {\r
- c.hide();\r
- }\r
- }\r
- },\r
-\r
- // private\r
- onResize: function(){\r
- if(this.container.collapsed){\r
- return;\r
- }\r
- var b = this.container.bufferResize;\r
- if(b){\r
- if(!this.resizeTask){\r
- this.resizeTask = new Ext.util.DelayedTask(this.layout, this);\r
- this.resizeBuffer = typeof b == 'number' ? b : 100;\r
- }\r
- this.resizeTask.delay(this.resizeBuffer);\r
- }else{\r
- this.layout();\r
- }\r
- },\r
-\r
- // private\r
- setContainer : function(ct){\r
- if(this.monitorResize && ct != this.container){\r
- if(this.container){\r
- this.container.un('resize', this.onResize, this);\r
- }\r
- if(ct){\r
- ct.on('resize', this.onResize, this);\r
- }\r
- }\r
- this.container = ct;\r
- },\r
-\r
- // private\r
- parseMargins : function(v){\r
- var ms = v.split(' ');\r
- var len = ms.length;\r
- if(len == 1){\r
- ms[1] = ms[0];\r
- ms[2] = ms[0];\r
- ms[3] = ms[0];\r
- }\r
- if(len == 2){\r
- ms[2] = ms[0];\r
- ms[3] = ms[1];\r
- }\r
- return {\r
- top:parseInt(ms[0], 10) || 0,\r
- right:parseInt(ms[1], 10) || 0,\r
- bottom:parseInt(ms[2], 10) || 0,\r
- left:parseInt(ms[3], 10) || 0\r
- };\r
- },\r
-\r
- /*\r
- * Destroys this layout. This is a template method that is empty by default, but should be implemented\r
- * by subclasses that require explicit destruction to purge event handlers or remove DOM nodes.\r
- * @protected\r
- */\r
- destroy : Ext.emptyFn\r
-};\r
-Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout;
\ No newline at end of file