Last active
January 16, 2021 03:45
-
-
Save pyriand3r/be5f91ee2de560a62a82 to your computer and use it in GitHub Desktop.
Container to integrate an Ext4/Ext5 Container into an Ext3.4 environment with use of the Ext4/Ext5 sandbox mode. This Class uses a Ext.Panel to host the Ext4-Container.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @class pyriand3r.util.Ext5Container | |
* This class provides a panel for an Ext5 application inside an Ext3.4 environment. | |
* | |
* @extends Ext.Panel | |
*/ | |
pyriand3r.util.Ext5Container = Ext.extend(Ext.Panel, { | |
/** | |
* @constructor | |
* Initiate panel with Ext5 container. | |
*/ | |
initComponent: function () { | |
var me = this; | |
this.components = {}; | |
Ext.applyIf(this, { | |
containerConfig: {} | |
}); | |
Ext.applyIf(this.containerConfig, { | |
layout: { | |
type: 'fit', | |
align: 'stretch' | |
} | |
}); | |
Ext.apply(this.containerConfig, { | |
renderTo: this.getContainerId() | |
}); | |
Ext.apply(this, { | |
html: '<div style="width: 100%; height: 100%;" id="' + me.getContainerId() + '"></div>', | |
items: {} | |
}); | |
pyriand3r.util.Ext5Container.superclass.initComponent.call(this); | |
this.addListener('afterrender', function () { | |
me.getContainer(); | |
} | |
); | |
this.addListener('resize', function (that, adjWidth, adjHeight) { | |
me.getContainer().setSize(adjWidth, adjHeight); | |
} | |
); | |
this.addListener('destroy', function () { | |
me.getContainer().destroy(); | |
}); | |
}, | |
/** | |
* @method | |
* Return the ext5 container. Lazy | |
* | |
* @returns {Ext5.container.Container} | |
*/ | |
getContainer: function () { | |
if (!Ext.isObject(this.components.container)) { | |
this.components.container = new Ext5.container.Container(this.containerConfig); | |
} | |
return this.components.container; | |
}, | |
/** | |
* @methdo | |
* Return the id of the container-div. | |
* | |
* @returns {string} | |
*/ | |
getContainerId: function () { | |
return this.id + '_container'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment