~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/ecosystem/extjs/source/widgets/layout/FitLayout.js

  • Committer: parra
  • Date: 2010-03-15 02:39:02 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1433
merged gelee at svn

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Ext JS Library 3.0 RC2
 
3
 * Copyright(c) 2006-2009, Ext JS, LLC.
 
4
 * licensing@extjs.com
 
5
 * 
 
6
 * http://extjs.com/license
 
7
 */
 
8
 
 
9
/**
 
10
 * @class Ext.layout.FitLayout
 
11
 * @extends Ext.layout.ContainerLayout
 
12
 * <p>This is a base class for layouts that contain <b>a single item</b> that automatically expands to fill the layout's
 
13
 * container.  This class is intended to be extended or created via the <tt>layout:'fit'</tt> {@link Ext.Container#layout}
 
14
 * config, and should generally not need to be created directly via the new keyword.</p>
 
15
 * <p>FitLayout does not have any direct config options (other than inherited ones).  To fit a panel to a container
 
16
 * using FitLayout, simply set layout:'fit' on the container and add a single panel to it.  If the container has
 
17
 * multiple panels, only the first one will be displayed.  Example usage:</p>
 
18
 * <pre><code>
 
19
var p = new Ext.Panel({
 
20
    title: 'Fit Layout',
 
21
    layout:'fit',
 
22
    items: {
 
23
        title: 'Inner Panel',
 
24
        html: '&lt;p&gt;This is the inner panel content&lt;/p&gt;',
 
25
        border: false
 
26
    }
 
27
});
 
28
</code></pre>
 
29
 */
 
30
Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
 
31
    // private
 
32
    monitorResize:true,
 
33
 
 
34
    // private
 
35
    onLayout : function(ct, target){
 
36
        Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);
 
37
        if(!this.container.collapsed){
 
38
            var sz = (Ext.isIE6 && Ext.isStrict && target.dom == document.body) ? target.getViewSize() : target.getStyleSize();
 
39
            this.setItemSize(this.activeItem || ct.items.itemAt(0), sz);
 
40
        }
 
41
    },
 
42
 
 
43
    // private
 
44
    setItemSize : function(item, size){
 
45
        if(item && size.height > 0){ // display none?
 
46
            item.setSize(size);
 
47
        }
 
48
    }
 
49
});
 
50
Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;
 
 
b'\\ No newline at end of file'