diff --git a/js/app/AmdaApp.js b/js/app/AmdaApp.js index f97ad59..72cf34b 100755 --- a/js/app/AmdaApp.js +++ b/js/app/AmdaApp.js @@ -18,7 +18,7 @@ Ext.define('amdaApp.AmdaApp', { 'MyDesktop.Settings' ], - Modules: { + dynamicModules: { visu : { id : 'visu-win', icon : 'icon-visu_catalog', diff --git a/js/app/controllers/ExplorerModule.js b/js/app/controllers/ExplorerModule.js index 7be1d17..b4271ea 100644 --- a/js/app/controllers/ExplorerModule.js +++ b/js/app/controllers/ExplorerModule.js @@ -284,17 +284,40 @@ Ext.define('amdaDesktop.ExplorerModule', } }, this) }, - getParamInfo: function (paramId, onReady) { - var me = this - + var me = this; if (this.paramInfoRegistry[paramId]) { if (onReady) { onReady(this.paramInfoRegistry[paramId]) } return this.paramInfoRegistry[paramId] } + var patt = new RegExp("ws_"); + if(patt.test(paramId)){ + /* case of derived parameter */ + AmdaAction.getDerivedParamInfo({paramId: paramId}, function (result, e) { + var paramInfo = null + if (e.status === true) { + // No available info for this parameter, do not display an error message if no success + if (result.success) { + // Store parameter info in registry + me.paramInfoRegistry[paramId] = result; + paramInfo = result + } + } else { + Ext.Msg.show({ + title: 'Error System', + msg: e.message, + icon: Ext.MessageBox.ERROR, + buttons: Ext.Msg.OK + }) + } + if (onReady) { + onReady(paramInfo) + } + }) + }else{ AmdaAction.getParamInfo({paramId: paramId}, function (result, e) { var paramInfo = null if (e.status === true) { @@ -302,6 +325,7 @@ Ext.define('amdaDesktop.ExplorerModule', if (result.success) { // Store parameter info in registry me.paramInfoRegistry[paramId] = result + console.log(result); paramInfo = result } } else { @@ -317,6 +341,7 @@ Ext.define('amdaDesktop.ExplorerModule', onReady(paramInfo) } }) + } return null } diff --git a/js/app/models/DerivedParamNode.js b/js/app/models/DerivedParamNode.js index 3895038..7190a68 100644 --- a/js/app/models/DerivedParamNode.js +++ b/js/app/models/DerivedParamNode.js @@ -8,6 +8,23 @@ * @version $Id: DerivedParamNode.js 2544 2014-10-03 10:21:56Z elena $ */ +Ext.define('amdaModel.DerivedParamComponentNode', { + extend: 'Ext.data.Model', + + text: '', + + constructor : function(config) + { + this.callParent(arguments); + this.set('text', config && config.text ? config.text : this.text); + this.set('iconCls', 'icon-scalar'); + this.set('leaf',true); + this.set('isParameter',true); + } +}, function () { + Ext.data.NodeInterface.decorate(this); +}); + Ext.define('amdaModel.DerivedParamNode', { extend: 'amdaModel.InteractiveNode', @@ -29,17 +46,37 @@ Ext.define('amdaModel.DerivedParamNode', { this.set('objectDataModel',amdaModel.Parameter.$className); this.set('ownerTreeId',amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); this.updateIcon(); + this.updateComponents(); }, updateIcon: function() { if (this.get('isParameter')) { if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3)){ this.set('iconCls', 'icon-vector'); + } else if( (this.get('dim_1') == 2 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 2)){ + this.set('iconCls', 'icon-vector'); + } else if ( (this.get('dim_1') > 1 && this.get('dim_2') >=1)|| (this.get('dim_1') >=1 && this.get('dim_2') >1)) { this.set('iconCls','icon-spectra'); - } else { - this.set('iconCls', 'icon-unknowntype'); - } + } else { + this.set('iconCls', 'icon-scalar'); + } + } + }, + + updateComponents: function() { + this.removeAll(); + if (!this.get('isParameter')) { + return; + } + + if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3) || + (this.get('dim_1') == 2 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 2)) { + for (var i = 0; i < this.get('dim_1') *this.get('dim_2'); ++i) { + var ch=new amdaModel.DerivedParamComponentNode({text: this.get('text') + '(' + i + ')'}); + ch.set('nodeType','derivedParam'); + this.appendChild(ch); + } } }, @@ -78,6 +115,7 @@ specialUpdate : function(res, timeUpdate) { } this.updateIcon(); + this.updateComponents(); } }); diff --git a/js/app/views/DownloadUI.js b/js/app/views/DownloadUI.js index d82a859..f5dcec2 100644 --- a/js/app/views/DownloadUI.js +++ b/js/app/views/DownloadUI.js @@ -121,8 +121,8 @@ Ext.define('amdaUI.DownloadUI', { var pos = this.paramGrid.store.getCount(); this.paramGrid.store.insert(pos,r); this.paramGrid.getView().refresh(); - if (!isLeaf || needArgs) - this.editParameterArgs(r); + //if (!isLeaf || needArgs) + //this.editParameterArgs(r); }, addParams: function(arrayParams) diff --git a/js/app/views/ParamArgumentsUI.js b/js/app/views/ParamArgumentsUI.js index cf0562b..a9ee55e 100644 --- a/js/app/views/ParamArgumentsUI.js +++ b/js/app/views/ParamArgumentsUI.js @@ -55,6 +55,7 @@ Ext.define('amdaUI.ParamArgumentsUI', { onReady(uiScope); me.unmask(); }); + } else me.unmask(); @@ -432,4 +433,4 @@ Ext.define('amdaUI.ParamArgumentsUI', { } }); } -}); \ No newline at end of file +}); diff --git a/js/app/views/PlotComponents/PlotTree.js b/js/app/views/PlotComponents/PlotTree.js index 69f6a44..91fee96 100644 --- a/js/app/views/PlotComponents/PlotTree.js +++ b/js/app/views/PlotComponents/PlotTree.js @@ -549,15 +549,20 @@ Ext.define('amdaPlotComp.PlotTree', { isValidToDrop : function(record,targetNode,position) { switch (record.$className) + { case 'amdaModel.LocalParamNode' : case 'amdaModel.RemoteParamNode' : case 'amdaModel.RemoteSimuParamNode' : return record.get('isParameter') && ! record.get('disable'); - case 'amdaModel.AliasNode' : - case 'amdaModel.DerivedParamNode' : + + case 'amdaModel.DerivedParamNode' : + case 'amdaModel.DerivedParamComponentNode': + return record.get('isParameter') ; + case 'amdaModel.AliasNode' : case 'amdaModel.MyDataParamNode' : return record.isLeaf(); + case 'amdaPlotObj.PlotParamTreeNode' : var fromPanelObject = null; if (!this.tabObject.get('tree-simplified-view')) @@ -588,7 +593,7 @@ Ext.define('amdaPlotComp.PlotTree', { if (toPanelObject == null) return false; return (fromPanelObject.get('panel-plot-type') == toPanelObject.get('panel-plot-type')); - case 'amdaPlotObj.PlotPanelTreeNode' : + case 'amdaPlotObj.PlotPanelTreeNode' : switch (position) { case 'append' : @@ -687,8 +692,10 @@ Ext.define('amdaPlotComp.PlotTree', { this.dropParamToCreate(targetNode, position, "#"+record.get('text')); return true; case 'amdaModel.DerivedParamNode' : - if (!record.isLeaf()) + case 'amdaModel.DerivedParamComponentNode': + if (!record.get('isParameter')) return false; + //targetNode, position, paramId, paramComponents, isVector, plotOnly this.dropParamToCreate(targetNode, position, "ws_"+record.get('text')); return true; case 'amdaModel.MyDataParamNode' : @@ -755,7 +762,7 @@ Ext.define('amdaPlotComp.PlotTree', { if (dataLength > 1) return false; var draggedRecord = draggedRecords[0]; - + console.log(me.isValidToDrop(draggedRecord,targetNode,position)); return me.isValidToDrop(draggedRecord,targetNode,position); }, onPlotContainerDrop : function(dd, e, data){ diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index 1b98e0b..6cd3a0a 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -952,7 +952,7 @@ class AmdaAction */ public function compilParam($obj) { -error_log(print_r($obj,TRUE)); +//error_log(print_r($obj,TRUE)); return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN); } @@ -1403,7 +1403,102 @@ error_log(print_r($obj,TRUE)); ); return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO); } + public function getDerivedParamInfo($obj) + { + $dom = new DomDocument("1.0"); + $xmlName=USERWSDIR.$this->xmlFiles['derivedParam']; + @$dom->load($xmlName); + $params=$dom->getElementsByTagName("param"); + foreach($params as $param) + { + if($param->hasAttribute("name") && ("ws_" . ($param->getAttribute("name")))==$obj->paramId) + { + $dim_1=$param->getAttribute("dim_1"); + $dim_2=$param->getAttribute("dim_2"); + return $this->createDerivedParamInfo($dim_1,$dim_2,$obj->paramId); + } + + } + return array('success'=>false, 'message'=>'unkown parameter (derived parameter arguments are not handled)'); + } + + public function createDerivedParamInfo($dim_1,$dim_2,$paramId) + { + /* case of constant */ + if($dim_1*$dim_2==1) + { + return array('success'=>false,'msg'=>"dim1=1 dim2=1 no arguments for this parameter"); + }elseif(($dim_1==1 && $dim_2>1 && $dim_2<=3)||($dim_2==1 && $dim_1>1 && $dim_1<=3) ) + /* case of vector */ + { + + $dims=array( + 'dim1'=>$dim_1, + 'dim2'=>$dim_2 + ); + + $compts=array(); + + for($i=0;$i<($dim_1*$dim_2);++$i) + { + + $c=array( + + 'index_1'=>($dim_1>$dim_2)?(string)$i:"", + 'index_2'=>($dim_1<$dim_2)?$i:"", + 'name'=>$paramId.'('.$i.')' + ); + array_push($compts,$c); + + } + + $data=array( + 'dimensions'=>$dims, + 'components'=>$compts + ); + + return array('success'=>true,'data'=>$data); + }else + /* case of spectro*/ + { + $sizes=array($dim_1,$dim_2); + $dims=array( + 'dim1'=>$dim_1, + 'dim2'=>$dim_2 + ); + $channels=array(); + $tables=array(); + for($j=0;$j'L' . $i,'max'=>'L' . ($i+1)); + array_push($compts,$c); + } + + $tab=array( + 'relatedDim'=>'dim' . ($j+1), + 'name'=>'component' . ($j+1), + 'units'=>"", + 'variable'=>"", + 'channels'=>$compts, + 'minmax'=>"" + ); + + array_push($tables,$tab); + } + + $data=array( + 'dimensions'=>$dims, + 'tables'=>$tables + ); + return array('success'=>true,'data'=>$data); + } + + } public function getSharedObjectFolders($obj) { $mgr = new SharedObjectsMgr(); diff --git a/php/config.php b/php/config.php index d89cb36..acecc8b 100644 --- a/php/config.php +++ b/php/config.php @@ -192,6 +192,7 @@ $API = array( 'interactivePlot'=>array('len'=>2), 'getParamPlotInit'=>array('len'=>1), 'getParamInfo'=>array('len'=>1), + 'getDerivedParamInfo'=>array('len'=>1), 'getSharedObjectFolders' => array('len'=>1), 'shareObjects' => array('len'=>1), 'isSharedObjectNameAlreadyUsed' => array('len'=>1), -- libgit2 0.21.2