Commit 6fbcceba6fd87cc3b2cd7fdbd2824dcd5ac844d4
Exists in
master
and in
106 other branches
Merge branch 'rm_6522' into 'master'
Rm 6522 See merge request !36
Showing
1 changed file
with
44 additions
and
39 deletions
Show diff stats
js/app/models/InteractiveNode.js
@@ -28,8 +28,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -28,8 +28,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
28 | statics: { | 28 | statics: { |
29 | preloadNodes : function(node,onready) | 29 | preloadNodes : function(node,onready) |
30 | { | 30 | { |
31 | - var me = this; | ||
32 | - | 31 | + var me = this; |
33 | var nodesToLoad = new Array(); | 32 | var nodesToLoad = new Array(); |
34 | nodesToLoad.push(node); | 33 | nodesToLoad.push(node); |
35 | this.preloadTreeNode(node, nodesToLoad, function (node) | 34 | this.preloadTreeNode(node, nodesToLoad, function (node) |
@@ -131,7 +130,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -131,7 +130,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
131 | } | 130 | } |
132 | module.setContextNode(contextNode); | 131 | module.setContextNode(contextNode); |
133 | 132 | ||
134 | - } else if (module.getLinkedNode() != null){ | 133 | + } else if (module.getLinkedNode() != null){ |
135 | //TODO the node to edit is already edited | 134 | //TODO the node to edit is already edited |
136 | // myDesktopApp.warningMsg('This object is being edited'); | 135 | // myDesktopApp.warningMsg('This object is being edited'); |
137 | //Sol1: msg alert: "warning this node is already edited! If you want to get the original, please press the 'reset' button"->'OK' | 136 | //Sol1: msg alert: "warning this node is already edited! If you want to get the original, please press the 'reset' button"->'OK' |
@@ -237,7 +236,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -237,7 +236,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
237 | if (!this.get('contextNode') || (this.get('contextNode').data.id == 'sharedtimeTable-treeRootNode') || (this.get('contextNode').data.id == 'sharedcatalog-treeRootNode')) { | 236 | if (!this.get('contextNode') || (this.get('contextNode').data.id == 'sharedtimeTable-treeRootNode') || (this.get('contextNode').data.id == 'sharedcatalog-treeRootNode')) { |
238 | // set the root node of 'Derived Parameters' tree as contextNode | 237 | // set the root node of 'Derived Parameters' tree as contextNode |
239 | this.set('contextNode',this.getRootNode()); | 238 | this.set('contextNode',this.getRootNode()); |
240 | - } | 239 | + } |
241 | // call the Ext.Direct method to create parameter | 240 | // call the Ext.Direct method to create parameter |
242 | AmdaAction.createObject(this.get('object').getJsonValues(false), this.get('contextNode').get('id'), function(res,e){ | 241 | AmdaAction.createObject(this.get('object').getJsonValues(false), this.get('contextNode').get('id'), function(res,e){ |
243 | //success | 242 | //success |
@@ -258,12 +257,13 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -258,12 +257,13 @@ Ext.define('amdaModel.InteractiveNode', { | ||
258 | } | 257 | } |
259 | // set text of this node | 258 | // set text of this node |
260 | this.set('text',this.get('object').get('name')); | 259 | this.set('text',this.get('object').get('name')); |
260 | + | ||
261 | //set id of this node | 261 | //set id of this node |
262 | this.set('id',res.id); | 262 | this.set('id',res.id); |
263 | this.internalId = res.id; | 263 | this.internalId = res.id; |
264 | + | ||
264 | // set id of node's object | 265 | // set id of node's object |
265 | - this.get('object').set('id',res.id); | ||
266 | - | 266 | + this.get('object').set('id',res.id); |
267 | if (res.created){ | 267 | if (res.created){ |
268 | // set the created date | 268 | // set the created date |
269 | this.get('object').set('created',res.created); | 269 | this.get('object').set('created',res.created); |
@@ -570,39 +570,44 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -570,39 +570,44 @@ Ext.define('amdaModel.InteractiveNode', { | ||
570 | var me = this; | 570 | var me = this; |
571 | myDesktopApp.getLoadedModule(moduleId, true, function (module) { | 571 | myDesktopApp.getLoadedModule(moduleId, true, function (module) { |
572 | var editedNode = module.getLinkedNode(); | 572 | var editedNode = module.getLinkedNode(); |
573 | - // file node is not linked directly to the module | ||
574 | - var isThisFile = false; | ||
575 | - | ||
576 | - if (editedNode && editedNode.$className == 'amdaModel.MyDataParamNode') | ||
577 | - if (editedNode.get('fileObject').get('fileName') == me.get('text')) | ||
578 | - isThisFile = true; | ||
579 | - | ||
580 | - if (me.$className == 'amdaModel.DerivedParamNode') | ||
581 | - { | ||
582 | - var obj = { | ||
583 | - paramId : 'ws_'+me.get('text') | ||
584 | - }; | ||
585 | - AmdaAction.compilParamDelete(obj); | ||
586 | - } | ||
587 | - | ||
588 | - if (editedNode === me || isThisFile){ | ||
589 | - var newNode = Ext.ModelManager.create({leaf : true}, me.$className); | ||
590 | - // several tabs could be connected to one node | ||
591 | - if (moduleId === myDesktopApp.dynamicModules.plot.id) { | ||
592 | - var linkedNodes = module.linkedNodes; | ||
593 | - | ||
594 | - if (linkedNodes) { | ||
595 | - linkedNodes.each(function(key, value){ | ||
596 | - if (value === me) { | ||
597 | - linkedNodes.replace(key,newNode); | ||
598 | - var tabPanel = module.getUiContent().tabPanel.items.getByKey(key); | ||
599 | - tabPanel.setObject(Ext.create(amdaModel.Plot.$className, {})); | ||
600 | - } | ||
601 | - }, me); | ||
602 | - } | ||
603 | - } | ||
604 | - newNode.editInModule(); | ||
605 | - } | 573 | + |
574 | + // file node is not linked directly to the module | ||
575 | + var isThisFile = false; | ||
576 | + if (editedNode && editedNode.$className == 'amdaModel.MyDataParamNode') | ||
577 | + if (editedNode.get('fileObject').get('fileName') == me.get('text')) | ||
578 | + isThisFile = true; | ||
579 | + | ||
580 | + // node was created BEFORE tree loading; node.id are different ; but it is the same node | ||
581 | + if ( editedNode.get('id') == me.get('id') && editedNode !== me ) { | ||
582 | + module.setLinkedNode(me); | ||
583 | + isThisFile = true; | ||
584 | + } | ||
585 | + | ||
586 | + if (me.$className == 'amdaModel.DerivedParamNode') { | ||
587 | + var obj = { | ||
588 | + paramId : 'ws_'+me.get('text') | ||
589 | + }; | ||
590 | + AmdaAction.compilParamDelete(obj); | ||
591 | + } | ||
592 | + | ||
593 | + if (editedNode === me || isThisFile ){ | ||
594 | + var newNode = Ext.ModelManager.create({leaf : true}, me.$className); | ||
595 | + // several tabs could be connected to one node | ||
596 | + if (moduleId === myDesktopApp.dynamicModules.plot.id) { | ||
597 | + var linkedNodes = module.linkedNodes; | ||
598 | + | ||
599 | + if (linkedNodes) { | ||
600 | + linkedNodes.each(function(key, value){ | ||
601 | + if (value === me) { | ||
602 | + linkedNodes.replace(key,newNode); | ||
603 | + var tabPanel = module.getUiContent().tabPanel.items.getByKey(key); | ||
604 | + tabPanel.setObject(Ext.create(amdaModel.Plot.$className, {})); | ||
605 | + } | ||
606 | + }, me); | ||
607 | + } | ||
608 | + } | ||
609 | + newNode.editInModule(); | ||
610 | + } | ||
606 | }); | 611 | }); |
607 | } | 612 | } |
608 | } | 613 | } |