Commit 59d845ce7717d23d3090ff831c6e7059731628c5
1 parent
119bba35
Exists in
master
and in
32 other branches
Keep parentObject in plot standard forms
Showing
4 changed files
with
20 additions
and
5 deletions
Show diff stats
js/app/views/PlotComponents/PlotElementPanel.js
... | ... | @@ -29,7 +29,7 @@ Ext.define('amdaPlotComp.PlotElementPanel', { |
29 | 29 | this.callParent(); |
30 | 30 | }, |
31 | 31 | |
32 | - setElement: function(type, object, tree) { | |
32 | + setElement: function(type, object, tree, parentObject) { | |
33 | 33 | this.removeAll(false); |
34 | 34 | |
35 | 35 | this.crtTree = tree; |
... | ... | @@ -40,11 +40,13 @@ Ext.define('amdaPlotComp.PlotElementPanel', { |
40 | 40 | elementForm.crtTree = tree; |
41 | 41 | if (elementForm.setObject) |
42 | 42 | elementForm.setObject(object); |
43 | + if (elementForm.setParentObject) | |
44 | + elementForm.setParentObject(parentObject); | |
43 | 45 | }); |
44 | 46 | }, |
45 | 47 | |
46 | 48 | resetElement: function() { |
47 | - this.setElement('',null,null); | |
49 | + this.setElement('',null,null, null); | |
48 | 50 | }, |
49 | 51 | |
50 | 52 | getElementForm: function(type, onFormReady) { |
... | ... |
js/app/views/PlotComponents/PlotStandardForm.js
... | ... | @@ -20,6 +20,8 @@ Ext.define('amdaPlotComp.PlotStandardForm', { |
20 | 20 | //Object associated to this form |
21 | 21 | object: null, |
22 | 22 | |
23 | + parentObject: null, | |
24 | + | |
23 | 25 | //Link to the tree |
24 | 26 | crtTree: null, |
25 | 27 | desableTickNumber: true, |
... | ... | @@ -35,6 +37,10 @@ Ext.define('amdaPlotComp.PlotStandardForm', { |
35 | 37 | this.loadRecord(this.object); |
36 | 38 | }, |
37 | 39 | |
40 | + setParentObject: function (parentObject) { | |
41 | + this.parentObject = parentObject; | |
42 | + }, | |
43 | + | |
38 | 44 | //To override to add form components |
39 | 45 | getFormItems: function () { |
40 | 46 | return []; |
... | ... |
js/app/views/PlotComponents/PlotTabPanel.js
... | ... | @@ -271,7 +271,10 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
271 | 271 | if (newTree.plotElementPanel != null) { |
272 | 272 | var selectedNode = newTree.getSelectedNode(); |
273 | 273 | if (selectedNode != null) { |
274 | - newTree.plotElementPanel.setElement(selectedNode.type, selectedNode.object, newTree); | |
274 | + var parentObject = null; | |
275 | + if (selectedNode.parentNode != null) | |
276 | + parentObject = selectedNode.parentNode.object; | |
277 | + newTree.plotElementPanel.setElement(selectedNode.type, selectedNode.object, newTree, parentObject); | |
275 | 278 | } |
276 | 279 | } |
277 | 280 | } |
... | ... |
js/app/views/PlotComponents/PlotTree.js
... | ... | @@ -430,8 +430,12 @@ Ext.define('amdaPlotComp.PlotTree', { |
430 | 430 | onNodeSelect: function(tree, record, index, eOpts) { |
431 | 431 | if (index == -1) |
432 | 432 | return; |
433 | - if (this.plotElementPanel != null) | |
434 | - this.plotElementPanel.setElement(record.type, record.object, this); | |
433 | + if (this.plotElementPanel != null) { | |
434 | + var parentObject = null; | |
435 | + if (record.parentNode != null) | |
436 | + parentObject = record.parentNode.object; | |
437 | + this.plotElementPanel.setElement(record.type, record.object, this, parentObject); | |
438 | + } | |
435 | 439 | }, |
436 | 440 | |
437 | 441 | onNodeDeselect: function(tree, record, index, eOpts) { |
... | ... |