-<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.AccordionLayout"></div>/**\r
- * @class Ext.layout.AccordionLayout\r
- * @extends Ext.layout.FitLayout\r
- * <p>This is a layout that manages multiple Panels in an expandable accordion style such that only\r
- * <b>one Panel can be expanded at any given time</b>. Each Panel has built-in support for expanding and collapsing.</p>\r
- * <p>Note: Only Ext.Panels <b>and all subclasses of Ext.Panel</b> may be used in an accordion layout Container.</p>\r
- * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.Container#layout layout}</b></tt>\r
- * configuration property. See <tt><b>{@link Ext.Container#layout}</b></tt> for additional details.</p>\r
- * <p>Example usage:</p>\r
- * <pre><code>\r
-var accordion = new Ext.Panel({\r
- title: 'Accordion Layout',\r
- layout:'accordion',\r
- defaults: {\r
- // applied to each contained panel\r
- bodyStyle: 'padding:15px'\r
- },\r
- layoutConfig: {\r
- // layout-specific configs go here\r
- titleCollapse: false,\r
- animate: true,\r
- activeOnTop: true\r
- },\r
- items: [{\r
- title: 'Panel 1',\r
- html: '<p>Panel content!</p>'\r
- },{\r
- title: 'Panel 2',\r
- html: '<p>Panel content!</p>'\r
- },{\r
- title: 'Panel 3',\r
- html: '<p>Panel content!</p>'\r
- }]\r
-});\r
-</code></pre>\r
- */\r
-Ext.layout.AccordionLayout = Ext.extend(Ext.layout.FitLayout, {\r
- <div id="cfg-Ext.layout.AccordionLayout-fill"></div>/**\r
- * @cfg {Boolean} fill\r
- * True to adjust the active item's height to fill the available space in the container, false to use the\r
- * item's current height, or auto height if not explicitly set (defaults to true).\r
- */\r
- fill : true,\r
- <div id="cfg-Ext.layout.AccordionLayout-autoWidth"></div>/**\r
- * @cfg {Boolean} autoWidth\r
- * True to set each contained item's width to 'auto', false to use the item's current width (defaults to true).\r
- * Note that some components, in particular the {@link Ext.grid.GridPanel grid}, will not function properly within\r
- * layouts if they have auto width, so in such cases this config should be set to false.\r
- */\r
- autoWidth : true,\r
- <div id="cfg-Ext.layout.AccordionLayout-titleCollapse"></div>/**\r
- * @cfg {Boolean} titleCollapse\r
- * True to allow expand/collapse of each contained panel by clicking anywhere on the title bar, false to allow\r
- * expand/collapse only when the toggle tool button is clicked (defaults to true). When set to false,\r
- * {@link #hideCollapseTool} should be false also.\r
- */\r
- titleCollapse : true,\r
- <div id="cfg-Ext.layout.AccordionLayout-hideCollapseTool"></div>/**\r
- * @cfg {Boolean} hideCollapseTool\r
- * True to hide the contained panels' collapse/expand toggle buttons, false to display them (defaults to false).\r
- * When set to true, {@link #titleCollapse} should be true also.\r
- */\r
- hideCollapseTool : false,\r
- <div id="cfg-Ext.layout.AccordionLayout-collapseFirst"></div>/**\r
- * @cfg {Boolean} collapseFirst\r
- * True to make sure the collapse/expand toggle button always renders first (to the left of) any other tools\r
- * in the contained panels' title bars, false to render it last (defaults to false).\r
- */\r
- collapseFirst : false,\r
- <div id="cfg-Ext.layout.AccordionLayout-animate"></div>/**\r
- * @cfg {Boolean} animate\r
- * True to slide the contained panels open and closed during expand/collapse using animation, false to open and\r
- * close directly with no animation (defaults to false). Note: to defer to the specific config setting of each\r
- * contained panel for this property, set this to undefined at the layout level.\r
- */\r
- animate : false,\r
- <div id="cfg-Ext.layout.AccordionLayout-sequence"></div>/**\r
- * @cfg {Boolean} sequence\r
- * <b>Experimental</b>. If animate is set to true, this will result in each animation running in sequence.\r
- */\r
- sequence : false,\r
- <div id="cfg-Ext.layout.AccordionLayout-activeOnTop"></div>/**\r
- * @cfg {Boolean} activeOnTop\r
- * True to swap the position of each panel as it is expanded so that it becomes the first item in the container,\r
- * false to keep the panels in the rendered order. <b>This is NOT compatible with "animate:true"</b> (defaults to false).\r
- */\r
- activeOnTop : false,\r
-\r
- renderItem : function(c){\r
- if(this.animate === false){\r
- c.animCollapse = false;\r
- }\r
- c.collapsible = true;\r
- if(this.autoWidth){\r
- c.autoWidth = true;\r
- }\r
- if(this.titleCollapse){\r
- c.titleCollapse = true;\r
- }\r
- if(this.hideCollapseTool){\r
- c.hideCollapseTool = true;\r
- }\r
- if(this.collapseFirst !== undefined){\r
- c.collapseFirst = this.collapseFirst;\r
- }\r
- if(!this.activeItem && !c.collapsed){\r
- this.setActiveItem(c, true);\r
- }else if(this.activeItem && this.activeItem != c){\r
- c.collapsed = true;\r
- }\r
- Ext.layout.AccordionLayout.superclass.renderItem.apply(this, arguments);\r
- c.header.addClass('x-accordion-hd');\r
- c.on('beforeexpand', this.beforeExpand, this);\r
- },\r
- \r
- onRemove: function(c){\r
- Ext.layout.AccordionLayout.superclass.onRemove.call(this, c);\r
- if(c.rendered){\r
- c.header.removeClass('x-accordion-hd');\r
- }\r
- c.un('beforeexpand', this.beforeExpand, this);\r
- },\r
-\r
- // private\r
- beforeExpand : function(p, anim){\r
- var ai = this.activeItem;\r
- if(ai){\r
- if(this.sequence){\r
- delete this.activeItem;\r
- if (!ai.collapsed){\r
- ai.collapse({callback:function(){\r
- p.expand(anim || true);\r
- }, scope: this});\r
- return false;\r
- }\r
- }else{\r
- ai.collapse(this.animate);\r
- }\r
- }\r
- this.setActive(p);\r
- if(this.activeOnTop){\r
- p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);\r
- }\r
- this.layout();\r
- },\r
-\r
- // private\r
- setItemSize : function(item, size){\r
- if(this.fill && item){\r
- var hh = 0;\r
- this.container.items.each(function(p){\r
- if(p != item){\r
- hh += p.header.getHeight();\r
- } \r
- });\r
- size.height -= hh;\r
- item.setSize(size);\r
- }\r
- },\r
-\r
- <div id="method-Ext.layout.AccordionLayout-setActiveItem"></div>/**\r
- * Sets the active (expanded) item in the layout.\r
- * @param {String/Number} item The string component id or numeric index of the item to activate\r
- */\r
- setActiveItem : function(item){\r
- this.setActive(item, true);\r
- },\r
- \r
- // private\r
- setActive : function(item, expand){\r
- var ai = this.activeItem;\r
- item = this.container.getComponent(item);\r
- if(ai != item){\r
- if(item.rendered && item.collapsed && expand){\r
- item.expand();\r
- }else{\r
- if(ai){\r
- ai.fireEvent('deactivate', ai);\r
- }\r
- this.activeItem = item;\r
- item.fireEvent('activate', item);\r
- }\r
- }\r
- }\r
-});\r
-Ext.Container.LAYOUTS.accordion = Ext.layout.AccordionLayout;\r
-\r
-//backwards compat\r
-Ext.layout.Accordion = Ext.layout.AccordionLayout;</pre> \r
-</body>\r
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <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.2.0
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+<div id="cls-Ext.layout.AccordionLayout"></div>/**
+ * @class Ext.layout.AccordionLayout
+ * @extends Ext.layout.FitLayout
+ * <p>This is a layout that manages multiple Panels in an expandable accordion style such that only
+ * <b>one Panel can be expanded at any given time</b>. Each Panel has built-in support for expanding and collapsing.</p>
+ * <p>Note: Only Ext.Panels <b>and all subclasses of Ext.Panel</b> may be used in an accordion layout Container.</p>
+ * <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>
+ * <p>Example usage:</p>
+ * <pre><code>
+var accordion = new Ext.Panel({
+ title: 'Accordion Layout',
+ layout:'accordion',
+ defaults: {
+ // applied to each contained panel
+ bodyStyle: 'padding:15px'
+ },
+ layoutConfig: {
+ // layout-specific configs go here
+ titleCollapse: false,
+ animate: true,
+ activeOnTop: true
+ },
+ items: [{
+ title: 'Panel 1',
+ html: '<p>Panel content!</p>'
+ },{
+ title: 'Panel 2',
+ html: '<p>Panel content!</p>'
+ },{
+ title: 'Panel 3',
+ html: '<p>Panel content!</p>'
+ }]
+});
+</code></pre>
+ */
+Ext.layout.AccordionLayout = Ext.extend(Ext.layout.FitLayout, {
+ <div id="cfg-Ext.layout.AccordionLayout-fill"></div>/**
+ * @cfg {Boolean} fill
+ * True to adjust the active item's height to fill the available space in the container, false to use the
+ * item's current height, or auto height if not explicitly set (defaults to true).
+ */
+ fill : true,
+ <div id="cfg-Ext.layout.AccordionLayout-autoWidth"></div>/**
+ * @cfg {Boolean} autoWidth
+ * True to set each contained item's width to 'auto', false to use the item's current width (defaults to true).
+ * Note that some components, in particular the {@link Ext.grid.GridPanel grid}, will not function properly within
+ * layouts if they have auto width, so in such cases this config should be set to false.
+ */
+ autoWidth : true,
+ <div id="cfg-Ext.layout.AccordionLayout-titleCollapse"></div>/**
+ * @cfg {Boolean} titleCollapse
+ * True to allow expand/collapse of each contained panel by clicking anywhere on the title bar, false to allow
+ * expand/collapse only when the toggle tool button is clicked (defaults to true). When set to false,
+ * {@link #hideCollapseTool} should be false also.
+ */
+ titleCollapse : true,
+ <div id="cfg-Ext.layout.AccordionLayout-hideCollapseTool"></div>/**
+ * @cfg {Boolean} hideCollapseTool
+ * True to hide the contained panels' collapse/expand toggle buttons, false to display them (defaults to false).
+ * When set to true, {@link #titleCollapse} should be true also.
+ */
+ hideCollapseTool : false,
+ <div id="cfg-Ext.layout.AccordionLayout-collapseFirst"></div>/**
+ * @cfg {Boolean} collapseFirst
+ * True to make sure the collapse/expand toggle button always renders first (to the left of) any other tools
+ * in the contained panels' title bars, false to render it last (defaults to false).
+ */
+ collapseFirst : false,
+ <div id="cfg-Ext.layout.AccordionLayout-animate"></div>/**
+ * @cfg {Boolean} animate
+ * True to slide the contained panels open and closed during expand/collapse using animation, false to open and
+ * close directly with no animation (defaults to false). Note: to defer to the specific config setting of each
+ * contained panel for this property, set this to undefined at the layout level.
+ */
+ animate : false,
+ <div id="cfg-Ext.layout.AccordionLayout-sequence"></div>/**
+ * @cfg {Boolean} sequence
+ * <b>Experimental</b>. If animate is set to true, this will result in each animation running in sequence.
+ */
+ sequence : false,
+ <div id="cfg-Ext.layout.AccordionLayout-activeOnTop"></div>/**
+ * @cfg {Boolean} activeOnTop
+ * True to swap the position of each panel as it is expanded so that it becomes the first item in the container,
+ * false to keep the panels in the rendered order. <b>This is NOT compatible with "animate:true"</b> (defaults to false).
+ */
+ activeOnTop : false,
+
+ type: 'accordion',
+
+ renderItem : function(c){
+ if(this.animate === false){
+ c.animCollapse = false;
+ }
+ c.collapsible = true;
+ if(this.autoWidth){
+ c.autoWidth = true;
+ }
+ if(this.titleCollapse){
+ c.titleCollapse = true;
+ }
+ if(this.hideCollapseTool){
+ c.hideCollapseTool = true;
+ }
+ if(this.collapseFirst !== undefined){
+ c.collapseFirst = this.collapseFirst;
+ }
+ if(!this.activeItem && !c.collapsed){
+ this.setActiveItem(c, true);
+ }else if(this.activeItem && this.activeItem != c){
+ c.collapsed = true;
+ }
+ Ext.layout.AccordionLayout.superclass.renderItem.apply(this, arguments);
+ c.header.addClass('x-accordion-hd');
+ c.on('beforeexpand', this.beforeExpand, this);
+ },
+
+ onRemove: function(c){
+ Ext.layout.AccordionLayout.superclass.onRemove.call(this, c);
+ if(c.rendered){
+ c.header.removeClass('x-accordion-hd');
+ }
+ c.un('beforeexpand', this.beforeExpand, this);
+ },
+
+ // private
+ beforeExpand : function(p, anim){
+ var ai = this.activeItem;
+ if(ai){
+ if(this.sequence){
+ delete this.activeItem;
+ if (!ai.collapsed){
+ ai.collapse({callback:function(){
+ p.expand(anim || true);
+ }, scope: this});
+ return false;
+ }
+ }else{
+ ai.collapse(this.animate);
+ }
+ }
+ this.setActive(p);
+ if(this.activeOnTop){
+ p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);
+ }
+ // Items have been hidden an possibly rearranged, we need to get the container size again.
+ this.layout();
+ },
+
+ // private
+ setItemSize : function(item, size){
+ if(this.fill && item){
+ var hh = 0, i, ct = this.getRenderedItems(this.container), len = ct.length, p;
+ // Add up all the header heights
+ for (i = 0; i < len; i++) {
+ if((p = ct[i]) != item){
+ hh += p.header.getHeight();
+ }
+ };
+ // Subtract the header heights from the container size
+ size.height -= hh;
+ // Call setSize on the container to set the correct height. For Panels, deferedHeight
+ // will simply store this size for when the expansion is done.
+ item.setSize(size);
+ }
+ },
+
+ <div id="method-Ext.layout.AccordionLayout-setActiveItem"></div>/**
+ * Sets the active (expanded) item in the layout.
+ * @param {String/Number} item The string component id or numeric index of the item to activate
+ */
+ setActiveItem : function(item){
+ this.setActive(item, true);
+ },
+
+ // private
+ setActive : function(item, expand){
+ var ai = this.activeItem;
+ item = this.container.getComponent(item);
+ if(ai != item){
+ if(item.rendered && item.collapsed && expand){
+ item.expand();
+ }else{
+ if(ai){
+ ai.fireEvent('deactivate', ai);
+ }
+ this.activeItem = item;
+ item.fireEvent('activate', item);
+ }
+ }
+ }
+});
+Ext.Container.LAYOUTS.accordion = Ext.layout.AccordionLayout;
+
+//backwards compat
+Ext.layout.Accordion = Ext.layout.AccordionLayout;</pre>
+</body>
</html>
\ No newline at end of file