diff --git a/js/app/models/PlotObjects/PlotRequestObject.js b/js/app/models/PlotObjects/PlotRequestObject.js index 3f91cde..e17ba9b 100644 --- a/js/app/models/PlotObjects/PlotRequestObject.js +++ b/js/app/models/PlotObjects/PlotRequestObject.js @@ -73,8 +73,17 @@ Ext.define('amdaPlotObj.PlotRequestObject', { createNewTab: function() { this.set('last-tab-id', this.get('last-tab-id') + 1); - var recs = this.tabs().add({id : this.get('last-tab-id')}); - recs[0].setDefaultValues(); + var data = {id: this.get('last-tab-id')}; + var applyDefault = true; + if ((arguments.length > 0) && arguments[0]) { + data = arguments[0]; + data['id'] = this.get('last-tab-id'); + applyDefault = false; + } + var recs = this.tabs().add(data); + if (applyDefault) { + recs[0].setDefaultValues(); + } this.dirty = true; return recs[0]; }, diff --git a/js/app/models/PlotTabNode.js b/js/app/models/PlotTabNode.js index f18b655..5b1cda5 100644 --- a/js/app/models/PlotTabNode.js +++ b/js/app/models/PlotTabNode.js @@ -65,11 +65,11 @@ Ext.define('amdaModel.PlotTabNode', { switch (fnId) { case 'openTab': - console.log('openTab'); + this.insertPlotTabRequest(true); break; case 'insertTab': - console.log('insertTab'); + this.insertPlotTabRequest(false); break; case 'renameTab': @@ -80,11 +80,61 @@ Ext.define('amdaModel.PlotTabNode', { } }, + insertPlotTabRequest : function(inNewRequest) { + var me = this; + amdaModel.InteractiveNode.preloadNodes(this.parentNode.getRootNode(), function() { + AmdaAction.getObject(me.parentNode.get('id'), me.parentNode.get('nodeType'), function (result,remoteEvent) { + var paramObj = Ext.create(me.parentNode.get('objectDataModel'), result); + var tabData = null; + paramObj.tabs().each(function(tab) { + if (tab.get('id') == me.get('tabid')) { + tabData = tab.getJsonValues(); + } + }); + if (tabData != null) { + if (inNewRequest) { + tabData['id'] = 1; + paramObj.set('id',''); + paramObj.set('name', ''); + paramObj.set('folderId', ''); + paramObj.set('active-tab-id', 1); + paramObj.set('last-tab-id', 1); + paramObj.set('last-plotted-tab', 1); + paramObj.loadTabs([tabData]); + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) { + module.setContextNode(me.parentNode.getRootNode()); + module.createWindow(function () { + var uiContent = module.getUiContent(); + if (uiContent != null) { + uiContent.resetProcess(paramObj.getJsonValues()); + } + }); + }); + } + else { + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) { + module.createWindow(function () { + var uiContent = module.getUiContent(); + if (uiContent != null) { + var tabObj = new amdaPlotObj.PlotTabObject(tabData); + uiContent.insertPlotTab(tabData); + } + }); + }); + } + } + }, me); + }); + }, + editPlotTab : function() { var me = this; this.parentNode.editLeaf(function () { myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) { - module.forceTabSelection(me.get('tabid')); + var uiContent = module.getUiContent(); + if (uiContent != null) { + uiContent.forceActiveTab(me.get('tabid')); + } }); }); } diff --git a/js/app/views/PlotUI.js b/js/app/views/PlotUI.js index add5bcc..e21531c 100644 --- a/js/app/views/PlotUI.js +++ b/js/app/views/PlotUI.js @@ -84,7 +84,11 @@ Ext.define('amdaUI.PlotUI', { resetProcess : function(){ var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); plotModule.createLinkedNode(); - plotModule.createObject(); + var obj = null; + if ((arguments.length > 0) && (arguments[0] != null)) { + obj = arguments[0]; + } + plotModule.createObject(obj); this.setObject(plotModule.linkedNode.get('object')); }, @@ -181,6 +185,11 @@ Ext.define('amdaUI.PlotUI', { } } }, + + insertPlotTab : function(tabData) { + var newTab = this.object.createNewTab(tabData); + this.plotTabs.addPlotTab(newTab,true); + }, updateLinkedToMultiPlotMode : function(isLinkedToMultiPlotMode) { this.timeSelector.setVisible(isLinkedToMultiPlotMode); -- libgit2 0.21.2