From 6fb8695d95a385b8d57e865ac16dccf1d6096c5f Mon Sep 17 00:00:00 2001 From: legac <renaud.legac@free.fr> Date: Sat, 9 Nov 2013 21:13:49 +0100 Subject: [PATCH] ExtJS 4.2: Remove constructor in viewport and basepanelwithselector. --- .../plugin_dbui/src/basepanelwithselector.js | 88 +++++++------------ static/plugin_dbui/src/viewport.js | 36 +++----- 2 files changed, 46 insertions(+), 78 deletions(-) diff --git a/static/plugin_dbui/src/basepanelwithselector.js b/static/plugin_dbui/src/basepanelwithselector.js index 894173bd..f713e070 100644 --- a/static/plugin_dbui/src/basepanelwithselector.js +++ b/static/plugin_dbui/src/basepanelwithselector.js @@ -105,75 +105,51 @@ Ext.define('App.BasePanelWithSelector', { textGo: 'Go', textReset: 'Reset', - /** - * @constructor - * - * @param {Object} config - */ - constructor: function(config) { + // Private method requires by the ExtJS component model + initComponent: function (config) { "use strict"; var cfg, - itemPanel, - itemSelector, - panel, - selector; + toolbar; + // apply the user configuration if any Ext.apply(this, config); - // configure the panel item - panel = Ext.ComponentMgr.create(this.panelCfg); - itemPanel = { - border: this.panelBorder, - layout: 'fit', - itemId: 'mainPanel', - items: [panel], - region: 'center' - }; - - // configure the selector item - selector = Ext.ComponentMgr.create(this.selectorCfg); - itemSelector = { - buttons: [{ - itemId: 'goButton', - text: this.textGo - }, { - itemId: 'resetButton', - text: this.textReset - }], - collapsible: this.selectorCollapsible, - frame: this.selectorFrame, - height: this.selectorHeight, - layout: 'form', - itemId: 'selectorPanel', - items: [selector], - bodyPadding: "0 5 0 0", - region: this.selectorRegion, - split: this.selectorSplit, - title: this.selectorTitle, - width: this.selectorWidth - }; - - // configure the border layout + // predefined configuration cfg = { layout: 'border', - items: [itemPanel, itemSelector] + items: [{ + border: this.panelBorder, + layout: 'fit', + itemId: 'mainPanel', + items: this.panelCfg, + region: 'center' + }, { + bodyPadding: "0 5 0 0", + buttons: [{ + itemId: 'goButton', + text: this.textGo + }, { + itemId: 'resetButton', + text: this.textReset + }], + collapsible: this.selectorCollapsible, + frame: this.selectorFrame, + height: this.selectorHeight, + layout: 'form', + itemId: 'selectorPanel', + items: this.selectorCfg, + region: this.selectorRegion, + split: this.selectorSplit, + title: this.selectorTitle, + width: this.selectorWidth + }] }; + // apply the predefined configuration Ext.apply(this, cfg); - // instantiate the panel - App.BasePanelWithSelector.superclass.constructor.call(this); - }, - - // Private method requires by the ExtJS component model - initComponent: function () { - - "use strict"; - - var toolbar; - App.BasePanelWithSelector.superclass.initComponent.call(this); // short cuts diff --git a/static/plugin_dbui/src/viewport.js b/static/plugin_dbui/src/viewport.js index d6cd3dda..14531854 100644 --- a/static/plugin_dbui/src/viewport.js +++ b/static/plugin_dbui/src/viewport.js @@ -36,31 +36,29 @@ Ext.define('App.Viewport', { tabPanel: null, treePanel: null, - /** - * @constructor - * - * @param {Object} config - */ - constructor: function (config) { + // private method requires by the Ext JS component model + initComponent: function (config) { "use strict"; - var cfg, - store; + var treeStoreCfg, + viewportCfg; + // apply the user configuration if any Ext.apply(this, config); - // instantiate the TreeStore - store = Ext.create('Ext.data.TreeStore', { + // the TreeStore configuration + treeStoreCfg = { root: { expanded: true, children: App.storeCfgs['treeNodes'], text: App.name - } - }); + }, + xtype: 'tree' + }; // predefined configuration of the view port - cfg = { + viewportCfg = { layout: 'border', title: 'Ext Layout Browser', items: [{ @@ -76,7 +74,7 @@ Ext.define('App.Viewport', { region: 'west', rootVisible: false, split: true, - store: store, + store: treeStoreCfg, title: App.name, width: 200, xtype: 'treepanel' @@ -98,15 +96,9 @@ Ext.define('App.Viewport', { }] }; - // apply the user configuration if any - Ext.apply(this, cfg); + // apply the predefined configuration + Ext.apply(this, viewportCfg); - // instantiate the ViewPort - App.Viewport.superclass.constructor.call(this); - }, - - // private method requires by the Ext JS component model - initComponent: function (config) { App.Viewport.superclass.initComponent.call(this); -- GitLab