Ext.define('Ext.overrides.Widget', {
override: 'Ext.Widget',
uses: [
'Ext.Component',
'Ext.layout.component.Auto'
],
$configStrict: false,
isComponent: true,
liquidLayout: true,
rendered: true,
rendering: true,
config: {
renderTo: null
},
constructor: function(config) {
var me = this,
renderTo;
me.callParent([config]);
me.getComponentLayout();
renderTo = me.getRenderTo();
if (renderTo) {
me.render(renderTo);
}
},
addClsWithUI: function(cls) {
this.el.addCls(cls);
},
afterComponentLayout: Ext.emptyFn,
updateLayout: function() {
var owner = this.getRefOwner();
if (owner) {
owner.updateLayout();
}
},
destroy: function() {
var me = this,
ownerCt = me.ownerCt;
if (ownerCt && ownerCt.remove) {
ownerCt.remove(me, false);
}
me.callParent();
},
finishRender: function () {
this.rendering = false;
this.initBindable();
this.initKeyMap();
},
getAnimationProps: function() {
return {};
},
getComponentLayout: function() {
var me = this,
layout = me.componentLayout;
if (!layout) {
layout = me.componentLayout = new Ext.layout.component.Auto();
layout.setOwner(me);
}
return layout;
},
getEl: function() {
return this.element;
},
getTdCls: function() {
return Ext.baseCSSPrefix + this.getTdType() + '-' + (this.ui || 'default') + '-cell';
},
getTdType: function() {
return this.xtype;
},
getItemId: function() {
return this.itemId || this.id;
},
getSizeModel: function() {
return Ext.Component.prototype.getSizeModel.apply(this, arguments);
},
onAdded: function (container, pos, instanced) {
var me = this;
me.ownerCt = container;
me.onInheritedAdd(me, instanced);
me.isDetached = false;
},
onRemoved: function(destroying) {
this.onInheritedRemove(destroying);
this.ownerCt = this.ownerLayout = null;
},
parseBox: function(box) {
return Ext.Element.parseBox(box);
},
removeClsWithUI: function(cls) {
this.el.removeCls(cls);
},
render: function(container, position) {
var me = this,
element = me.element,
proto = Ext.Component.prototype,
nextSibling;
if (!me.ownerCt || me.floating) {
if (Ext.scopeCss) {
element.addCls(proto.rootCls);
}
element.addCls(proto.borderBoxCls);
}
if (position) {
nextSibling = container.childNodes[position];
if (nextSibling) {
Ext.fly(container).insertBefore(element, nextSibling);
return;
}
}
Ext.fly(container).appendChild(element);
me.finishRender();
},
setPosition: function(x, y) {
this.el.setLocalXY(x, y);
},
up: function() {
return Ext.Component.prototype.up.apply(this, arguments);
},
isAncestor: function() {
return Ext.Component.prototype.isAncestor.apply(this, arguments);
},
onFocusEnter: function() {
return Ext.Component.prototype.onFocusEnter.apply(this, arguments);
},
onFocusLeave: function() {
return Ext.Component.prototype.onFocusLeave.apply(this, arguments);
},
isLayoutChild: function(candidate) {
var ownerCt = this.ownerCt;
return ownerCt ? (ownerCt === candidate || ownerCt.isLayoutChild(candidate)) : false;
},
privates: {
doAddListener: function(name, fn, scope, options, order, caller, manager) {
if (name == 'painted' || name == 'resize') {
this.element.doAddListener(name, fn, scope || this, options, order);
}
this.callParent([name, fn, scope, options, order, caller, manager]);
},
doRemoveListener: function(name, fn, scope) {
if (name == 'painted' || name == 'resize') {
this.element.doRemoveListener(name, fn, scope);
}
this.callParent([name, fn, scope]);
}
}
}, function(Cls) {
var prototype = Cls.prototype;
if (Ext.isIE9m) {
prototype.addElementReferenceOnDemand = prototype.addElementReference;
}
});