diff --git a/js/app/controllers/InteractiveModule.js b/js/app/controllers/InteractiveModule.js index c602e81..e3456fc 100644 --- a/js/app/controllers/InteractiveModule.js +++ b/js/app/controllers/InteractiveModule.js @@ -243,9 +243,9 @@ Ext.define('amdaDesktop.InteractiveModule', { * @param {String} objectName The name of sent object * @param {String} isLeaf boolean true if it's a leaf parameter */ - addParam : function(objectName, isLeaf, isScatter, needsArgs) { + addParam : function(objectName, isLeaf, needsArgs, components) { var uiContent = this.getUiContent(); - uiContent.addParam(objectName, isLeaf, isScatter, needsArgs); + uiContent.addParam(objectName, isLeaf, needsArgs, components); }, saveState : Ext.emptyFn, diff --git a/js/app/models/AliasNode.js b/js/app/models/AliasNode.js index 3e9ec68..82a2f8b 100644 --- a/js/app/models/AliasNode.js +++ b/js/app/models/AliasNode.js @@ -18,11 +18,7 @@ Ext.define('amdaModel.AliasNode', { deletedAliases : null }, - fields: [ - {name: 'isScatter', type: 'boolean', defaultValue: true} - ], - - constructor : function(config) + constructor : function(config) { this.callParent(arguments); if (this.get('leaf')) this.set('iconCls', 'icon-scalar'); diff --git a/js/app/models/DerivedParamNode.js b/js/app/models/DerivedParamNode.js index 0139291..41ed1fc 100644 --- a/js/app/models/DerivedParamNode.js +++ b/js/app/models/DerivedParamNode.js @@ -17,11 +17,7 @@ Ext.define('amdaModel.DerivedParamNode', { objectName: 'Parameter' }, - fields:[ - {name: 'isScatter', type: 'boolean', defaultValue: true} - ], - - constructor : function(config){ + constructor : function(config){ this.callParent(arguments); this.set('moduleId',myDesktopApp.dynamicModules.param.id); this.set('objectDataModel',amdaModel.Parameter.$className); diff --git a/js/app/models/InteractiveNode.js b/js/app/models/InteractiveNode.js index f0c2e33..93f8370 100644 --- a/js/app/models/InteractiveNode.js +++ b/js/app/models/InteractiveNode.js @@ -534,7 +534,8 @@ Ext.define('amdaModel.InteractiveNode', { module.getUiContent().fireEvent('openParamEditor',node.get('id')); } else { - var paramName; + var paramName; + var components = null; switch (node.$className) { case 'amdaModel.AliasNode' : paramName = "#"+node.get('text'); @@ -549,10 +550,21 @@ Ext.define('amdaModel.InteractiveNode', { if (node.get('alias')!= "" ) paramName = "#"+node.get('alias'); else - paramName = node.get('id'); + paramName = node.get('id'); + } + + var component_info = node.get('component_info'); + if (component_info && component_info.parentId) { + //It's a component + paramName = component_info.parentId; + components = []; + if (component_info.index1) + components['index1'] = component_info.index1; + if (component_info.index2) + components['index2'] = component_info.index2; } - module.addParam(paramName,true); + module.addParam(paramName,true,node.get('needsArgs'),components); } }); diff --git a/js/app/models/LocalParamNode.js b/js/app/models/LocalParamNode.js index 4e5ca4a..74c9d03 100644 --- a/js/app/models/LocalParamNode.js +++ b/js/app/models/LocalParamNode.js @@ -23,7 +23,6 @@ Ext.define('amdaModel.LocalParamNode', {name: 'isParameter', type: 'boolean', persist: false}, {name: 'notyet', type: 'boolean', defaultValue: false, persist: false}, {name: 'needsArgs', type: 'boolean', persist: false}, - {name: 'isScatter', type: 'boolean', defaultValue: true, persist: false}, {name: 'isSpectra', type: 'boolean', defaultValue: false, persist: false}, {name: 'isStack', type: 'boolean', defaultValue: true, persist: false}, {name: 'globalStart', type: 'string', persist: false}, @@ -174,22 +173,27 @@ Ext.define('amdaModel.LocalParamNode', // edit newNode into Parameter Module with node as contextNode newNode.editInModule(); - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id, true, function(module) { + var paramName; + var components = null; + if (node.get('alias')!= "" ) + paramName = "#"+node.get('alias'); + else + paramName = node.get('id'); + var component_info = node.get('component_info'); + if (component_info && component_info.parentId) { + //It's a component + paramName = component_info.parentId; + components = []; + if (component_info.index1) + components['index1'] = component_info.index1; + if (component_info.index2) + components['index2'] = component_info.index2; + } + + module.addParam(paramName,true,node.get('needsArgs'),components); + }); - if (node.get('needsArgs')) { - module.getUiContent().fireEvent('openParamEditor',node.get('id')); - } - else { - var paramName; - if (node.get('alias')!= "" ) - paramName = "#"+node.get('alias'); - else - paramName = node.get('id'); - - - module.addParam(paramName,true); - } - }, createAlias: function(node) diff --git a/js/app/models/PlotObjects/PlotPanelObject.js b/js/app/models/PlotObjects/PlotPanelObject.js index a77ea23..788c712 100644 --- a/js/app/models/PlotObjects/PlotPanelObject.js +++ b/js/app/models/PlotObjects/PlotPanelObject.js @@ -270,8 +270,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', { } }, - createNewParam: function(paramId, onAfterCreate) { - + createNewParam: function(paramId, paramComponents, onAfterCreate) { this.set('last-param-id', this.get('last-param-id') + 1); var emptyPanel = (this.params().getCount() == 0); @@ -279,6 +278,13 @@ Ext.define('amdaPlotObj.PlotPanelObject', { var recs = this.params().add({id : this.get('last-param-id')}); recs[0].set('paramid', paramId); + if (paramComponents) { + if (paramComponents['index1']) + recs[0].set('dim1', paramComponents['index1']); + if (paramComponents['index2']) + recs[0].set('dim2', paramComponents['index2']); + } + var me = this; amdaPlotObj.PlotObjectConfig.getParamConfig(paramId, function (success, data) { var availableDrawingObjects = null; diff --git a/js/app/views/DownloadUI.js b/js/app/views/DownloadUI.js index 6c5773f..0948a1d 100644 --- a/js/app/views/DownloadUI.js +++ b/js/app/views/DownloadUI.js @@ -84,14 +84,31 @@ Ext.define('amdaUI.DownloadUI', { this.timeSelector.intervalSel.updateDuration(); }, - addParam : function(paramId,isArgsToDefined) + addParam : function(paramId, isLeaf, needArgs, components) { // adding the parameter to the paramGrid - var r = Ext.create('amdaModel.DownloadParam', {paramid: paramId, type: 0, dim1: '', dim2: '', template_args: {} }); + + var type = 0; + var dim1 = ''; + var dim2 = ''; + + if (components) { + if (components['index1']) { + dim1 = components['index1']; + ++type; + } + + if (components['index2']) { + dim2 = components['index2']; + ++type; + } + } + + var r = Ext.create('amdaModel.DownloadParam', {paramid: paramId, type: type, dim1: dim1, dim2: dim2, template_args: {} }); var pos = paramId.indexOf('ws_',0) == -1 ? 0 :this.paramGrid.store.getCount(); this.paramGrid.store.insert(pos,r); this.paramGrid.getView().refresh(); - if (isArgsToDefined) + if (!isLeaf || needArgs) this.editParameterArgs(r); }, @@ -376,6 +393,7 @@ Ext.define('amdaUI.DownloadUI', { if (!this.valid) return false; var idToSent; + var components = null; switch (data.records[0].data.nodeType) { case 'localParam' : @@ -383,7 +401,17 @@ Ext.define('amdaUI.DownloadUI', { case 'remoteSimuParam': idToSent = data.records[0].get('id'); if (data.records[0].get('alias')!= "" ) - var idToSent = "#"+data.records[0].get('alias'); + idToSent = "#"+data.records[0].get('alias'); + var component_info = data.records[0].get('component_info'); + if (component_info && component_info.parentId) { + //It's a component + idToSent = component_info.parentId; + components = []; + if (component_info.index1) + components['index1'] = component_info.index1; + if (component_info.index2) + components['index2'] = component_info.index2; + } break; case 'alias' : idToSent = "#"+data.records[0].get('text'); @@ -399,7 +427,7 @@ Ext.define('amdaUI.DownloadUI', { } var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); if (downModule) - downModule.addParam(idToSent,!data.records[0].get('leaf') || data.records[0].get('needsArgs')); + downModule.addParam(idToSent,data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); return true; } }); diff --git a/js/app/views/ParamArgumentsPlug.js b/js/app/views/ParamArgumentsPlug.js index 299195a..e4a2d76 100644 --- a/js/app/views/ParamArgumentsPlug.js +++ b/js/app/views/ParamArgumentsPlug.js @@ -134,7 +134,7 @@ Ext.define('amdaUI.ParamArgumentsPlug', { handler: function(bt,event) { //Set modification if (me.paramObject) - me.paramObject = me.paramArgs.paramRequestObject; + me.paramObject.data = me.paramArgs.paramRequestObject.data; if (me.onApply) me.onApply(me.hostCmp, me.paramArgs.paramRequestObject); me.close(); diff --git a/js/app/views/ParameterUI.js b/js/app/views/ParameterUI.js index a9a1075..0223c0b 100755 --- a/js/app/views/ParameterUI.js +++ b/js/app/views/ParameterUI.js @@ -46,17 +46,33 @@ Ext.define('amdaUI.ParameterUI', { uiScope.addParamInEditor(fullParam); }, - addParam : function(newParamName, isArgsToDefined) { - if (isArgsToDefined) - this.editParameterArgs(newParamName); + addParam : function(newParamName, isLeaf, needArgs, components) { + if (!isLeaf || needArgs || components) + this.editParameterArgs(newParamName, components); else this.addParamInEditor(newParamName); }, - editParameterArgs: function(name) { + editParameterArgs: function(name, components) { + var type = 0; + var dim1 = ''; + var dim2 = ''; + + if (components) { + if (components['index1']) { + dim1 = components['index1']; + ++type; + } + + if (components['index2']) { + dim2 = components['index2']; + ++type; + } + } + var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin'); if (paramArgsPlug) { - var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', {paramid: name, type: 0, dim1: '', dim2: '', template_args: {} }); + var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', {paramid: name, type: type, dim1: dim1, dim2: dim2, template_args: {} }); paramArgsPlug.show('derived-param-arguments-plugin', workinRequestParamObject); } }, @@ -279,6 +295,7 @@ Ext.define('amdaUI.ParameterUI', { if (!this.valid) return false; var nameToSent; + var components = null; switch (data.records[0].data.nodeType) { case 'localParam' : @@ -287,6 +304,16 @@ Ext.define('amdaUI.ParameterUI', { nameToSent = data.records[0].get('id'); if (data.records[0].get('alias')!= "" ) var nameToSent = "#"+data.records[0].get('alias'); + var component_info = data.records[0].get('component_info'); + if (component_info && component_info.parentId) { + //It's a component + nameToSent = component_info.parentId; + components = []; + if (component_info.index1) + components['index1'] = component_info.index1; + if (component_info.index2) + components['index2'] = component_info.index2; + } break; case 'alias' : nameToSent = "#"+data.records[0].get('text'); @@ -309,7 +336,7 @@ Ext.define('amdaUI.ParameterUI', { } var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); if (paramModule) { - paramModule.addParam(nameToSent, !data.records[0].get('leaf') || data.records[0].get('needsArgs')); + paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); } return true; } diff --git a/js/app/views/PlotComponents/PlotTree.js b/js/app/views/PlotComponents/PlotTree.js index 0a663a7..4ed5085 100644 --- a/js/app/views/PlotComponents/PlotTree.js +++ b/js/app/views/PlotComponents/PlotTree.js @@ -594,7 +594,7 @@ Ext.define('amdaPlotComp.PlotTree', { return false; }, - dropParamToCreate : function(targetNode, position, paramId, needsArgs, plotOnly) + dropParamToCreate : function(targetNode, position, paramId, paramComponents) { var panelObject = null; if (targetNode == null) @@ -628,7 +628,7 @@ Ext.define('amdaPlotComp.PlotTree', { //Create param object var me = this; - panelObject.createNewParam(paramId, function (newParamObject) { + panelObject.createNewParam(paramId, paramComponents, function (newParamObject) { //Rebuild params node me.buildPanelsNode(newParamObject.getId()); //BRE newParamObject @@ -653,19 +653,23 @@ Ext.define('amdaPlotComp.PlotTree', { if (!record.get('isParameter') || record.get('disable')) return false; - var needsArgs = false; - - if (record.$className == 'amdaModel.RemoteSimuParamNode') { - needsArgs = record.get('needsArgs'); - } - else if (record.$className == 'amdaModel.LocalParamNode') { - needsArgs = record.get('needsArgs') && !record.get('isSpectra'); + if (record.get('alias') != "" ) + this.dropParamToCreate(targetNode, position, "#"+record.get('alias')); + else { + var component_info = record.get('component_info'); + var param_id = record.get('id'); + var components = null; + if (component_info && component_info.parentId) { + //It's a component + param_id = component_info.parentId; + components = []; + if (component_info.index1) + components['index1'] = component_info.index1; + if (component_info.index2) + components['index2'] = component_info.index2; + } + this.dropParamToCreate(targetNode, position, param_id, components); } - - if (record.get('alias') != "" ) - this.dropParamToCreate(targetNode, position, "#"+record.get('alias'), needsArgs); - else - this.dropParamToCreate(targetNode, position, record.get('id'), needsArgs, record.get('notyet')); return true; case 'amdaModel.AliasNode' : if (!record.isLeaf()) diff --git a/js/app/views/SearchUI.js b/js/app/views/SearchUI.js index ebc2f4e..718b349 100755 --- a/js/app/views/SearchUI.js +++ b/js/app/views/SearchUI.js @@ -39,10 +39,9 @@ Ext.define('amdaUI.SearchUI', { // set TTTab this.timeSelector.setTTTab(TTarray); }, - - addParam : function(newParamName, isArgsToDefined) { - if (isArgsToDefined) - this.editParameterArgs(newParamName); + addParam : function(newParamName, isLeaf, needArgs, components) { + if (!isLeaf || needArgs || components) + this.editParameterArgs(newParamName, components); else this.addParamInEditor(newParamName); }, @@ -59,10 +58,26 @@ Ext.define('amdaUI.SearchUI', { uiScope.addParamInEditor(fullParam); }, - editParameterArgs: function(name) { + editParameterArgs: function(name, components) { + var type = 0; + var dim1 = ''; + var dim2 = ''; + + if (components) { + if (components['index1']) { + dim1 = components['index1']; + ++type; + } + + if (components['index2']) { + dim2 = components['index2']; + ++type; + } + } + var paramArgsPlug = this.getPlugin('search-param-components-plugin'); if (paramArgsPlug) { - var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', {paramid: name, type: 0, dim1: '', dim2: '', template_args: {} }); + var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', {paramid: name, type: type, dim1: dim1, dim2: dim2, template_args: {} }); paramArgsPlug.show('search-param-components-plugin', workinRequestParamObject); } }, @@ -322,6 +337,7 @@ Ext.define('amdaUI.SearchUI', { if (!this.valid) return false; var nameToSent; + var components = null; switch (data.records[0].get('nodeType')) { case 'localParam' : @@ -329,7 +345,17 @@ Ext.define('amdaUI.SearchUI', { case 'remoteSimuParam' : nameToSent = data.records[0].get('id'); if (data.records[0].get('alias')!= "" ) - var nameToSent = "#"+data.records[0].get('alias'); + nameToSent = "#"+data.records[0].get('alias'); + var component_info = data.records[0].get('component_info'); + if (component_info && component_info.parentId) { + //It's a component + nameToSent = component_info.parentId; + components = []; + if (component_info.index1) + components['index1'] = component_info.index1; + if (component_info.index2) + components['index2'] = component_info.index2; + } break; case 'alias' : nameToSent = "#"+data.records[0].get('text'); @@ -352,7 +378,7 @@ Ext.define('amdaUI.SearchUI', { var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); if (searchModule) - searchModule.addParam(nameToSent, !data.records[0].get('leaf') || data.records[0].get('needsArgs')); + searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); return true; } }); diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index d175b8e..efc3ffc 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -259,6 +259,7 @@ class AmdaAction { } + $component_info = array(); if ($child->tagName == 'component') { $isParameter = true; @@ -274,8 +275,14 @@ class AmdaAction { { $timeRestriction = true; - } - + } + + if ($child->hasAttribute("index1")) + $component_info["index1"] = $child->getAttribute('index1'); + if ($child->hasAttribute("index2")) + $component_info["index2"] = $child->getAttribute('index2'); + + $component_info["parentId"] = $child->parentNode->getAttribute('xml:id'); } if ($child->tagName == 'parameter' && $child->hasChildNodes()) $isScatter = false; @@ -325,7 +332,7 @@ class AmdaAction { $alias = $objectMgr->getAlias($id); $childrenToReturn[] = array('text' => $name,'alias' => $alias, - 'id' => $id,'nodeType' => $nodeType, 'info' => $info, + 'id' => $id,'nodeType' => $nodeType, 'info' => $info, "component_info" => $component_info, 'globalStart' => $globalStart, 'globalStop' => $globalStop, 'timeRestriction' => $timeRestriction, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'isScatter' => $isScatter, 'isSpectra' => $isSpectra,'isStack' => $isStack, 'needsArgs' => $needsArgs, 'help' => $help, 'notyet' => $not_yet); @@ -444,7 +451,7 @@ class AmdaAction { $childrenToReturn[] = array('text' => $name,'alias' => $alias, 'id' => $id,'nodeType' => $nodeType, 'info' => $info, 'help' => $help, 'leaf' => $isLeaf, 'disable' => $disable, 'isParameter' => $isParameter, - 'isScatter' => $isScatter, 'isSpectra' => $isSpectra, 'needsArgs' => $needsArgs); + 'isScatter' => $isScatter, 'isSpectra' => $isSpectra, 'needsArgs' => $needsArgs, "component_info" => $component_info); } else { if ($child->tagName == 'dataCenter') -- libgit2 0.21.2