Commit bf776dc8eeffc421a3c6accdb025ded3cd0cdbb2
1 parent
eb0ba55f
Exists in
master
and in
106 other branches
working
Showing
8 changed files
with
183 additions
and
16 deletions
Show diff stats
js/app/AmdaApp.js
js/app/controllers/ExplorerModule.js
... | ... | @@ -284,17 +284,40 @@ Ext.define('amdaDesktop.ExplorerModule', |
284 | 284 | } |
285 | 285 | }, this) |
286 | 286 | }, |
287 | - | |
288 | 287 | getParamInfo: function (paramId, onReady) { |
289 | - var me = this | |
290 | - | |
288 | + var me = this; | |
291 | 289 | if (this.paramInfoRegistry[paramId]) { |
292 | 290 | if (onReady) { |
293 | 291 | onReady(this.paramInfoRegistry[paramId]) |
294 | 292 | } |
295 | 293 | return this.paramInfoRegistry[paramId] |
296 | 294 | } |
295 | + var patt = new RegExp("ws_"); | |
296 | + if(patt.test(paramId)){ | |
297 | + /* case of derived parameter */ | |
298 | + AmdaAction.getDerivedParamInfo({paramId: paramId}, function (result, e) { | |
299 | + var paramInfo = null | |
300 | + if (e.status === true) { | |
301 | + // No available info for this parameter, do not display an error message if no success | |
302 | + if (result.success) { | |
303 | + // Store parameter info in registry | |
304 | + me.paramInfoRegistry[paramId] = result; | |
305 | + paramInfo = result | |
306 | + } | |
307 | + } else { | |
308 | + Ext.Msg.show({ | |
309 | + title: 'Error System', | |
310 | + msg: e.message, | |
311 | + icon: Ext.MessageBox.ERROR, | |
312 | + buttons: Ext.Msg.OK | |
313 | + }) | |
314 | + } | |
297 | 315 | |
316 | + if (onReady) { | |
317 | + onReady(paramInfo) | |
318 | + } | |
319 | + }) | |
320 | + }else{ | |
298 | 321 | AmdaAction.getParamInfo({paramId: paramId}, function (result, e) { |
299 | 322 | var paramInfo = null |
300 | 323 | if (e.status === true) { |
... | ... | @@ -302,6 +325,7 @@ Ext.define('amdaDesktop.ExplorerModule', |
302 | 325 | if (result.success) { |
303 | 326 | // Store parameter info in registry |
304 | 327 | me.paramInfoRegistry[paramId] = result |
328 | + console.log(result); | |
305 | 329 | paramInfo = result |
306 | 330 | } |
307 | 331 | } else { |
... | ... | @@ -317,6 +341,7 @@ Ext.define('amdaDesktop.ExplorerModule', |
317 | 341 | onReady(paramInfo) |
318 | 342 | } |
319 | 343 | }) |
344 | + } | |
320 | 345 | |
321 | 346 | return null |
322 | 347 | } | ... | ... |
js/app/models/DerivedParamNode.js
... | ... | @@ -8,6 +8,23 @@ |
8 | 8 | * @version $Id: DerivedParamNode.js 2544 2014-10-03 10:21:56Z elena $ |
9 | 9 | */ |
10 | 10 | |
11 | +Ext.define('amdaModel.DerivedParamComponentNode', { | |
12 | + extend: 'Ext.data.Model', | |
13 | + | |
14 | + text: '', | |
15 | + | |
16 | + constructor : function(config) | |
17 | + { | |
18 | + this.callParent(arguments); | |
19 | + this.set('text', config && config.text ? config.text : this.text); | |
20 | + this.set('iconCls', 'icon-scalar'); | |
21 | + this.set('leaf',true); | |
22 | + this.set('isParameter',true); | |
23 | + } | |
24 | +}, function () { | |
25 | + Ext.data.NodeInterface.decorate(this); | |
26 | +}); | |
27 | + | |
11 | 28 | Ext.define('amdaModel.DerivedParamNode', { |
12 | 29 | extend: 'amdaModel.InteractiveNode', |
13 | 30 | |
... | ... | @@ -29,17 +46,37 @@ Ext.define('amdaModel.DerivedParamNode', { |
29 | 46 | this.set('objectDataModel',amdaModel.Parameter.$className); |
30 | 47 | this.set('ownerTreeId',amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); |
31 | 48 | this.updateIcon(); |
49 | + this.updateComponents(); | |
32 | 50 | }, |
33 | 51 | |
34 | 52 | updateIcon: function() { |
35 | 53 | if (this.get('isParameter')) { |
36 | 54 | if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3)){ |
37 | 55 | this.set('iconCls', 'icon-vector'); |
56 | + } else if( (this.get('dim_1') == 2 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 2)){ | |
57 | + this.set('iconCls', 'icon-vector'); | |
58 | + | |
38 | 59 | } else if ( (this.get('dim_1') > 1 && this.get('dim_2') >=1)|| (this.get('dim_1') >=1 && this.get('dim_2') >1)) { |
39 | 60 | this.set('iconCls','icon-spectra'); |
40 | - } else { | |
41 | - this.set('iconCls', 'icon-unknowntype'); | |
42 | - } | |
61 | + } else { | |
62 | + this.set('iconCls', 'icon-scalar'); | |
63 | + } | |
64 | + } | |
65 | + }, | |
66 | + | |
67 | + updateComponents: function() { | |
68 | + this.removeAll(); | |
69 | + if (!this.get('isParameter')) { | |
70 | + return; | |
71 | + } | |
72 | + | |
73 | + if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3) || | |
74 | + (this.get('dim_1') == 2 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 2)) { | |
75 | + for (var i = 0; i < this.get('dim_1') *this.get('dim_2'); ++i) { | |
76 | + var ch=new amdaModel.DerivedParamComponentNode({text: this.get('text') + '(' + i + ')'}); | |
77 | + ch.set('nodeType','derivedParam'); | |
78 | + this.appendChild(ch); | |
79 | + } | |
43 | 80 | } |
44 | 81 | }, |
45 | 82 | |
... | ... | @@ -78,6 +115,7 @@ specialUpdate : function(res, timeUpdate) { |
78 | 115 | } |
79 | 116 | |
80 | 117 | this.updateIcon(); |
118 | + this.updateComponents(); | |
81 | 119 | } |
82 | 120 | |
83 | 121 | }); | ... | ... |
js/app/views/DownloadUI.js
... | ... | @@ -121,8 +121,8 @@ Ext.define('amdaUI.DownloadUI', { |
121 | 121 | var pos = this.paramGrid.store.getCount(); |
122 | 122 | this.paramGrid.store.insert(pos,r); |
123 | 123 | this.paramGrid.getView().refresh(); |
124 | - if (!isLeaf || needArgs) | |
125 | - this.editParameterArgs(r); | |
124 | + //if (!isLeaf || needArgs) | |
125 | + //this.editParameterArgs(r); | |
126 | 126 | }, |
127 | 127 | |
128 | 128 | addParams: function(arrayParams) | ... | ... |
js/app/views/ParamArgumentsUI.js
... | ... | @@ -55,6 +55,7 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
55 | 55 | onReady(uiScope); |
56 | 56 | me.unmask(); |
57 | 57 | }); |
58 | + | |
58 | 59 | } |
59 | 60 | else |
60 | 61 | me.unmask(); |
... | ... | @@ -432,4 +433,4 @@ Ext.define('amdaUI.ParamArgumentsUI', { |
432 | 433 | } |
433 | 434 | }); |
434 | 435 | } |
435 | -}); | |
436 | 436 | \ No newline at end of file |
437 | +}); | ... | ... |
js/app/views/PlotComponents/PlotTree.js
... | ... | @@ -549,15 +549,20 @@ Ext.define('amdaPlotComp.PlotTree', { |
549 | 549 | isValidToDrop : function(record,targetNode,position) |
550 | 550 | { |
551 | 551 | switch (record.$className) |
552 | + | |
552 | 553 | { |
553 | 554 | case 'amdaModel.LocalParamNode' : |
554 | 555 | case 'amdaModel.RemoteParamNode' : |
555 | 556 | case 'amdaModel.RemoteSimuParamNode' : |
556 | 557 | return record.get('isParameter') && ! record.get('disable'); |
557 | - case 'amdaModel.AliasNode' : | |
558 | - case 'amdaModel.DerivedParamNode' : | |
558 | + | |
559 | + case 'amdaModel.DerivedParamNode' : | |
560 | + case 'amdaModel.DerivedParamComponentNode': | |
561 | + return record.get('isParameter') ; | |
562 | + case 'amdaModel.AliasNode' : | |
559 | 563 | case 'amdaModel.MyDataParamNode' : |
560 | 564 | return record.isLeaf(); |
565 | + | |
561 | 566 | case 'amdaPlotObj.PlotParamTreeNode' : |
562 | 567 | var fromPanelObject = null; |
563 | 568 | if (!this.tabObject.get('tree-simplified-view')) |
... | ... | @@ -588,7 +593,7 @@ Ext.define('amdaPlotComp.PlotTree', { |
588 | 593 | if (toPanelObject == null) |
589 | 594 | return false; |
590 | 595 | return (fromPanelObject.get('panel-plot-type') == toPanelObject.get('panel-plot-type')); |
591 | - case 'amdaPlotObj.PlotPanelTreeNode' : | |
596 | + case 'amdaPlotObj.PlotPanelTreeNode' : | |
592 | 597 | switch (position) |
593 | 598 | { |
594 | 599 | case 'append' : |
... | ... | @@ -687,8 +692,10 @@ Ext.define('amdaPlotComp.PlotTree', { |
687 | 692 | this.dropParamToCreate(targetNode, position, "#"+record.get('text')); |
688 | 693 | return true; |
689 | 694 | case 'amdaModel.DerivedParamNode' : |
690 | - if (!record.isLeaf()) | |
695 | + case 'amdaModel.DerivedParamComponentNode': | |
696 | + if (!record.get('isParameter')) | |
691 | 697 | return false; |
698 | + //targetNode, position, paramId, paramComponents, isVector, plotOnly | |
692 | 699 | this.dropParamToCreate(targetNode, position, "ws_"+record.get('text')); |
693 | 700 | return true; |
694 | 701 | case 'amdaModel.MyDataParamNode' : |
... | ... | @@ -755,7 +762,7 @@ Ext.define('amdaPlotComp.PlotTree', { |
755 | 762 | if (dataLength > 1) |
756 | 763 | return false; |
757 | 764 | var draggedRecord = draggedRecords[0]; |
758 | - | |
765 | + console.log(me.isValidToDrop(draggedRecord,targetNode,position)); | |
759 | 766 | return me.isValidToDrop(draggedRecord,targetNode,position); |
760 | 767 | }, |
761 | 768 | onPlotContainerDrop : function(dd, e, data){ | ... | ... |
php/classes/AmdaAction.php
... | ... | @@ -952,7 +952,7 @@ class AmdaAction |
952 | 952 | */ |
953 | 953 | public function compilParam($obj) |
954 | 954 | { |
955 | -error_log(print_r($obj,TRUE)); | |
955 | +//error_log(print_r($obj,TRUE)); | |
956 | 956 | return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN); |
957 | 957 | } |
958 | 958 | |
... | ... | @@ -1403,7 +1403,102 @@ error_log(print_r($obj,TRUE)); |
1403 | 1403 | ); |
1404 | 1404 | return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO); |
1405 | 1405 | } |
1406 | + public function getDerivedParamInfo($obj) | |
1407 | + { | |
1408 | + $dom = new DomDocument("1.0"); | |
1409 | + $xmlName=USERWSDIR.$this->xmlFiles['derivedParam']; | |
1410 | + @$dom->load($xmlName); | |
1411 | + $params=$dom->getElementsByTagName("param"); | |
1412 | + foreach($params as $param) | |
1413 | + { | |
1414 | + if($param->hasAttribute("name") && ("ws_" . ($param->getAttribute("name")))==$obj->paramId) | |
1415 | + { | |
1416 | + $dim_1=$param->getAttribute("dim_1"); | |
1417 | + $dim_2=$param->getAttribute("dim_2"); | |
1418 | + return $this->createDerivedParamInfo($dim_1,$dim_2,$obj->paramId); | |
1419 | + } | |
1420 | + | |
1421 | + } | |
1422 | + return array('success'=>false, 'message'=>'unkown parameter (derived parameter arguments are not handled)'); | |
1423 | + } | |
1424 | + | |
1425 | + public function createDerivedParamInfo($dim_1,$dim_2,$paramId) | |
1426 | + { | |
1427 | + /* case of constant */ | |
1428 | + if($dim_1*$dim_2==1) | |
1429 | + { | |
1430 | + return array('success'=>false,'msg'=>"dim1=1 dim2=1 no arguments for this parameter"); | |
1431 | + }elseif(($dim_1==1 && $dim_2>1 && $dim_2<=3)||($dim_2==1 && $dim_1>1 && $dim_1<=3) ) | |
1432 | + /* case of vector */ | |
1433 | + { | |
1434 | + | |
1435 | + $dims=array( | |
1436 | + 'dim1'=>$dim_1, | |
1437 | + 'dim2'=>$dim_2 | |
1438 | + ); | |
1439 | + | |
1440 | + $compts=array(); | |
1441 | + | |
1442 | + for($i=0;$i<($dim_1*$dim_2);++$i) | |
1443 | + { | |
1444 | + | |
1445 | + $c=array( | |
1446 | + | |
1447 | + 'index_1'=>($dim_1>$dim_2)?(string)$i:"", | |
1448 | + 'index_2'=>($dim_1<$dim_2)?$i:"", | |
1449 | + 'name'=>$paramId.'('.$i.')' | |
1450 | + ); | |
1451 | + array_push($compts,$c); | |
1452 | + | |
1453 | + } | |
1454 | + | |
1455 | + $data=array( | |
1456 | + 'dimensions'=>$dims, | |
1457 | + 'components'=>$compts | |
1458 | + ); | |
1459 | + | |
1406 | 1460 | |
1461 | + return array('success'=>true,'data'=>$data); | |
1462 | + }else | |
1463 | + /* case of spectro*/ | |
1464 | + { | |
1465 | + $sizes=array($dim_1,$dim_2); | |
1466 | + $dims=array( | |
1467 | + 'dim1'=>$dim_1, | |
1468 | + 'dim2'=>$dim_2 | |
1469 | + ); | |
1470 | + $channels=array(); | |
1471 | + $tables=array(); | |
1472 | + for($j=0;$j<count($sizes);$j++) | |
1473 | + { | |
1474 | + $compts=array(); | |
1475 | + | |
1476 | + for($i=0;$i<$sizes[$j];$i++) | |
1477 | + { | |
1478 | + $c=array('min'=>'L' . $i,'max'=>'L' . ($i+1)); | |
1479 | + array_push($compts,$c); | |
1480 | + } | |
1481 | + | |
1482 | + $tab=array( | |
1483 | + 'relatedDim'=>'dim' . ($j+1), | |
1484 | + 'name'=>'component' . ($j+1), | |
1485 | + 'units'=>"", | |
1486 | + 'variable'=>"", | |
1487 | + 'channels'=>$compts, | |
1488 | + 'minmax'=>"" | |
1489 | + ); | |
1490 | + | |
1491 | + array_push($tables,$tab); | |
1492 | + } | |
1493 | + | |
1494 | + $data=array( | |
1495 | + 'dimensions'=>$dims, | |
1496 | + 'tables'=>$tables | |
1497 | + ); | |
1498 | + return array('success'=>true,'data'=>$data); | |
1499 | + } | |
1500 | + | |
1501 | + } | |
1407 | 1502 | public function getSharedObjectFolders($obj) |
1408 | 1503 | { |
1409 | 1504 | $mgr = new SharedObjectsMgr(); | ... | ... |
php/config.php
... | ... | @@ -192,6 +192,7 @@ $API = array( |
192 | 192 | 'interactivePlot'=>array('len'=>2), |
193 | 193 | 'getParamPlotInit'=>array('len'=>1), |
194 | 194 | 'getParamInfo'=>array('len'=>1), |
195 | + 'getDerivedParamInfo'=>array('len'=>1), | |
195 | 196 | 'getSharedObjectFolders' => array('len'=>1), |
196 | 197 | 'shareObjects' => array('len'=>1), |
197 | 198 | 'isSharedObjectNameAlreadyUsed' => array('len'=>1), | ... | ... |