Commit 392deec47ae45980d4780401afe8b99a4063f075

Authored by Myriam Bouchemit
2 parents 4c9f2507 29d26495

Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM

js/app/controllers/CatalogModule.js
... ... @@ -3,27 +3,27 @@
3 3 * Name CatalogModule.js
4 4 * @class amdaDesktop.CatalogModule
5 5 * @extends amdaDesktop.InteractiveModule
6   - * @brief Catalog Module controller definition
  6 + * @brief Catalog Module controller definition
7 7 * @author elena
8 8 */
9 9  
10 10 Ext.define('amdaDesktop.CatalogModule', {
11 11 extend: 'amdaDesktop.InteractiveModule',
12   -
  12 +
13 13 requires: [
14 14 'amdaUI.CatalogUI',
15 15 'amdaUI.ShareObjectUI'
16 16 ],
17   -
  17 +
18 18 contentId : 'catalogUI',
19 19 isOperationOnShow : true,
20   -
  20 +
21 21 /**
22 22 * @cfg {String} data models
23 23 * @required
24 24 */
25 25 nodeDataModel : 'amdaModel.CatalogNode',
26   -
  26 +
27 27 /**
28 28 * @cfg {String} window definitions
29 29 * @required
... ... @@ -33,9 +33,9 @@ Ext.define('amdaDesktop.CatalogModule', {
33 33 uiType : 'panelCatalog',
34 34 helpTitle : 'Help on Catalog Module',
35 35 helpFile : 'catalogHelp',
36   -
  36 +
37 37 shareCatalog : function(catObj) {
38   - var win = myDesktopApp.desktop.getWindow('sharecat-win');
  38 + var win = myDesktopApp.desktop.getWindow('sharecat-win');
39 39 if(!win)
40 40 {
41 41 var me = this;
... ... @@ -54,7 +54,7 @@ Ext.define('amdaDesktop.CatalogModule', {
54 54 id : 'shareCatUI',
55 55 onAfterShareObject : function(folder_id, object_id) {
56 56 win.close();
57   - var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
  57 + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
58 58 var sharedCatRootNode = explorerTree.getRootNode().findChild('id','sharedcatalog-treeRootNode',true);
59 59 amdaModel.InteractiveNode.preloadNodes(sharedCatRootNode, function() {
60 60 sharedCatRootNode.expand();
... ... @@ -72,20 +72,20 @@ Ext.define('amdaDesktop.CatalogModule', {
72 72 }
73 73 }
74 74 ]
75   - });
  75 + });
76 76 }
77   -
  77 +
78 78 var sharePanel = win.down('#shareCatUI');
79 79 if (sharePanel)
80 80 sharePanel.setProperties('catalog', catObj);
81   -
  81 +
82 82 AmdaAction.getObject(catObj.id, 'catalog', function(result,remoteEvent) {
83 83 if (result) {
84 84 if (result.description)
85 85 sharePanel.setDescription(result.description);
86   - }
  86 + }
87 87 }, this.getObjectCallback, this);
88   -
  88 +
89 89 win.show();
90 90 }
91 91  
... ...
js/app/controllers/VisuModule.js
... ... @@ -3,25 +3,25 @@
3 3 * Name VisuModule.js
4 4 * @class amdaDesktop.VisuModule
5 5 * @extends amdaDesktop.InteractiveModule
6   - * @brief Visualization Module controller definition
  6 + * @brief Visualization Module controller definition
7 7 * @author elena
8 8 */
9 9  
10 10 Ext.define('amdaDesktop.VisuModule', {
11 11 extend: 'amdaDesktop.InteractiveModule',
12   -
  12 +
13 13 requires: [
14 14 'amdaUI.VisuUI'
15 15 ],
16   -
  16 +
17 17 contentId : 'visuUI',
18   -
  18 +
19 19 /**
20 20 * @cfg {String} data models
21 21 * @required
22 22 */
23 23 nodeDataModel : 'amdaModel.CatalogNode', // 'amdaModel.MyDataNode'
24   -
  24 +
25 25 /**
26 26 * @cfg {String} window definitions
27 27 * @required
... ... @@ -30,6 +30,15 @@ Ext.define('amdaDesktop.VisuModule', {
30 30 height: 700,
31 31 uiType : 'panelVisu',
32 32 helpTitle : 'Help on Visualization Module',
33   - helpFile : 'visuHelp'
34   -
  33 + helpFile : 'visuHelp',
  34 +
  35 + visualize : function(catObj) {
  36 + var temporaryNode = Ext.create('amdaModel.CatalogNode', {leaf: true});
  37 + if (temporaryNode)
  38 + temporaryNode.set('object', catObj);
  39 + this.setLinkedNode(temporaryNode);
  40 +
  41 + this.createWindow();
  42 + }
  43 +
35 44 });
... ...
js/app/models/CatalogNode.js
1   -/**
  1 +/**
2 2 * Project : AMDA-NG
3 3 * Name : CatalogNode.js
4 4 * @class amdaModel.CatalogNode
... ... @@ -10,20 +10,20 @@
10 10 Ext.define('amdaModel.CatalogNode', {
11 11  
12 12 extend: 'amdaModel.TimeTableNode',
13   -
  13 +
14 14 statics: {
15 15 nodeType: 'catalog',
16 16 objectName: 'Catalog'
17 17 },
18 18  
19 19 constructor : function(config)
20   - {
  20 + {
21 21 this.callParent(arguments)
22 22 this.set('moduleId',myDesktopApp.dynamicModules.catalog.id);
23 23 this.set('objectDataModel',amdaModel.Catalog.$className);
24 24 if (this.get('leaf')) this.set('iconCls', 'icon-catalog');
25 25 },
26   -
  26 +
27 27 localMenuItems : function() {
28 28 var menuItems =
29 29 [
... ... @@ -45,7 +45,7 @@ Ext.define('amdaModel.CatalogNode', {
45 45 hidden : true
46 46 }
47 47 ];
48   -
  48 +
49 49 return menuItems;
50 50 },
51 51  
... ... @@ -58,26 +58,62 @@ Ext.define('amdaModel.CatalogNode', {
58 58 fnId : 'mult-downloadMulti',
59 59 text : 'Download selected '+this.self.objectName+'s'
60 60 }];
61   -
  61 +
62 62 return menuItems;
63 63 },
64 64  
65   - shareNode: function(node) {
  65 + shareNode: function(node) {
66 66 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id, true, function (module) {
67 67 module.shareCatalog({'name' : node.get('text'), 'id' : node.get('id')});
68 68 });
69 69 },
70   -
71   - visu : function(contextNode) {
72   - var me = this;
73   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) {
74   - // Catalog & TimeTable nodes normally use no objects in the tree
75   - var obj = {'id' : me.get('id'), 'name' : me.get('text') };
76   - object = Ext.create(me.get('objectDataModel'), obj);
77   - me.set('object',object);
78   - module.setLinkedNode(me);
79   - module.createWindow();
  70 +
  71 + visu : function(node) {
  72 + var me = this;
  73 +
  74 + var visuWinFunc = function(object) {
  75 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) {
  76 + module.visualize(object);
  77 + });
  78 + };
  79 +
  80 + amdaModel.InteractiveNode.preloadNodes(this.getRootNode(),
  81 + function()
  82 + {
  83 + if (me.get('object')) {
  84 + visuWinFunc(me.get('object'));
  85 + }
  86 + else
  87 + {
  88 + AmdaAction.getObject(me.get('id'), me.get('nodeType'), function (result,remoteEvent) {
  89 + var t = remoteEvent.getTransaction();
  90 +
  91 + if (result) {
  92 + var paramObj = Ext.create(me.get('objectDataModel'), result);
  93 + // set parameter into node
  94 + me.set('object',paramObj);
  95 + // Edition of parameter into parameter Module
  96 + visuWinFunc(me.get('object'));
  97 + }
  98 + else {
  99 + myDesktopApp.errorMsg(t.action + "." + t.method + " : No catalog '"
  100 + + this.get('name') + "' found!");
  101 + }
  102 + }, me);
  103 + }
80 104 });
  105 +
  106 +
  107 + //var me = this;
  108 + //myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) {
  109 + // module.visualize(me);
  110 + // Catalog & TimeTable nodes normally use no objects in the tree
  111 +/* var obj = {'id' : me.get('id'), 'name' : me.get('text') };
  112 + object = Ext.create(me.get('objectDataModel'), obj);
  113 + me.set('object',object);
  114 + module.setLinkedNode(me);
  115 + module.createWindow();*/
  116 + //});
81 117 },
82 118 generateTT: function(node){
83 119 var catObj = Ext.create('amdaModel.TimeTable');
... ... @@ -96,7 +132,7 @@ Ext.define('amdaModel.CatalogNode', {
96 132 // edit newNode into Parameter Module with node as contextNode
97 133 timeTabNode.editInModule();
98 134 });
99   -
100   -
  135 +
  136 +
101 137 }
102 138 });
... ...
js/app/views/CatalogUI.js
... ... @@ -161,7 +161,7 @@ Ext.define('amdaUI.CatalogUI', {
161 161 timeTabNode.editInModule();
162 162 });
163 163 },
164   - // Convert UTC date to client local date
  164 + // Convert UTC date to client local date
165 165 convertUTCDateToLocalDate: function (date) {
166 166 if (date == null) {
167 167 return date;
... ... @@ -1000,13 +1000,7 @@ Ext.define('amdaUI.CatalogUI', {
1000 1000 handler: function () {
1001 1001 var me = this;
1002 1002 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) {
1003   - //temporary linked node - as Visu module is 'pseudo' interactive - no 'save', no 'execute'
1004   - var temporaryNode = Ext.create('amdaModel.CatalogNode', {leaf: true});
1005   - if (temporaryNode)
1006   - temporaryNode.set('object', me.object);
1007   - module.setLinkedNode(temporaryNode);
1008   -
1009   - module.createWindow();
  1003 + module.visualize(me.object);
1010 1004 });
1011 1005 }
1012 1006 }
... ...
js/app/views/CatalogVisuHistogram.js 0 โ†’ 100644
... ... @@ -0,0 +1,215 @@
  1 +/**
  2 + * Project AMDA-NG
  3 + * Name CatalogVisuHistogram.js
  4 + * @class amdaUI.CatalogVisuHistogram
  5 + * @extends Ext.container.Container
  6 + * @brief Histogram Visualization Module UI definition (View)
  7 + * @author elena
  8 + */
  9 +
  10 +Ext.define('amdaUI.CatalogVisuHistogram', {
  11 + extend: 'Ext.form.Panel',
  12 + alias: 'widget.panelCatalogVisuHistogram',
  13 + histogramStore: null,
  14 +
  15 + constructor: function(config) {
  16 + this.init(config);
  17 + this.callParent(arguments);
  18 + },
  19 +
  20 + getChartConfig: function(catalogStore) {
  21 + var paramOpt = {
  22 + paramId: '',
  23 + title: 'Parameter'
  24 + };
  25 +
  26 + var paramField = Ext.getCmp('visu-histo-param');
  27 + var paramFieldId = paramField.getValue();
  28 + if (paramFieldId && (paramFieldId != "")) {
  29 + var paramField = paramField.getStore().getById(paramFieldId);
  30 + if (paramField) {
  31 + paramOpt.paramId = paramField.get('id');
  32 + paramOpt.title = paramField.get('name');
  33 + }
  34 + }
  35 + else {
  36 + myDesktopApp.errorMsg('Missing parameter selection');
  37 + return null;
  38 + }
  39 +
  40 + var paramTitleField = Ext.getCmp('visu-histo-title');
  41 + var paramTitle = paramTitleField.getValue();
  42 + if (paramTitle && (paramTitle != "")) {
  43 + paramOpt.title = paramTitle;
  44 + }
  45 +
  46 + var nbBinsField = Ext.getCmp('visu-histo-bin-slider');
  47 + var nbBinsValue = nbBinsField.getValue();
  48 + if (nbBinsValue <= 0) {
  49 + nbBinsValue = 1
  50 + }
  51 +
  52 + this.histogramStore = Ext.create('Ext.data.Store', {
  53 + fields: ['value', 'count']
  54 + });
  55 +
  56 + var minValue = null;
  57 + var maxValue = null;
  58 + catalogStore.each(function (item) {
  59 + minValue = (minValue == null) ? item.get(paramOpt.paramId) : Math.min(minValue, item.get(paramOpt.paramId));
  60 + maxValue = (maxValue == null) ? item.get(paramOpt.paramId) : Math.max(maxValue, item.get(paramOpt.paramId));
  61 + });
  62 +
  63 + if (!minValue || !maxValue || (minValue == maxValue)) {
  64 + myDesktopApp.errorMsg('Not enought data or constant data');
  65 + return null;
  66 + }
  67 +
  68 + var binSize = (maxValue-minValue) / (nbBinsValue-1);
  69 + var data = [];
  70 + for (i = 0; i < nbBinsValue; ++i) {
  71 + var center = minValue + i * binSize;
  72 + data.push({
  73 + center: center,
  74 + min: center - binSize/2,
  75 + max: center + binSize/2,
  76 + count: 0
  77 + });
  78 + }
  79 +
  80 + catalogStore.each(function (item) {
  81 + var valueIndex = Math.floor((item.get(paramOpt.paramId) - minValue) / binSize);
  82 + ++data[valueIndex].count;
  83 + });
  84 +
  85 +
  86 + this.histogramStore = Ext.create('Ext.data.Store', {
  87 + fields: ['center', 'min', 'max', 'count']
  88 + });
  89 + this.histogramStore.loadData(data);
  90 +
  91 + var chartConfig = {
  92 + style: 'background:#fff',
  93 + animate: false,
  94 + shadow: false,
  95 + store: this.histogramStore,
  96 + id: 'visu-chart',
  97 + axes: [{
  98 + type: 'Numeric',
  99 + position: 'left',
  100 + fields: ['count'],
  101 + title: 'Number of Hits',
  102 + grid : true,
  103 + minimum: 0
  104 + }, {
  105 + type: 'Category',
  106 + position: 'bottom',
  107 + fields: ['center'],
  108 + title: paramOpt.title,
  109 + label: {
  110 + renderer: function(value, label, storeItem, item, i, display, animate, index) {
  111 + return value.toFixed(2);
  112 + }
  113 + }
  114 + }],
  115 + series: [{
  116 + type: 'column',
  117 + axis: 'left',
  118 + highlight: true,
  119 + gutter: 5,
  120 + xField: 'center',
  121 + yField: 'count',
  122 + tips: {
  123 + height: 20,
  124 + hideDelay: 200,
  125 + mouseOffset: [0,0], //[15,18]
  126 + renderer: function(storeItem, item) {
  127 + this.setTitle('['+storeItem.get('min').toFixed(2)+', '+storeItem.get('max').toFixed(2)+']');
  128 + }
  129 + }
  130 + }]
  131 + };
  132 +
  133 + return chartConfig;
  134 + },
  135 +
  136 + getHistoConfig: function(parametersStore) {
  137 + var paramComboConfig = {
  138 + xtype: 'combo',
  139 + emptyText: 'select parameter',
  140 + editable: false,
  141 + store: parametersStore,
  142 + queryMode: 'local',
  143 + displayField: 'name',
  144 + valueField: 'id',
  145 + id: 'visu-histo-param'
  146 + };
  147 +
  148 + var sliderConfig = {
  149 + xtype : 'fieldcontainer',
  150 + layout: 'hbox',
  151 + items: [
  152 + {
  153 + xtype:'fieldset',
  154 + title: 'Nb. bins',
  155 + border: false,
  156 + layout: 'hbox',
  157 + items: [
  158 + {
  159 + xtype: 'slider',
  160 + width: 150,
  161 + value: 10,
  162 + increment: 1,
  163 + minValue: 2,
  164 + maxValue: 100,
  165 + id: 'visu-histo-bin-slider',
  166 + listeners: {
  167 + change: function ( slider, newValue, thumb, eOpts ) {
  168 + var binValueField = Ext.getCmp('visu-histo-bin-value');
  169 + binValueField.setValue(newValue);
  170 + },
  171 + scope: this
  172 + }
  173 + },
  174 + {
  175 + xtype: 'splitter'
  176 + },
  177 + {
  178 + xtype: 'numberfield',
  179 + hideTrigger: true,
  180 + width: 50,
  181 + disabled: true,
  182 + value: 10,
  183 + id: 'visu-histo-bin-value'
  184 + }
  185 + ]
  186 + }
  187 + ]
  188 + };
  189 +
  190 + return {
  191 + xtype : 'fieldset',
  192 + title : 'Histogram axis',
  193 + items : [
  194 + paramComboConfig,
  195 + sliderConfig,
  196 + {
  197 + xtype: 'textfield',
  198 + fieldLabel: 'Title',
  199 + id: 'visu-histo-title'
  200 + }
  201 + ]
  202 + };
  203 + },
  204 +
  205 + init : function (config)
  206 + {
  207 + var myConf = {
  208 + items: [
  209 + this.getHistoConfig(config.parametersStore)
  210 + ]
  211 + };
  212 +
  213 + Ext.apply (this, Ext.apply(arguments, myConf));
  214 + }
  215 +});
... ...
js/app/views/CatalogVisuScatter.js 0 โ†’ 100644
... ... @@ -0,0 +1,273 @@
  1 +/**
  2 + * Project AMDA-NG
  3 + * Name CatalogVisuScatter.js
  4 + * @class amdaUI.CatalogVisuScatter
  5 + * @extends Ext.container.Container
  6 + * @brief Scatter Visualization Module UI definition (View)
  7 + * @author elena
  8 + */
  9 +
  10 +Ext.define('amdaUI.CatalogVisuScatter', {
  11 + extend: 'Ext.form.Panel',
  12 + alias: 'widget.panelCatalogVisuScatter',
  13 +
  14 + constructor: function(config) {
  15 + this.init(config);
  16 + this.callParent(arguments);
  17 + },
  18 +
  19 + getChartConfig: function(catalogStore) {
  20 + var plotTypeField = Ext.getCmp('visu-scatter-type');
  21 + var plotType = plotTypeField.getValue();
  22 +
  23 + var plotColorField = Ext.getCmp('visu-scatter-color');
  24 + plotColor = plotColorField.getValue();
  25 +
  26 + var xAxisOpt = this.getAxisOptions('X');
  27 + var yAxisOpt = this.getAxisOptions('Y');
  28 +
  29 + if ((!xAxisOpt.paramId) || (xAxisOpt.paramId == '')) {
  30 + myDesktopApp.errorMsg('Missing parameter selection for X axis');
  31 + return null;
  32 + }
  33 +
  34 + if ((!yAxisOpt.paramId) || (yAxisOpt.paramId == '')) {
  35 + myDesktopApp.errorMsg('Missing parameter selection for Y axis');
  36 + return null;
  37 + }
  38 +
  39 + var chartConfig = {
  40 + animate: false,
  41 + mask: false,
  42 + shadow: false,
  43 + theme: plotColor,
  44 + background: { fill : "#fff" },
  45 + store: catalogStore,
  46 + id: 'visu-chart',
  47 + axes: [{
  48 + type: 'Numeric',
  49 + position: 'bottom',
  50 + fields: [],
  51 + title: xAxisOpt.title,
  52 + grid : true
  53 + }, {
  54 + type: 'Numeric',
  55 + position: 'left',
  56 + fields: [],
  57 + title: yAxisOpt.title,
  58 + grid: true
  59 + }],
  60 + series: [{
  61 + type: 'scatter',
  62 + showMarkers: true,
  63 + highlight: true,
  64 + xField: xAxisOpt.paramId,
  65 + yField: yAxisOpt.paramId,
  66 + type: plotType,
  67 + tips: {
  68 + height: 20,
  69 + hideDelay: 200,
  70 + mouseOffset: [0,0],
  71 + renderer: function(storeItem, item) {
  72 + this.setTitle('['+storeItem.get('start').toISOString() + ', ' + storeItem.get('stop').toISOString() + ']');
  73 + }
  74 + }
  75 + }]
  76 + };
  77 +
  78 + if (xAxisOpt.range) {
  79 + chartConfig.axes[0].minimum = xAxisOpt.range.min;
  80 + chartConfig.axes[0].maximum = xAxisOpt.range.max;
  81 + }
  82 +
  83 + if (yAxisOpt.range) {
  84 + chartConfig.axes[1].minimum = yAxisOpt.range.min;
  85 + chartConfig.axes[1].maximum = yAxisOpt.range.max;
  86 + }
  87 +
  88 + return chartConfig;
  89 + },
  90 +
  91 + getAxisOptions: function(axisName) {
  92 + var opt = {
  93 + paramId: '',
  94 + title: axisName+' axis'
  95 + };
  96 +
  97 + var axisParamField = Ext.getCmp('visu-scatter-' + axisName + '-param');
  98 + var paramFieldId = axisParamField.getValue();
  99 + if (paramFieldId && (paramFieldId != "")) {
  100 + var paramField = axisParamField.getStore().getById(axisParamField.getValue());
  101 + if (paramField) {
  102 + opt.paramId = paramField.get('id');
  103 + opt.title = paramField.get('name');
  104 + }
  105 + }
  106 +
  107 + var axisTitleField = Ext.getCmp('visu-scatter-'+axisName+'-title');
  108 + var axisTitle = axisTitleField.getValue();
  109 + if (axisTitle && (axisTitle != "")) {
  110 + opt.title = axisTitle;
  111 + }
  112 +
  113 + var axisScalingField = Ext.getCmp('visu-scatter-'+axisName+'-scaling');
  114 + var axisScaling = axisScalingField.getValue();
  115 + if (axisScaling == 'manual') {
  116 + var axisRangeMinField = Ext.getCmp('visu-scatter-' + axisName + '-range-min');
  117 + var axisRangeMin = axisRangeMinField.getValue();
  118 + var axisRangeMaxField = Ext.getCmp('visu-scatter-' + axisName + '-range-max');
  119 + var axisRangeMax = axisRangeMaxField.getValue();
  120 + opt.range = {
  121 + 'min' : axisRangeMin,
  122 + 'max' : axisRangeMax
  123 + };
  124 + }
  125 + return opt;
  126 + },
  127 +
  128 + getAxisConfig: function(axisIndex, axisName, parametersStore) {
  129 + var paramComboConfig = {
  130 + xtype: 'combo',
  131 + emptyText: 'select parameter',
  132 + editable: false,
  133 + store: parametersStore,
  134 + queryMode: 'local',
  135 + displayField: 'name',
  136 + valueField: 'id',
  137 + axisIndex: axisIndex,
  138 + id: 'visu-scatter-' + axisName + '-param'
  139 + };
  140 +
  141 + var comboRangeConfig = {
  142 + xtype : 'combo',
  143 + name:'scaling',
  144 + valueField: 'scaling',
  145 + queryMode:'local',
  146 + store:['auto','manual'],
  147 + forceSelection:true,
  148 + value: 'auto',
  149 + width: 80,
  150 + id: 'visu-scatter-' + axisName + '-scaling',
  151 + listeners : {
  152 + scope : this,
  153 + change : function(combo, newValue, oldValue) {
  154 + var minValue = combo.next().next();
  155 + var maxValue = minValue.next().next();
  156 + var disabled = newValue == "auto";
  157 + minValue.reset();
  158 + maxValue.reset();
  159 + minValue.setDisabled(disabled);
  160 + maxValue.setDisabled(disabled);
  161 + }
  162 + }
  163 + };
  164 +
  165 + var axisRangeConfig = {
  166 + xtype : 'fieldcontainer',
  167 + layout: 'hbox',
  168 + items: [
  169 + {
  170 + xtype:'fieldset',
  171 + title: axisName + ' Range',
  172 + border: false,
  173 + layout: 'hbox',
  174 + items: [
  175 + comboRangeConfig,
  176 + {
  177 + xtype: 'splitter'
  178 + },
  179 + {
  180 + xtype: 'numberfield',
  181 + hideTrigger: true,
  182 + width: 50,
  183 + disabled: true,
  184 + id: 'visu-scatter-' + axisName + '-range-min'
  185 + },
  186 + {
  187 + xtype: 'splitter'
  188 + },
  189 + {
  190 + xtype: 'numberfield',
  191 + hideTrigger: true,
  192 + width: 50,
  193 + disabled: true,
  194 + id: 'visu-scatter-' + axisName + '-range-max'
  195 + }
  196 + ]
  197 + }
  198 + ]
  199 + };
  200 +
  201 + return {
  202 + xtype : 'fieldset',
  203 + title : axisName + ' axis',
  204 + items : [
  205 + paramComboConfig,
  206 + axisRangeConfig,
  207 + {
  208 + xtype: 'textfield',
  209 + fieldLabel: axisName + ' title',
  210 + id: 'visu-scatter-' + axisName + '-title'
  211 + }
  212 + ]
  213 + };
  214 + },
  215 +
  216 + getPlottingOptionConfig: function() {
  217 + var plotTypeComboConfig = {
  218 + xtype: 'combo',
  219 + emptyText: 'select plot type',
  220 + editable: false,
  221 + store: ['scatter', 'line'],
  222 + queryMode: 'local',
  223 + valueField: 'type',
  224 + value: 'scatter',
  225 + id: 'visu-scatter-type',
  226 + listeners : {
  227 + scope : this,
  228 + change : function(combo, newValue, oldValue) {
  229 + //this.chartConfig.series[0].type = newValue;
  230 + }
  231 + }
  232 + };
  233 +
  234 + var plotThemeComboConfig = {
  235 + xtype: 'combo',
  236 + emptyText: 'select theme',
  237 + editable: false,
  238 + store: ['Base','Green','Sky','Red','Purple','Blue','Yellow'],
  239 + queryMode: 'local',
  240 + valueField: 'type',
  241 + value: 'Blue',
  242 + id: 'visu-scatter-color',
  243 + listeners : {
  244 + scope : this,
  245 + change : function(combo, newValue, oldValue) {
  246 + //this.chartConfig.theme = newValue;
  247 + }
  248 + }
  249 + };
  250 +
  251 + return {
  252 + xtype : 'fieldset',
  253 + title : 'Plotting Options',
  254 + items : [
  255 + plotTypeComboConfig,
  256 + plotThemeComboConfig
  257 + ]
  258 + };
  259 + },
  260 +
  261 + init : function (config)
  262 + {
  263 + var myConf = {
  264 + items: [
  265 + this.getAxisConfig(0,'X', config.parametersStore),
  266 + this.getAxisConfig(0,'Y', config.parametersStore),
  267 + this.getPlottingOptionConfig()
  268 + ]
  269 + };
  270 +
  271 + Ext.apply (this, Ext.apply(arguments, myConf));
  272 + }
  273 +});
... ...
js/app/views/ParameterUI.js
... ... @@ -380,13 +380,6 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
380 380 case 'myDataParam' :
381 381 var name = data.records[0].get('text');
382 382 nameToSent = "wsd_"+name;
383   - var size = data.records[0].get('size');
384   - if (size && size > 1)
385   - {
386   - nameToSent += "(0)";
387   - myDesktopApp.warningMsg("parameter "+name+" is array of size: "
388   - +size+"<br/>Please put index");
389   - }
390 383 break;
391 384 default :
392 385  
... ...
js/app/views/StatisticsUI.js
... ... @@ -230,7 +230,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
230 230 {
231 231 xtype: 'combo', queryMode : 'local',
232 232 //emptyText : 'please click to select function',
233   - store: [ 'min', 'max', 'mean' ,'median','variance','skewness','kurtosis','count','countNotNan' ],
  233 + store: [ 'min', 'max', 'mean' ,'RMS','median','variance','skewness','kurtosis','count','countNotNan','countTrue' ],
234 234 triggerAction: 'all',
235 235 //lazyInit: false,
236 236 listeners: {
... ...
js/app/views/UploadPanelUI.js
... ... @@ -530,7 +530,7 @@ Ext.define(&#39;amdaUI.UploadPanelUI&#39;, {
530 530 var combo = Ext.create('Ext.form.ComboBox', {
531 531 flex : 4,
532 532 store: this.store,
533   - emptyText: 'Enter Remote Site URL (ftp/http)',
  533 + emptyText: 'Enter Remote Site URL (ftp/http[s])',
534 534 queryMode: 'local',
535 535 displayField: 'name',
536 536 valueField: 'value'
... ... @@ -568,7 +568,7 @@ Ext.define(&#39;amdaUI.UploadPanelUI&#39;, {
568 568 {
569 569 xtype : 'textfield',
570 570 name : config.remoteUploadName,
571   - emptyText: 'Enter Remote File URL (ftp/http)',
  571 + emptyText: 'Enter Remote File URL (ftp/http[s])',
572 572 width: 310,
573 573 listeners:
574 574 {
... ...
js/app/views/VisuUI.js
... ... @@ -11,51 +11,41 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
11 11 extend: 'Ext.container.Container',
12 12 alias: 'widget.panelVisu',
13 13  
  14 + requires: [
  15 + 'amdaUI.CatalogVisuScatter',
  16 + 'amdaUI.CatalogVisuHistogram'
  17 + ],
  18 +
  19 + visuTabContents: [],
  20 +
  21 + parametersStore: null,
  22 + catalogStore: null,
  23 + emptyChartConfig: null,
  24 +
14 25 constructor: function(config) {
15 26 this.init(config);
16 27 this.callParent(arguments);
17   - if (this.object) this.reformObject();
  28 + if (this.object)
  29 + this.loadObject();
18 30 },
19 31  
20 32 setObject : function (obj) {
21 33 this.object = obj;
22   - this.reformObject();
  34 + this.loadObject();
23 35 },
24 36  
25 37 updateObject : function () {
26 38 return true;
27 39 },
28 40  
29   - reformObject : function () {
30   - this.fromPlugin = this.object.get('fromPlugin');
31   -
32   - if (this.fromPlugin) {
33   - if (this.object.get('folderId') == '')
34   - this.object.set('id','cacheCat');
35   - else
36   - this.object.set('id',this.object.get('folderId'));
37   -
38   - this.object.set('objName',this.object.get('objName'));
39   - }
40   - else {
41   - this.object.set('id',this.object.get('id'));
42   - this.object.set('name',this.object.get('name'));
43   - }
44   - // load object into view
45   - if (this.object.get('id') != '')
46   - this.loadObject();
47   - },
48   -
49 41 reset : function() {
50   - //reset all fieldsets except the first one (name, intervals)
51   - var form = this.items.items[0].items.items[0];
52   - for (var i = 1; i < 4; i++) {
53   - var fieldset = form.items.items[i];
54   - Ext.each(fieldset.query('field'), function(field) {
55   - field.reset();
56   - });
57   - }
58   - this.resetChart();
  42 + var tabPanel = Ext.getCmp('visu-tabpanel');
  43 + Ext.Array.each(tabPanel.items.items, function(item) {
  44 + Ext.each(item.query('field'), function(field) {
  45 + field.reset();
  46 + });
  47 + });
  48 + this.replaceChart(null);
59 49 },
60 50  
61 51 /**
... ... @@ -65,9 +55,9 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
65 55 {
66 56 var me = this;
67 57  
68   - var onAfterInit = function(result, e)
  58 + var onAfterInit = function(result, e)
69 59 {
70   - if (!result) {
  60 + if (!result) {
71 61 myDesktopApp.errorMsg(e.message);
72 62 Ext.defer(function(){Ext.Msg.toFront()},10);
73 63  
... ... @@ -85,95 +75,67 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
85 75 return;
86 76 }
87 77  
88   - var fields = [], i = 0, index;
89   -
90   - if (!result.cache) {
91   - me.object.set('name', result.name);
92   - me.object.set('nbIntervals', result.totalCount);
93   -
94   - var params = [];
95   - Ext.Array.each(result.parameters, function(item, index) {
96   - params[index] = item;
97   - }, this);
98   -
99   - me.object.set('parameters', params);
100   - }
101   - else {
102   - fields[0] = Ext.create('Ext.data.Field', { name : 'start', id: 'start', text : 'start: date' });
103   - fields[1] = Ext.create('Ext.data.Field', { name : 'stop', id: 'stop', text : 'stop: date' });
104   - i = 2;
105   - }
106   -
107   - Ext.Array.each(me.object.get('parameters'), function(obj) {
108   - index = 'param'+i.toString();
109   - if (obj.type == 2) {
110   - fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name + ': string' });
111   -
112   - }
113   - else if (obj.type == 1){
114   - fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name + ': date' });
115   - }
116   - else {
117   - fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name,
118   - convert: function(value, record) {
119   - return parseFloat(value);
120   - }
121   - });
122   - }
123   - i++;
124   - });
125   -
126   - if (me.chartStore) {
127   - me.parList.removeAll();
128   - me.reset();
129   - me.chartStore = null;
130   - }
131   -
132   - me.parList.add(fields);
133   -
134   - me.chartStore = Ext.create('Ext.data.Store', {
135   - fields : fields,
136   - // autoDestroy: false,
137   - // pageSize : 200,
138   - // buffered : true,
139   - // purgePageCount: 0,
140   - // remoteSort: true,
141   - autoload: false,
142   - proxy: {
143   - type: 'direct',
144   - api :
145   - {
146   - read : AmdaAction.readIntervalsForChart
147   - },
148   - // remplir automatiquement tt, sharedtt , catalog, shared catalog
149   - extraParams : {'typeTT' : 'catalog', 'id' : me.object.get('id'),
150   - 'name' : me.object.get('objName'), 'fromPlugin' : me.fromPlugin},
151   - reader:
152   - {
153   - type: 'json',
154   - root: 'intervals',
155   - totalProperty : 'totalCount'
156   - }
157   - },
158   - listeners: {
159   - scope : me,
160   - load: function(store,records) {
161   - //TODO enable plot button
162   - // me.object.set('nbIntervals',me.chartStore.getTotalCount());
163   -
164   - // load object into form
165   - var formPanel = me.items.items[0].items.items[0];
166   - formPanel.getForm().loadRecord(me.object);
167   - }
168   - }
169   - });
170   -
171   - me.chartStore.load();
  78 + me.parametersStore.removeAll();
  79 + Ext.Array.each(result.parameters, function(param) {
  80 + if ((param.type == 0) || (param.type == 1) || (param.type == 3)) {
  81 + me.parametersStore.add(param);
  82 + }
  83 + });
  84 +
  85 + var dateConvert = function (value, rec) {
  86 + if (!Ext.isDate(value)) {
  87 + var valueString = new String(value);
  88 + return new Date(valueString+'Z');
  89 + }
  90 + return value;
  91 + };
  92 +
  93 + var fieldsConfig = [];
  94 + fieldsConfig.push({type: 'date', id: 'start', name : 'start', dateFormat: 'Y-m-d\\TH:i:s', convert: dateConvert});
  95 + fieldsConfig.push({type: 'date', id: 'stop', name : 'stop', dateFormat: 'Y-m-d\\TH:i:s', convert: dateConvert});
  96 + me.parametersStore.each(function (param) {
  97 + switch (param.get('type')) {
  98 + case 0: //double
  99 + fieldsConfig.push({
  100 + type: 'float',
  101 + id: param.get('id'),
  102 + name: param.get('id')
  103 + });
  104 + break;
  105 + case 1: //dateTime
  106 + fieldsConfig.push({
  107 + type: 'date',
  108 + id: param.get('id'),
  109 + name : param.get('id'),
  110 + convert: dateConvert
  111 + });
  112 + break;
  113 + case 3: //int
  114 + fieldsConfig.push({
  115 + type: 'int',
  116 + id: param.get('id'),
  117 + name: param.get('id')
  118 + });
  119 + break;
  120 + }
  121 + });
  122 +
  123 + me.catalogStore = Ext.create('Ext.data.Store', {
  124 + fields : fieldsConfig
  125 + });
  126 + me.catalogStore.loadData(result.intervals);
  127 +
  128 + me.reset();
172 129 }
173 130  
174   - AmdaAction.initForChart(this.object.get('id'), this.object.get('folderId'), this.object.get('objName'), this.fromPlugin, 'catalog', onAfterInit);
175   - },
  131 + var opt = {
  132 + 'typeTT' : 'catalog', 'id' : this.object.get('id'),
  133 + 'name' : this.object.get('name')
  134 + };
176 135  
  136 + this.formPanel.getForm().loadRecord(this.object);
  137 + AmdaAction.readIntervalsForChart(opt, onAfterInit);
  138 + },
177 139  
178 140 /**
179 141 * Check if changes were made before closing window
... ... @@ -184,398 +146,159 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
184 146 return false;
185 147 },
186 148  
187   - resetChart : function () {
188   -
189   - var emptyAxesConfig = [{
190   - type: 'Numeric',
191   - position: 'bottom',
192   - fields: [],
193   - title: 'X axis',
194   - grid : true
195   - }, {
196   - type: 'Numeric',
197   - position: 'left',
198   - fields: [],
199   - title: 'Y axis',
200   - grid: true
201   - }];
202   -
203   - this.chartConfig.series[0].xField = '';
204   - this.chartConfig.series[0].yField = '';
205   -
206   - this.chartConfig.theme = 'Blue';
207   -
208   - this.chartConfig.axes = emptyAxesConfig;
209   -
210   - var chart = Ext.create('Ext.chart.Chart', this.chartConfig);
211   - this.replaceChart(chart);
212   -
213   - },
214   -
215 149 plotChart : function () {
216   -
217   - this.chartConfig.store = this.chartStore;
218   -
219   - var xTitle = this.items.items[0].items.items[0].items.items[1].items.items[2].getValue();
220   - var yTitle = this.items.items[0].items.items[0].items.items[2].items.items[2].getValue();
221   -
222   - if (xTitle) this.chartConfig.axes[0].title = xTitle;
223   - if (xTitle) this.chartConfig.axes[1].title = yTitle;
224   -
225   - // axis modifs
226   - if (this.comboXrange.getValue() == 'manual') {
227   - var minX = this.comboXrange.next().next().getValue();
228   - var maxX = this.comboXrange.next().next().next().next().getValue();
229   - this.chartConfig.axes[0].minimum = minX;
230   - this.chartConfig.axes[0].maximum = maxX ;
231   - } else {
232   - // unset min/max in config
233   - delete this.chartConfig.axes[0].minimum;
234   - delete this.chartConfig.axes[0].maximum;
235   - }
236   - if (this.comboYrange.getValue() == 'manual') {
237   - var minX = this.comboYrange.next().next().getValue();
238   - var maxX = this.comboYrange.next().next().next().next().getValue();
239   - // if (minX && maxX) {
240   - this.chartConfig.axes[1].minimum = minX;
241   - this.chartConfig.axes[1].maximum = maxX;
242   - // }
243   - } else {
244   - // unset min/max in config
245   - delete this.chartConfig.axes[1].minimum;
246   - delete this.chartConfig.axes[1].maximum;
247   - }
248   -
249   - var chart = Ext.create('Ext.chart.Chart', this.chartConfig);
250   -
251   - this.replaceChart(chart);
  150 + var tabPanel = Ext.getCmp('visu-tabpanel');
  151 + var newChartConfig = tabPanel.activeTab.items.items[0].getChartConfig(this.catalogStore);
  152 + this.replaceChart(newChartConfig);
252 153 },
253 154  
254   - replaceChart: function(chart) {
255   - var chartPanel = this.items.items[0].items.items[1];
256   - var oldChart = chartPanel.down('chart');
257   - oldIndex = chartPanel.items.indexOf(oldChart);
258   - chartPanel.remove(oldChart);
259   - chartPanel.insert(oldIndex, chart);
260   - },
  155 + replaceChart: function(newChartConfig) {
  156 + if (!newChartConfig) {
  157 + newChartConfig = this.emptyChartConfig;
  158 + }
  159 + var chart = Ext.getCmp('visu-chart');
  160 + var chartPanel = chart.up();
  161 + chartPanel.remove(chart);
  162 + chartPanel.insert(Ext.create('Ext.chart.Chart', newChartConfig));
  163 + },
  164 +
  165 + saveChart : function() {
  166 + var chart = Ext.getCmp('visu-chart');
  167 + if (chart) {
  168 + chart.save({
  169 + type: 'image/png',
  170 + defaultUrl : window.location
  171 + });
  172 + }
  173 + },
  174 +
  175 + initChartTypes: function() {
  176 + var me = this;
  177 +
  178 + var tabPanel = Ext.getCmp('visu-tabpanel');
  179 + if (!tabPanel)
  180 + return;
  181 +
  182 + var chartTypes = [
  183 + {
  184 + title: 'Scatter',
  185 + widget: 'widget.panelCatalogVisuScatter'
  186 + },
  187 + {
  188 + title: 'Histogram',
  189 + widget: 'widget.panelCatalogVisuHistogram'
  190 + }
  191 + ];
  192 +
  193 + var isFirst = true;
  194 + Ext.Array.each(chartTypes, function(chartType) {
  195 + var tabContent = Ext.create(chartType.widget, {parametersStore : me.parametersStore});
  196 + var tab = tabPanel.add({
  197 + title: chartType.title,
  198 + items: [
  199 + tabContent
  200 + ],
  201 + layout: 'fit'
  202 + });
  203 + me.visuTabContents.push(tabContent);
  204 + if (isFirst) {
  205 + tabPanel.setActiveTab(tab);
  206 + isFirst = false;
  207 + }
  208 + });
  209 + },
261 210  
262 211 init : function (config)
263 212 {
264   - var store = Ext.create('Ext.data.Store', {
265   - fields : [],
266   - autoload : false
267   - });
268   -
269   - var rangeStore = Ext.create('Ext.data.Store', {
270   - fields : [],
271   - autoload : false
  213 + this.catalogStore = Ext.create('Ext.data.Store', {
  214 + fields: []
  215 + });
  216 +
  217 + this.parametersStore = Ext.create('Ext.data.Store', {
  218 + fields: [
  219 + {name: 'id', type: 'string'},
  220 + {name: 'name', type: 'string'},
  221 + {name: 'type', type: 'int'}
  222 + ],
  223 + data: []
272 224 });
273 225  
274   - this.chartConfig = {
275   - width: 500,
276   - height: 500,
277   - animate: false,
278   - mask: false,
279   - shadow: false,
280   - theme:'Blue',
281   - background: { fill : "#fff" },
282   - store: store,
283   - axes: [{
284   - type: 'Numeric',
285   - position: 'bottom',
286   - fields: [],
287   - title: 'X axis',
288   - grid : true
289   - }, {
290   - type: 'Numeric',
291   - position: 'left',
292   - fields: [],
293   - title: 'Y axis',
294   - grid: true
295   - }],
296   - series: [{
297   - type: 'scatter',
298   - showMarkers: true,
299   - highlight: true,
300   -// markerConfig: {
301   - // radius: 5,
302   -// size: 5
303   -// },
304   - // // axes: ['left', 'bottom'],
305   - xField: '',
306   - yField: '',
307   -// label: {
308   -// // display: 'under',
309   -// // renderer: function(value, label, storeItem, item, i, display, animate, index) {
310   -// // return storeItem.param3;
311   -// // }
312   -// },
313   - tips: {
314   -// trackMouse: true,
315   - width: 10,
316   - height: 20,
317   - hideDelay: 100, //200 ms
318   - mouseOffset: [0,0], //[15,18]
319   - renderer: function(storeItem, item) {
320   - this.setTitle(storeItem.index + 1);
321   - }
322   - }
323   - }]
324   - }
325   -
326   - this.parList = Ext.create('Ext.data.Store', {
327   - fields : [ 'text', 'id']
328   - });
329   -
330   - var chart = Ext.create('Ext.chart.Chart', this.chartConfig);
331   -
332   - this.parCombo = Ext.create('Ext.form.ComboBox', {
333   - emptyText: 'select parameter',
334   - editable: false,
335   - store: this.parList,
336   - queryMode: 'local',
337   - displayField: 'text',
338   - valueField: 'id',
339   - // tpl:'<tpl for="."><div ext:qtip="{qtip}" class="x-combo-list-item">{Name}</div></tpl>',
340   - listeners : {
341   - scope : this,
342   - change : function(combo, newValue, oldValue) {
343   - if (newValue) {
344   - this.chartConfig.axes[0].fields = [newValue];
345   - var rec = combo.findRecordByValue(newValue);
346   -
347   - this.chartConfig.axes[0].title = rec.get('text');
348   - this.chartConfig.series[0].xField = newValue;
349   - }
350   - }
351   - }
352   - });
353   -
354   - this.parCombo1 = Ext.create('Ext.form.ComboBox', {
355   - emptyText: 'select parameter',
356   - editable: false,
357   - store: this.parList,
358   - queryMode: 'local',
359   - displayField: 'text',
360   - valueField: 'id',
361   - listeners : {
362   - scope : this,
363   - change : function(combo, newValue, oldValue) {
364   - if (newValue) {
365   - this.chartConfig.axes[1].fields = [newValue];
366   - var rec = combo.findRecordByValue(newValue);
367   - this.chartConfig.axes[1].title = rec.get('text');
368   - this.chartConfig.series[0].yField = newValue;
369   - }
370   - }
371   - }
372   - });
373   -
374   - var plotTypeCombo = Ext.create('Ext.form.ComboBox', {
375   - emptyText: 'select plot type',
376   - editable: false,
377   - store: ['scatter', 'line'],
378   - queryMode: 'local',
379   - valueField: 'type',
380   - value: 'scatter',
381   - listeners : {
382   - scope : this,
383   - change : function(combo, newValue, oldValue) {
384   - this.chartConfig.series[0].type = newValue;
385   - }
386   - }
387   - });
388   -
389   - var plotThemeCombo = Ext.create('Ext.form.ComboBox', {
390   - emptyText: 'select theme',
391   - editable: false,
392   - store: ['Base','Green','Sky','Red','Purple','Blue','Yellow'],
393   - //'Category1','Category2','Category3','Category4','Category5','Category6'],
394   - queryMode: 'local',
395   - valueField: 'type',
396   - value: 'Blue',
397   - listeners : {
398   - scope : this,
399   - change : function(combo, newValue, oldValue) {
400   - this.chartConfig.theme = newValue;
401   - }
402   - }
403   - });
404   -
405   - var comboRangeConfig = {
406   - // fieldLabel:'X Range',
407   - name:'scaling',
408   - valueField: 'scaling',
409   - queryMode:'local',
410   - store:['auto','manual'],
411   - forceSelection:true,
412   - value: 'auto',
413   - width: 80,
414   - listeners : {
415   - scope : this,
416   - change : function(combo, newValue, oldValue) {
417   - var minValue = combo.next().next();
418   - var maxValue = minValue.next().next();
419   - var disabled = newValue == "auto";
420   - minValue.reset();
421   - maxValue.reset();
422   - minValue.setDisabled(disabled);
423   - maxValue.setDisabled(disabled);
424   - }
425   - }
426   - };
427   -
428   - this.comboXrange = Ext.create('Ext.form.ComboBox', comboRangeConfig);
429   - this.comboYrange = Ext.create('Ext.form.ComboBox', comboRangeConfig);
430   -
431   - var formPanel = Ext.create('Ext.form.Panel', {
432   - region : 'center',
433   - layout: 'hbox',
  226 + this.emptyChartConfig = {
  227 + xtype: 'chart',
  228 + region: 'center',
  229 + store: this.catalogStore,
  230 + id: 'visu-chart',
  231 + animate: false,
  232 + mask: false,
  233 + shadow: false,
  234 + theme:'Blue',
  235 + background: { fill : "#fff" }
  236 + };
  237 +
  238 + this.formPanel = Ext.create('Ext.form.Panel', {
  239 + region: 'center',
  240 + layout: 'border',
434 241 bodyStyle: {background : '#dfe8f6'},
435 242 defaults: { border : false, align: 'stretch', padding: '3'},
436   - fieldDefaults: { labelWidth: 80, labelAlign : 'top' },
437   - items: [ {
438   - xtype: 'form',
439   - flex : 1,
440   - bodyStyle: {background : '#dfe8f6'},
441   - items: [{
442   - xtype : 'fieldset',
443   - items : [{
444   - xtype: 'fieldcontainer',
445   - layout: 'hbox',
446   - items: [
447   - { xtype:'textfield', fieldLabel: 'Catalog Name', name: 'name', readOnly: true},
448   - { xtype: 'splitter' },
449   - { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', readOnly: true}
450   - ]
451   - }]
452   - },{
453   - xtype : 'fieldset',
454   - title : 'X axis',
455   - items : [
456   - this.parCombo,
457   - {
458   - xtype : 'fieldcontainer',
459   - layout: 'hbox',
460   - items: [{
461   - xtype:'fieldset',
462   - title: 'X Range',
463   - border: false,
464   - layout: 'hbox',
465   - items: [
466   - this.comboXrange,
467   - {
468   - xtype: 'splitter'
469   - }, {
470   - xtype: 'numberfield',
471   - hideTrigger: true,
472   - width: 50,
473   - disabled: true
474   - },{
475   - xtype: 'splitter'
476   - },{
477   - xtype: 'numberfield',
478   - hideTrigger: true,
479   - width: 50,
480   - disabled: true
481   - }]
482   - }]
483   - },
484   -// { xtype : 'checkbox', boxLabel: 'Logarithmic'},
485   - { xtype: 'textfield', fieldLabel: 'X title', name: 'xtitle'}
486   - ]
487   - },{
488   - xtype : 'fieldset',
489   - title : 'Y axis',
490   - items : [
491   - this.parCombo1,
492   - {
493   - xtype : 'fieldcontainer',
494   - layout: 'hbox',
495   - items: [{
496   - xtype:'fieldset',
497   - title: 'Y Range',
498   - border: false,
499   - layout: 'hbox',
500   - items: [
501   - this.comboYrange,
502   - {
503   - xtype: 'splitter'
504   - }, {
505   - xtype: 'numberfield',
506   - hideTrigger: true,
507   - width: 50,
508   - disabled: true
509   - },{
510   - xtype: 'splitter'
511   - },{
512   - xtype: 'numberfield',
513   - hideTrigger: true,
514   - width: 50,
515   - disabled: true
516   - }]
517   - }]
518   - },
519   -// { xtype : 'checkbox', boxLabel: 'Logarithmic',
520   -// listeners: {
521   -// scope: this,
522   -// change : function( check, newValue, oldValue) {
523   -//
524   -// }
525   -// }
526   -// },
527   - { xtype: 'textfield', fieldLabel: 'Y title', name: 'ytitle'}
528   - ]
529   - },
530   - {
531   - xtype : 'fieldset',
532   - title : 'Plotting Options',
533   - items : [
534   - plotTypeCombo,
535   - plotThemeCombo
536   - ]
537   - }
538   - ],
539   - fbar:[{
540   - type: 'button',
541   - text: 'Plot',
542   - scope : this,
543   - handler: this.plotChart
544   -
545   - },{
546   - type: 'button',
547   - text: 'Reset',
548   - scope : this,
549   - handler: this.reset
550   -
551   - }]
552   - }, {
553   - xtype: 'form',
554   - // padding: '3',
555   - flex: 2,
556   - items : [ chart ],
557   - fbar:[
558   - {
559   - type: 'button',
560   - text: 'Save Chart',
561   - scope: this,
562   - handler: function() {
563   - var chartPanel = this.items.items[0].items.items[1];
564   - var chart = chartPanel.down('chart');
565   - chart.save({
566   - type: 'image/png',
567   - defaultUrl : window.location //'http://apus.irap.omp.eu/NEWAMDA/'
568   - });
569   - }
570   - }]
571   - }
572   - ]
573   - });
574   -
575   - var myConf = {
  243 + items: [
  244 + {
  245 + xtype : 'fieldset',
  246 + region: 'north',
  247 + items : [
  248 + {
  249 + xtype: 'fieldcontainer',
  250 + layout: 'hbox',
  251 + fieldDefaults: { labelWidth: 80, labelAlign : 'right' },
  252 + items: [
  253 + { xtype:'textfield', fieldLabel: 'Catalog Name', name: 'name', readOnly: true},
  254 + { xtype: 'splitter' },
  255 + { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', readOnly: true}
  256 + ]
  257 + }
  258 + ],
  259 + },
  260 + {
  261 + xtype: 'container',
  262 + region: 'center',
  263 + layout: 'border',
  264 + items: [
  265 + {
  266 + xtype: 'tabpanel',
  267 + region: 'west',
  268 + width: 250,
  269 +// height: 400,
  270 + id: 'visu-tabpanel'
  271 + },
  272 + this.emptyChartConfig
  273 + ]
  274 + }
  275 + ],
  276 + fbar:[
  277 + {
  278 + type: 'button',
  279 + text: 'Plot',
  280 + scope : this,
  281 + handler: this.plotChart
  282 + },
  283 + {
  284 + type: 'button',
  285 + text: 'Reset',
  286 + scope : this,
  287 + handler: this.reset
  288 + },
  289 + {
  290 + type: 'button',
  291 + text: 'Save Chart',
  292 + scope : this,
  293 + handler: this.saveChart
  294 + }
  295 + ]
  296 + });
  297 +
  298 + var myConf = {
576 299 layout: 'border',
577 300 items: [
578   - formPanel,
  301 + this.formPanel,
579 302 {
580 303 xtype: 'panel',
581 304 region: 'south',
... ... @@ -594,6 +317,8 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
594 317 ]
595 318 };
596 319  
  320 + this.initChartTypes();
  321 +
597 322 Ext.apply (this, Ext.apply(arguments, myConf));
598 323 }
599 324 });
... ...
php/classes/AmdaAction.php
... ... @@ -208,15 +208,15 @@ class AmdaAction
208 208 // $component_info["index1"] = $child->getAttribute('index1');
209 209 // if ($child->hasAttribute("index2"))
210 210 // $component_info["index2"] = $child->getAttribute('index2');
211   -//
  211 +//
212 212 // if ($child->hasAttribute("parentId"))
213 213 // $component_info["parentId"] = $child->getAttribute("parentId");
214   -//
  214 +//
215 215 // if ($child->hasAttribute("iconCls"))
216 216 // $iconCls = $child->getAttribute("iconCls");
217   -//
  217 +//
218 218 // if ($isLeaf) $isParameter = true;
219   -//
  219 +//
220 220 // break;
221 221  
222 222 case 'timeTable':
... ... @@ -1132,17 +1132,6 @@ class AmdaAction
1132 1132 return $cacheMgr->initFromTimeTable($id, $nparams);
1133 1133 }
1134 1134  
1135   -
1136   - public function initForChart($id, $folderId, $name, $isTmpObject, $type)
1137   - {
1138   - if ($isTmpObject && $type == 'catalog' && $id == 'cacheCat')
1139   - return array('success' => true, 'cache' => $id);
1140   -
1141   - if ($type == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
1142   -
1143   - return $objMgr->initForChart($id, $folderId, $name, $isTmpObject, $type);
1144   - }
1145   -
1146 1135 public function initObjectCacheFromTmpObject($folderId, $name, $isCatalog = false)
1147 1136 {
1148 1137 if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
... ... @@ -1168,18 +1157,9 @@ class AmdaAction
1168 1157  
1169 1158 public function readIntervalsForChart($o)
1170 1159 {
1171   - if (isset($o->typeTT) && ($o->typeTT == 'catalog' || $o->typeTT == 'sharedcatalog')) {
1172   -
1173   - if ($o->fromPlugin && $o->id == 'cacheCat') {
1174   - $objMgr = new CatalogCacheMgr();
1175   -
1176   - return $objMgr->getIntervals();
1177   - }
1178   -
1179   - $objMgr = new CatalogMgr();
1180   - }
1181   -
1182   - return $objMgr->getIntervalsForChart($o->id, $o->name, $o->fromPlugin, $o->typeTT);
  1160 + $objMgr = new CatalogCacheMgr(TRUE);
  1161 + $objMgr->initFromObject($o->id, $o->type);
  1162 + return $objMgr->getIntervalsForChart();
1183 1163 }
1184 1164  
1185 1165 public function saveTTCacheIntervalsInTT($o)
... ...
php/classes/CatalogCacheIntervalObject.php
... ... @@ -19,7 +19,6 @@ class CatalogCacheIntervalObject extends TimeTableCacheIntervalObject
19 19 // for catalog
20 20 public function setParamValue($param_id, $param_value)
21 21 {
22   - error_log($param_value);
23 22 $this->params[$param_id] = $param_value;
24 23 }
25 24  
... ...
php/classes/CatalogCacheMgr.php
... ... @@ -7,12 +7,16 @@
7 7 class CatalogCacheMgr extends TimeTableCacheMgr
8 8 {
9 9 const DEFAULT_PARAM_ID_PREFIX = 'cat_param_id_';
  10 + private $isForVisu = FALSE;
10 11  
11   - function __construct() {
  12 + function __construct($isForVisu = FALSE) {
12 13 $this->objectMgr = new CatalogMgr();
13 14 }
14 15  
15 16 protected function getCacheFileName() {
  17 + if ($this->isForVisu) {
  18 + return "cacheVisuCat";
  19 + }
16 20 return "cacheCat";
17 21 }
18 22  
... ... @@ -89,11 +93,51 @@ class CatalogCacheMgr extends TimeTableCacheMgr
89 93  
90 94 //Save cache file
91 95 return array('success' => $this->saveToFile(), 'token' => $this->cache->getToken(), 'status' => $this->cache->getStatus(), 'parameters' => $this->cache->getParametersInfo());
92   -
93   -
94   -
95 96 }
96 97  
97   -
  98 + public function getIntervalsForChart() {
  99 + $result = $this->getIntervals(NULL, NULL, NULL, NULL);
  100 + if (!$result['success']) {
  101 + return FALSE;
  102 + }
  103 +
  104 + $parameters = $this->cache->getParametersInfo();
  105 + $parameters_to_split = array();
  106 + $parameters_chart = array();
  107 + foreach ($parameters as $parameter) {
  108 + if ($parameter['size'] > 1) {
  109 + $parameters_to_split[] = $parameter;
  110 + for ($i = 0; $i < $parameter['size']; ++$i) {
  111 + $comp_param = $parameter;
  112 + $comp_param['id'] = $parameter['id'].'_COMPONENT_'.$i;
  113 + $comp_param['name'] = $parameter['name'].'['.$i.']';
  114 + unset ($comp_param['size']);
  115 + $parameters_chart[] = $comp_param;
  116 + }
  117 + }
  118 + else {
  119 + $comp_param = $parameter;
  120 + unset ($comp_param['size']);
  121 + $parameters_chart[] = $comp_param;
  122 + }
  123 + }
  124 +
  125 + if (empty($parameters_to_split)) {
  126 + return $result + array('parameters' => $parameters_chart);
  127 + }
  128 +
  129 + //split parameters
  130 + foreach ($result[intervals] as &$interval) {
  131 + foreach ($parameters_to_split as $parameter) {
  132 + $values = explode (',',$interval[$parameter['id']]);
  133 + unset($interval[$parameter['id']]);
  134 + foreach ($values as $key => $value) {
  135 + $interval[$parameter['id'].'_COMPONENT_'.$key] = $value;
  136 + }
  137 + }
  138 + }
  139 +
  140 + return $result + array('parameters' => $parameters_chart);
  141 + }
98 142 }
99 143 ?>
... ...
php/classes/CatalogMgr.php
... ... @@ -101,93 +101,6 @@ class CatalogMgr extends TimeTableMgr
101 101  
102 102 }
103 103  
104   - public function initForChart($id, $folderId, $name, $isTmpObject, $type)
105   - {
106   - if ($isTmpObject)
107   - $options = array(
108   - 'name' => $name,
109   - 'folder' => empty($folderId) ? USERTEMPDIR : USERWORKINGDIR.$folderId,
110   - 'type' => $type,
111   - );
112   - else
113   - $options = array(
114   - 'id' => $id,
115   - 'type' => $type,
116   - );
117   -
118   - $intervals_res = $this->getCatalogParamDescription($options);
119   -
120   - if (!$intervals_res['success'])
121   - return $intervals_res;
122   -
123   - $paramHeaders = array();
124   -
125   - foreach ( $intervals_res['parameters'] as $param ) {
126   -
127   - if ($param['size'] > 1) {
128   -
129   - for ($i = 0; $i < $param['size']; $i++) {
130   - $paramComp = array();
131   - $paramComp['id'] = $param['id'].'_'.$i;
132   - $paramComp['name'] = $param['name'].'_'.$i;
133   - // $paramComp['size'] = 1;
134   -
135   - $paramHeaders[] = $paramComp;
136   - }
137   - }
138   - else {
139   - $paramHeaders[] = $param;
140   - }
141   - }
142   -
143   - // unset($intervals_res);
144   -
145   - return array('success' => true, 'parameters' => $paramHeaders,
146   - 'totalCount' => $intervals_res['totalCount'], 'name' => $intervals_res['name']);
147   - }
148   -
149   -
150   - public function getIntervalsForChart($id, $name, $isTmpObject, $type) {
151   -
152   - if ($isTmpObject)
153   - $intervals_res = $this->getTmpObject($id, $name);
154   - else
155   - $intervals_res = $this->loadIntervalsFromObject($id,$type);
156   -
157   - if (!$intervals_res['success'])
158   - return $intervals_res;
159   -
160   -
161   - $newIntervals = array();
162   -
163   - foreach ($intervals_res['intervals'] as $interval)
164   - {
165   - $newIntervalComp = array();
166   - $k = 0;
167   -
168   - for ( $j = 0; $j < count($interval['paramTable']); $j++ ) {
169   -
170   - $param = $interval['paramTable'][$j];
171   - $tempArr = explode(',',$param);
172   -
173   - if (count($tempArr) > 1) {
174   - for ($i = 0; $i < count($tempArr); $i++) {
175   - $newIntervalComp['param'.$k] = $tempArr[$i];
176   - $k++;
177   - }
178   - }
179   - else {
180   - $newIntervalComp['param'.$k] = $param;
181   - $k++;
182   - }
183   - }
184   - $newIntervals[] = $newIntervalComp;
185   - }
186   -
187   - return array('success' => true, 'intervals' => $newIntervals);
188   -
189   - }
190   -
191 104 public function getCatalogParamDescription($options)
192 105 {
193 106 if (!empty($options['id'])) {
... ...
php/classes/TimeTableCacheMgr.php
... ... @@ -228,6 +228,10 @@
228 228 );
229 229 }
230 230  
  231 + public function getIntervalsForChart() {
  232 + return $this->getIntervals(NULL, NULL, NULL, NULL);
  233 + }
  234 +
231 235 public function addInterval($index, $start, $stop) {
232 236 if (!$this->loadFromFile())
233 237 return array('success' => false, 'message' => 'Cannot load cache file');
... ...