3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
15 Ext.Loader.setConfig({enabled: true});
17 Ext.Loader.setPath('Ext.ux', '../ux');
20 'Ext.tip.QuickTipManager',
21 'Ext.container.Viewport',
30 'Ext.ux.layout.Center'
34 // This is the main layout definition.
36 Ext.onReady(function(){
38 Ext.tip.QuickTipManager.init();
40 // This is an inner body element within the Details panel created to provide a "slide in" effect
41 // on the panel body without affecting the body's box itself. This element is created on
42 // initial use and cached in this var for subsequent access.
45 // Gets all layouts examples
46 var layoutExamples = [];
47 Ext.Object.each(getBasicLayouts(), function(name, example) {
48 layoutExamples.push(example);
51 Ext.Object.each(getCombinationLayouts(), function(name, example){
52 layoutExamples.push(example);
55 Ext.Object.each(getCustomLayouts(), function(name, example){
56 layoutExamples.push(example);
59 // This is the main content center region that will contain each example layout panel.
60 // It will be implemented as a CardLayout since it will contain multiple panels with
61 // only one being visible at any given time.
65 region: 'center', // this is what makes this panel into a region within the containing layout
73 var store = Ext.create('Ext.data.TreeStore', {
83 // Go ahead and create the TreePanel now so that we can use it below
84 var treePanel = Ext.create('Ext.tree.Panel', {
86 title: 'Sample Layouts',
96 // Assign the changeLayout function to be called on tree node click.
97 treePanel.getSelectionModel().on('select', function(selModel, record) {
98 if (record.get('leaf')) {
99 Ext.getCmp('content-panel').layout.setActiveItem(record.getId() + '-panel');
101 var bd = Ext.getCmp('details-panel').body;
102 bd.update('').setStyle('background','#fff');
103 detailEl = bd.createChild(); //create default empty div
105 detailEl.hide().update(Ext.getDom(record.getId() + '-details').innerHTML).slideIn('l', {stopAnimation:true,duration: 200});
109 // This is the Details panel that contains the description for each example layout.
114 bodyStyle: 'padding-bottom:15px;background:#eee;',
116 html: '<p class="details-info">When you select a layout from the tree, additional details will display here.</p>'
119 // Finally, build the main layout once all the pieces are ready. This is also a good
120 // example of putting together a full-screen BorderLayout within a Viewport.
121 Ext.create('Ext.Viewport', {
123 title: 'Ext Layout Browser',
128 html: '<h1> Ext.Layout.Browser</h1>',
132 id: 'layout-browser',
140 items: [treePanel, detailsPanel]
144 renderTo: Ext.getBody()