Commit a73f0195d91386d7160140be3b0919da0d662c5d
1 parent
a2fd2741
Exists in
master
and in
111 other branches
Insert interval in TT from interactive plot UI
Showing
8 changed files
with
83 additions
and
28 deletions
Show diff stats
js/app/controllers/InteractiveModule.js
... | ... | @@ -37,7 +37,7 @@ Ext.define('amdaDesktop.InteractiveModule', { |
37 | 37 | /** |
38 | 38 | * Window Creation method of the Module |
39 | 39 | */ |
40 | - createWindow : function () { | |
40 | + createWindow : function (onShowEvent) { | |
41 | 41 | |
42 | 42 | if (this.linkedNode === null){ |
43 | 43 | this.createLinkedNode(); |
... | ... | @@ -135,6 +135,8 @@ Ext.define('amdaDesktop.InteractiveModule', { |
135 | 135 | // configuration of empty catalog |
136 | 136 | if (this.isOperationOnShow) |
137 | 137 | this.operationOnShow(); |
138 | + if (onShowEvent) | |
139 | + onShowEvent(); | |
138 | 140 | } |
139 | 141 | }); |
140 | 142 | } else { |
... | ... |
js/app/controllers/TimeTableModule.js
js/app/models/InteractiveNode.js
... | ... | @@ -104,7 +104,7 @@ Ext.define('amdaModel.InteractiveNode', { |
104 | 104 | /** |
105 | 105 | * open Module with THIS NODE |
106 | 106 | */ |
107 | - editInModule : function (contextNode) | |
107 | + editInModule : function (contextNode, onReady) | |
108 | 108 | { |
109 | 109 | // set the contextNode of this node |
110 | 110 | this.set('contextNode',contextNode); |
... | ... | @@ -130,7 +130,7 @@ Ext.define('amdaModel.InteractiveNode', { |
130 | 130 | //Sol2: msg with user choice: "warning this node is already edited! Would you confirm this action and lost your modification?"->'Confirm','Cancel' |
131 | 131 | } |
132 | 132 | // Opening parameter window |
133 | - module.createWindow(); | |
133 | + module.createWindow(onReady); | |
134 | 134 | }); |
135 | 135 | |
136 | 136 | |
... | ... | @@ -454,7 +454,7 @@ Ext.define('amdaModel.InteractiveNode', { |
454 | 454 | this.renameNode(); |
455 | 455 | break; |
456 | 456 | case 'editLeaf': |
457 | - this.editLeaf(this); | |
457 | + this.editLeaf(); | |
458 | 458 | break; |
459 | 459 | case 'deleteMulti': |
460 | 460 | this.deleteMulti(); |
... | ... | @@ -776,7 +776,7 @@ Ext.define('amdaModel.InteractiveNode', { |
776 | 776 | * load the rootNode and recursively all its child nodes |
777 | 777 | * to know all names of DerivedParameters |
778 | 778 | */ |
779 | - editLeaf: function() | |
779 | + editLeaf: function(onReady) | |
780 | 780 | { |
781 | 781 | var me = this; |
782 | 782 | amdaModel.InteractiveNode.preloadNodes(this.getRootNode(), |
... | ... | @@ -785,7 +785,7 @@ Ext.define('amdaModel.InteractiveNode', { |
785 | 785 | if (me.get('object')) |
786 | 786 | { |
787 | 787 | // launch edition of parameter into parameter module |
788 | - me.editInModule(); | |
788 | + me.editInModule(null, onReady); | |
789 | 789 | } |
790 | 790 | else |
791 | 791 | { |
... | ... |
js/app/models/MyDataNode.js
js/app/models/MyDataParamNode.js
js/app/models/PlotNode.js
js/app/views/PlotComponents/PlotZoomPlug.js
... | ... | @@ -26,6 +26,8 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
26 | 26 | tabId : '', |
27 | 27 | panelId : -1, |
28 | 28 | |
29 | + linkedTTNode : null, | |
30 | + | |
29 | 31 | constructor: function(config) { |
30 | 32 | Ext.apply(this, config); |
31 | 33 | this.callParent(arguments); |
... | ... | @@ -84,10 +86,13 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
84 | 86 | if (this.zoomType != 'timeAxis') |
85 | 87 | return; |
86 | 88 | |
89 | + var start = this.form.getForm().findField('zoom-min-time').getValue(); | |
90 | + var stop = this.form.getForm().findField('zoom-max-time').getValue(); | |
91 | + | |
87 | 92 | myDesktopApp.getLoadedModule(this.ttModuleId, true, function(module){ |
88 | - var targetModuleUI = targetModule.getUiContent(); | |
89 | - //if (targetModuleUI) | |
90 | - // targetModuleUI.addInterval(this.start,this.stop); | |
93 | + var targetModuleUI = module.getUiContent(); | |
94 | + if (targetModuleUI) | |
95 | + targetModuleUI.addInterval(start,stop); | |
91 | 96 | }); |
92 | 97 | }, |
93 | 98 | |
... | ... | @@ -287,19 +292,59 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
287 | 292 | text: 'Insert Interval', |
288 | 293 | scope: this, |
289 | 294 | handler: function(){ |
290 | - if (this.zoomType != 'timeAxis') | |
291 | - return; | |
292 | - | |
293 | - this.start = this.form.getForm().findField('zoom-min-time').getValue(); | |
294 | - this.stop = this.form.getForm().findField('zoom-max-time').getValue(); | |
295 | - // new TimeTable or typed manually | |
296 | 295 | var me = this; |
297 | - var targetModule = myDesktopApp.getLoadedModule(this.ttModuleId, true, function(module) { | |
298 | - var targetModuleUI = module.getUiContent(); | |
299 | - var TTname = me.form.getForm().findField('tt-name').getValue(); | |
300 | - //ToDo | |
301 | - }); | |
302 | - | |
296 | + | |
297 | + var TTname = this.form.getForm().findField('tt-name').getValue(); | |
298 | + | |
299 | + myDesktopApp.getLoadedModule(this.ttModuleId, true, function(module){ | |
300 | + var targetModuleUI = module.getUiContent(); | |
301 | + if (me.linkedTTNode && (me.linkedTTNode.get('text') == TTname)) | |
302 | + { | |
303 | + if (targetModuleUI) | |
304 | + me.insertInterval(); | |
305 | + else | |
306 | + { | |
307 | + me.linkedTTNode.editLeaf(function () { | |
308 | + me.insertInterval(); | |
309 | + }); | |
310 | + } | |
311 | + } | |
312 | + else | |
313 | + { | |
314 | + if (TTname == '') | |
315 | + { | |
316 | + me.linkedTTNode.editLeaf(function () { | |
317 | + me.insertInterval(); | |
318 | + }); | |
319 | + } | |
320 | + | |
321 | + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | |
322 | + var ttRootNode = explorerTree.getRootNode().findChild('id','timeTable-treeRootNode',true); | |
323 | + amdaModel.InteractiveNode.preloadNodes(ttRootNode, function() { | |
324 | + var nodeWithSameName = null; | |
325 | + | |
326 | + if (TTname != '') | |
327 | + nodeWithSameName = ttRootNode.findChild('text', TTname, true); | |
328 | + | |
329 | + if (nodeWithSameName !== null) | |
330 | + me.linkedTTNode = nodeWithSameName; | |
331 | + else | |
332 | + { | |
333 | + var obj = Ext.create('amdaModel.TimeTable', {name : TTname, fromPlugin : true}); | |
334 | + me.linkedTTNode = Ext.create('amdaModel.TimeTableNode', { | |
335 | + leaf : true, | |
336 | + text : TTname, | |
337 | + nodeType : 'timeTable', | |
338 | + object : obj | |
339 | + }); | |
340 | + } | |
341 | + | |
342 | + me.linkedTTNode.editLeaf(function () { | |
343 | + me.insertInterval(); | |
344 | + }); | |
345 | + }); | |
346 | + } | |
347 | + }); | |
303 | 348 | } |
304 | 349 | } |
305 | 350 | ] |
... | ... |
js/app/views/TimeTableUI.js
... | ... | @@ -226,10 +226,18 @@ Ext.define('amdaUI.TimeTableUI', { |
226 | 226 | |
227 | 227 | addInterval : function(start, stop) |
228 | 228 | { |
229 | + var row = this.TTGrid.getStore().getTotalCount(); | |
230 | + var me = this; | |
229 | 231 | this.TTGrid.getSelectionModel().deselectAll(); |
230 | - AmdaAction.addTTCacheInterval({'start' : start, 'stop' : stop},function (result, e) { | |
231 | - this.TTGrid.getStore().reload(); | |
232 | - this.status = result.status; | |
232 | + AmdaAction.addTTCacheInterval({'start' : start, 'stop' : stop, 'index' : row},function (result, e) { | |
233 | + this.status = result.status; | |
234 | + this.TTGrid.getStore().reload({ | |
235 | + callback : function(records, options, success) { | |
236 | + me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { | |
237 | + me.TTGrid.getView().select(row); | |
238 | + }, me); | |
239 | + } | |
240 | + }); | |
233 | 241 | }, this); |
234 | 242 | }, |
235 | 243 | |
... | ... |