diff --git a/js/app/controllers/InteractiveModule.js b/js/app/controllers/InteractiveModule.js index fd41a1a..88197ad 100644 --- a/js/app/controllers/InteractiveModule.js +++ b/js/app/controllers/InteractiveModule.js @@ -37,7 +37,7 @@ Ext.define('amdaDesktop.InteractiveModule', { /** * Window Creation method of the Module */ - createWindow : function () { + createWindow : function (onShowEvent) { if (this.linkedNode === null){ this.createLinkedNode(); @@ -135,6 +135,8 @@ Ext.define('amdaDesktop.InteractiveModule', { // configuration of empty catalog if (this.isOperationOnShow) this.operationOnShow(); + if (onShowEvent) + onShowEvent(); } }); } else { diff --git a/js/app/controllers/TimeTableModule.js b/js/app/controllers/TimeTableModule.js index 0dff52a..785a7e2 100644 --- a/js/app/controllers/TimeTableModule.js +++ b/js/app/controllers/TimeTableModule.js @@ -40,7 +40,7 @@ Ext.define('amdaDesktop.TimeTableModule', { /** * @override */ - createWindow : function() { + createWindow : function(onshowfn) { this.callParent(arguments); var win = this.app.getDesktop().getWindow(this.id); diff --git a/js/app/models/InteractiveNode.js b/js/app/models/InteractiveNode.js index 0bd2fa0..b253e6b 100644 --- a/js/app/models/InteractiveNode.js +++ b/js/app/models/InteractiveNode.js @@ -104,7 +104,7 @@ Ext.define('amdaModel.InteractiveNode', { /** * open Module with THIS NODE */ - editInModule : function (contextNode) + editInModule : function (contextNode, onReady) { // set the contextNode of this node this.set('contextNode',contextNode); @@ -130,7 +130,7 @@ Ext.define('amdaModel.InteractiveNode', { //Sol2: msg with user choice: "warning this node is already edited! Would you confirm this action and lost your modification?"->'Confirm','Cancel' } // Opening parameter window - module.createWindow(); + module.createWindow(onReady); }); @@ -454,7 +454,7 @@ Ext.define('amdaModel.InteractiveNode', { this.renameNode(); break; case 'editLeaf': - this.editLeaf(this); + this.editLeaf(); break; case 'deleteMulti': this.deleteMulti(); @@ -776,7 +776,7 @@ Ext.define('amdaModel.InteractiveNode', { * load the rootNode and recursively all its child nodes * to know all names of DerivedParameters */ - editLeaf: function() + editLeaf: function(onReady) { var me = this; amdaModel.InteractiveNode.preloadNodes(this.getRootNode(), @@ -785,7 +785,7 @@ Ext.define('amdaModel.InteractiveNode', { if (me.get('object')) { // launch edition of parameter into parameter module - me.editInModule(); + me.editInModule(null, onReady); } else { diff --git a/js/app/models/MyDataNode.js b/js/app/models/MyDataNode.js index 9d76cf9..c111bc2 100644 --- a/js/app/models/MyDataNode.js +++ b/js/app/models/MyDataNode.js @@ -80,7 +80,7 @@ Ext.define('amdaModel.MyDataNode', { break; case 'editLeaf': - this.editLeaf(this); + this.editLeaf(); break; case 'upload': diff --git a/js/app/models/MyDataParamNode.js b/js/app/models/MyDataParamNode.js index ff3591d..5553bf6 100644 --- a/js/app/models/MyDataParamNode.js +++ b/js/app/models/MyDataParamNode.js @@ -101,7 +101,7 @@ Ext.define('amdaModel.MyDataParamNode', { break; case 'editLeaf': - this.editLeaf(this); + this.editLeaf(); break; case 'upload': diff --git a/js/app/models/PlotNode.js b/js/app/models/PlotNode.js index f2af813..4251b86 100644 --- a/js/app/models/PlotNode.js +++ b/js/app/models/PlotNode.js @@ -100,7 +100,7 @@ Ext.define('amdaModel.PlotNode', { break; case 'editPlot': - this.editLeaf(this); + this.editLeaf(); break; case 'editDownload': diff --git a/js/app/views/PlotComponents/PlotZoomPlug.js b/js/app/views/PlotComponents/PlotZoomPlug.js index d53d35c..385de7b 100644 --- a/js/app/views/PlotComponents/PlotZoomPlug.js +++ b/js/app/views/PlotComponents/PlotZoomPlug.js @@ -26,6 +26,8 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { tabId : '', panelId : -1, + linkedTTNode : null, + constructor: function(config) { Ext.apply(this, config); this.callParent(arguments); @@ -84,10 +86,13 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { if (this.zoomType != 'timeAxis') return; + var start = this.form.getForm().findField('zoom-min-time').getValue(); + var stop = this.form.getForm().findField('zoom-max-time').getValue(); + myDesktopApp.getLoadedModule(this.ttModuleId, true, function(module){ - var targetModuleUI = targetModule.getUiContent(); - //if (targetModuleUI) - // targetModuleUI.addInterval(this.start,this.stop); + var targetModuleUI = module.getUiContent(); + if (targetModuleUI) + targetModuleUI.addInterval(start,stop); }); }, @@ -287,19 +292,59 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { text: 'Insert Interval', scope: this, handler: function(){ - if (this.zoomType != 'timeAxis') - return; - - this.start = this.form.getForm().findField('zoom-min-time').getValue(); - this.stop = this.form.getForm().findField('zoom-max-time').getValue(); - // new TimeTable or typed manually var me = this; - var targetModule = myDesktopApp.getLoadedModule(this.ttModuleId, true, function(module) { - var targetModuleUI = module.getUiContent(); - var TTname = me.form.getForm().findField('tt-name').getValue(); - //ToDo - }); - + + var TTname = this.form.getForm().findField('tt-name').getValue(); + + myDesktopApp.getLoadedModule(this.ttModuleId, true, function(module){ + var targetModuleUI = module.getUiContent(); + if (me.linkedTTNode && (me.linkedTTNode.get('text') == TTname)) + { + if (targetModuleUI) + me.insertInterval(); + else + { + me.linkedTTNode.editLeaf(function () { + me.insertInterval(); + }); + } + } + else + { + if (TTname == '') + { + me.linkedTTNode.editLeaf(function () { + me.insertInterval(); + }); + } + + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); + var ttRootNode = explorerTree.getRootNode().findChild('id','timeTable-treeRootNode',true); + amdaModel.InteractiveNode.preloadNodes(ttRootNode, function() { + var nodeWithSameName = null; + + if (TTname != '') + nodeWithSameName = ttRootNode.findChild('text', TTname, true); + + if (nodeWithSameName !== null) + me.linkedTTNode = nodeWithSameName; + else + { + var obj = Ext.create('amdaModel.TimeTable', {name : TTname, fromPlugin : true}); + me.linkedTTNode = Ext.create('amdaModel.TimeTableNode', { + leaf : true, + text : TTname, + nodeType : 'timeTable', + object : obj + }); + } + + me.linkedTTNode.editLeaf(function () { + me.insertInterval(); + }); + }); + } + }); } } ] diff --git a/js/app/views/TimeTableUI.js b/js/app/views/TimeTableUI.js index ba915cc..419c335 100755 --- a/js/app/views/TimeTableUI.js +++ b/js/app/views/TimeTableUI.js @@ -226,10 +226,18 @@ Ext.define('amdaUI.TimeTableUI', { addInterval : function(start, stop) { + var row = this.TTGrid.getStore().getTotalCount(); + var me = this; this.TTGrid.getSelectionModel().deselectAll(); - AmdaAction.addTTCacheInterval({'start' : start, 'stop' : stop},function (result, e) { - this.TTGrid.getStore().reload(); - this.status = result.status; + AmdaAction.addTTCacheInterval({'start' : start, 'stop' : stop, 'index' : row},function (result, e) { + this.status = result.status; + this.TTGrid.getStore().reload({ + callback : function(records, options, success) { + me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { + me.TTGrid.getView().select(row); + }, me); + } + }); }, this); }, -- libgit2 0.21.2