~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/web/extjs/source/widgets/layout/AbsoluteLayout.js

  • Committer: parra
  • Date: 2010-03-15 15:56:56 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1448
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.AbsoluteLayout
 
11
 * @extends Ext.layout.AnchorLayout
 
12
 * <p>This is a layout that inherits the anchoring of <b>{@link Ext.layout.AnchorLayout}</b> and adds the
 
13
 * ability for x/y positioning using the standard x and y component config options.</p>
 
14
 * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.Container#layout layout}</b></tt>
 
15
 * configuration property.  See <tt><b>{@link Ext.Container#layout}</b></tt> for additional details.</p>
 
16
 * <p>Example usage:</p>
 
17
 * <pre><code>
 
18
var form = new Ext.form.FormPanel({
 
19
    title: 'Absolute Layout',
 
20
    layout:'absolute',
 
21
    layoutConfig: {
 
22
        // layout-specific configs go here
 
23
        extraCls: 'x-abs-layout-item',
 
24
    },
 
25
    baseCls: 'x-plain',
 
26
    url:'save-form.php',
 
27
    defaultType: 'textfield',
 
28
    items: [{
 
29
        x: 0,
 
30
        y: 5,
 
31
        xtype:'label',
 
32
        text: 'Send To:'
 
33
    },{
 
34
        x: 60,
 
35
        y: 0,
 
36
        name: 'to',
 
37
        anchor:'100%'  // anchor width by percentage
 
38
    },{
 
39
        x: 0,
 
40
        y: 35,
 
41
        xtype:'label',
 
42
        text: 'Subject:'
 
43
    },{
 
44
        x: 60,
 
45
        y: 30,
 
46
        name: 'subject',
 
47
        anchor: '100%'  // anchor width by percentage
 
48
    },{
 
49
        x:0,
 
50
        y: 60,
 
51
        xtype: 'textarea',
 
52
        name: 'msg',
 
53
        anchor: '100% 100%'  // anchor width and height
 
54
    }]
 
55
});
 
56
</code></pre>
 
57
 */
 
58
Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {
 
59
 
 
60
    extraCls: 'x-abs-layout-item',
 
61
 
 
62
    onLayout : function(ct, target){
 
63
        target.position();
 
64
        this.paddingLeft = target.getPadding('l');
 
65
        this.paddingTop = target.getPadding('t');
 
66
 
 
67
        Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);
 
68
    },
 
69
 
 
70
    // private
 
71
    adjustWidthAnchor : function(value, comp){
 
72
        return value ? value - comp.getPosition(true)[0] + this.paddingLeft : value;
 
73
    },
 
74
 
 
75
    // private
 
76
    adjustHeightAnchor : function(value, comp){
 
77
        return  value ? value - comp.getPosition(true)[1] + this.paddingTop : value;
 
78
    }
 
79
    /**
 
80
     * @property activeItem
 
81
     * @hide
 
82
     */
 
83
});
 
84
Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;