diff --git a/js/app/views/PlotComponents/PlotElementPanel.js b/js/app/views/PlotComponents/PlotElementPanel.js index 413070a..858d18f 100644 --- a/js/app/views/PlotComponents/PlotElementPanel.js +++ b/js/app/views/PlotComponents/PlotElementPanel.js @@ -29,7 +29,7 @@ Ext.define('amdaPlotComp.PlotElementPanel', { this.callParent(); }, - setElement: function(type, object, tree) { + setElement: function(type, object, tree, parentObject) { this.removeAll(false); this.crtTree = tree; @@ -40,11 +40,13 @@ Ext.define('amdaPlotComp.PlotElementPanel', { elementForm.crtTree = tree; if (elementForm.setObject) elementForm.setObject(object); + if (elementForm.setParentObject) + elementForm.setParentObject(parentObject); }); }, resetElement: function() { - this.setElement('',null,null); + this.setElement('',null,null, null); }, getElementForm: function(type, onFormReady) { diff --git a/js/app/views/PlotComponents/PlotStandardForm.js b/js/app/views/PlotComponents/PlotStandardForm.js index 65760b1..8fe5037 100644 --- a/js/app/views/PlotComponents/PlotStandardForm.js +++ b/js/app/views/PlotComponents/PlotStandardForm.js @@ -20,6 +20,8 @@ Ext.define('amdaPlotComp.PlotStandardForm', { //Object associated to this form object: null, + parentObject: null, + //Link to the tree crtTree: null, desableTickNumber: true, @@ -35,6 +37,10 @@ Ext.define('amdaPlotComp.PlotStandardForm', { this.loadRecord(this.object); }, + setParentObject: function (parentObject) { + this.parentObject = parentObject; + }, + //To override to add form components getFormItems: function () { return []; diff --git a/js/app/views/PlotComponents/PlotTabPanel.js b/js/app/views/PlotComponents/PlotTabPanel.js index 50b33ac..107cd73 100644 --- a/js/app/views/PlotComponents/PlotTabPanel.js +++ b/js/app/views/PlotComponents/PlotTabPanel.js @@ -271,7 +271,10 @@ Ext.define('amdaPlotComp.PlotTabPanel', { if (newTree.plotElementPanel != null) { var selectedNode = newTree.getSelectedNode(); if (selectedNode != null) { - newTree.plotElementPanel.setElement(selectedNode.type, selectedNode.object, newTree); + var parentObject = null; + if (selectedNode.parentNode != null) + parentObject = selectedNode.parentNode.object; + newTree.plotElementPanel.setElement(selectedNode.type, selectedNode.object, newTree, parentObject); } } } diff --git a/js/app/views/PlotComponents/PlotTree.js b/js/app/views/PlotComponents/PlotTree.js index 0a79900..e3274d9 100644 --- a/js/app/views/PlotComponents/PlotTree.js +++ b/js/app/views/PlotComponents/PlotTree.js @@ -430,8 +430,12 @@ Ext.define('amdaPlotComp.PlotTree', { onNodeSelect: function(tree, record, index, eOpts) { if (index == -1) return; - if (this.plotElementPanel != null) - this.plotElementPanel.setElement(record.type, record.object, this); + if (this.plotElementPanel != null) { + var parentObject = null; + if (record.parentNode != null) + parentObject = record.parentNode.object; + this.plotElementPanel.setElement(record.type, record.object, this, parentObject); + } }, onNodeDeselect: function(tree, record, index, eOpts) { -- libgit2 0.21.2