4 Ext
.define('Ext.overrides.Widget', {
5 override
: 'Ext.Widget',
7 uses
: ['Ext.Component'],
15 // in Ext JS the rendered flag is set as soon as a component has its element. Since
16 // widgets always have an element when constructed, they are always considered to be
27 baseCls
: Ext
.baseCSSPrefix
+ 'widget'
30 constructor: function(config
) {
34 me
.callParent([config
]);
36 // initialize the component layout
37 me
.getComponentLayout();
38 renderTo
= me
.getRenderTo();
44 addClsWithUI: function(cls
) {
48 afterComponentLayout
: Ext
.emptyFn
,
50 updateLayout: function() {
51 var owner
= this.getRefOwner();
61 if (ownerCt
&& ownerCt
.remove
) {
62 ownerCt
.remove(me
, false);
68 finishRender: function () {
69 this.rendering
= false;
73 getAnimationProps: function() {
74 // see Ext.util.Animate mixin
78 getComponentLayout: function() {
80 layout
= me
.componentLayout
;
83 layout
= me
.componentLayout
= new Ext
.layout
.component
.Auto();
96 * Needed for when widget is rendered into a grid cell. The class to add to the cell element.
99 getTdCls: function() {
100 return Ext
.baseCSSPrefix
+ this.getTdType() + '-' + (this.ui
|| 'default') + '-cell';
105 * Partner method to {@link #getTdCls}.
107 * Returns the base type for the component. Defaults to return `this.xtype`, but
108 * All derived classes of {@link Ext.form.field.Text TextField} can return the type 'textfield',
109 * and all derived classes of {@link Ext.button.Button Button} can return the type 'button'
112 getTdType: function() {
116 getItemId: function() {
117 // needed by ComponentQuery
118 return this.itemId
|| this.id
;
121 getSizeModel: function() {
122 return Ext
.Component
.prototype.getSizeModel
.apply(this, arguments
);
125 onAdded: function (container
, pos
, instanced
) {
127 inheritedState
= me
.inheritedState
;
129 me
.ownerCt
= container
;
131 me
.onInheritedAdd(me
, instanced
);
134 onRemoved: function(destroying
) {
141 me
.onInheritedRemove(destroying
);
143 me
.ownerCt
= me
.ownerLayout
= null;
146 parseBox: function(box
) {
147 return Ext
.Element
.parseBox(box
);
150 removeClsWithUI: function(cls
) {
151 this.el
.removeCls(cls
);
154 render: function(container
, position
) {
156 element
= me
.element
,
157 proto
= Ext
.Component
.prototype,
160 if (!me
.ownerCt
|| me
.floating
) {
162 element
.addCls(proto
.rootCls
);
164 element
.addCls(proto
.borderBoxCls
);
168 nextSibling
= container
.childNodes
[position
];
170 Ext
.fly(container
).insertBefore(element
, nextSibling
);
175 Ext
.fly(container
).appendChild(element
);
178 setPosition: function(x
, y
) {
179 this.el
.setLocalXY(x
, y
);
183 return Ext
.Component
.prototype.up
.apply(this, arguments
);
186 isAncestor: function() {
187 return Ext
.Component
.prototype.isAncestor
.apply(this, arguments
);
190 onFocusEnter: function() {
191 return Ext
.Component
.prototype.onFocusEnter
.apply(this, arguments
);
194 onFocusLeave: function() {
195 return Ext
.Component
.prototype.onFocusLeave
.apply(this, arguments
);
198 isLayoutChild: function(candidate
) {
199 var ownerCt
= this.ownerCt
;
200 return ownerCt
? (ownerCt
=== candidate
|| ownerCt
.isLayoutChild(candidate
)) : false;
204 var prototype = Cls
.prototype;
207 // Since IE8/9 don't not support Object.defineProperty correctly we can't add the reference
208 // nodes on demand, so we just fall back to adding all references up front.
209 prototype.addElementReferenceOnDemand
= prototype.addElementReference
;