console.log('Double clicked on ' + record.get('caption'));
var caption = record.get('caption');
var id = record.get('id');
+ var tabId = id + '-tab';
console.log('clicked the ShowMenu entry { text: ' + caption + ', id:' + id + '}');
var viewport = grid.up('viewport');
//var maintabs = viewport.child('#maintabs');
var maintabs = Decshee.Viewport.child('#maintabs');
- maintabs.showTab(record);
+ var tab = maintabs.child('#' + tabId);
+
+ // タブが生成されていない場合は生成する。
+ if (tab == null) {
+ // アドインをロードするための諸パラメータを生成
+ var srcPath = 'addins/' + id;
+ var packagePath = 'Decshee.' + id;
+ var rootPath = packagePath + '.controller.Root';
+ var rootPanelPath = packagePath + '.view.Panel';
+
+ console.log(srcPath);
+ console.log(packagePath);
+ console.log(rootPath);
+
+ var addin = Decshee.AddIns[id];
+ if (addin == null) {
+ console.log('AddIn [' + id + '] has not loaded.');
+
+ // アドインのパスをローダに設定し、かつクラスをロードする。
+ Ext.Loader.setPath(packagePath, srcPath);
+ Ext.require(packagePath + '.*');
+
+ // アドインのコントローラを取得して初期化。
+ var rootController = Decshee.Application.getController(rootPath);
+ rootController.init();
+
+ Decshee.AddIns[id] = rootController;
+ }
+
+ // タブを追加
+ maintabs.add(
+ {
+ title: caption,
+ itemId: tabId,
+ iconCls: 'tabs',
+ closable: true,
+ layout: 'fit',
+ items: [
+ { xtype: id + 'rootpanel' }
+ ]
+ }
+ )
+ tab = maintabs.child('#' + tabId);
+ }
+
+ // タブをアクティブ化
+ tab.show();
}
}
);
\ No newline at end of file
);
this.callParent(arguments);
- },
-
- showTab: function(entryRecord) {
- var me = this;
-
- var caption = entryRecord.get('caption');
- var id = entryRecord.get('id');
- var tabId = id + '-tab';
- var tab = me.child('#' + tabId);
-
- // 指定したアドインのタブが存在しない場合のみ動的にパス設定を行い、
- // 該当する業務機能の全コンポーネントをロードしてタブを追加する。
- if (tab == null) {
- // アドインのロード
- var srcPath = 'addins/' + id;
- var packagePath = 'Decshee.' + id;
- var rootPath = packagePath + '.controller.Root';
- var rootPanelPath = packagePath + '.view.Panel';
-
- console.log(srcPath);
- console.log(packagePath);
- console.log(rootPath);
-
- var addin = Decshee.AddIns[id];
- if (addin == null) {
-
- Ext.Loader.setPath(packagePath, srcPath);
- Ext.require(packagePath + '.*');
-
- var rootController = Decshee.Application.getController(rootPath);
- console.log(rootController);
- rootController.init();
-
- Decshee.AddIns[id] = rootController;
- console.log('AddIn [' + id + '] has not loaded.');
- }
-
- try {
- // タブを追加。
- me.add(
- {
- title: caption,
- itemId: tabId,
- iconCls: 'tabs',
- closable: true,
- layout: 'fit',
- items: [
- { xtype: id + 'rootpanel' }
- ]
- }
- );
- tab = me.child('#' + tabId);
- } catch(e) {
- alert(e);
- }
- }
- tab.show();
}
}
);
\ No newline at end of file