Commit 17433635e39486b3800b5b89b6b9dd9862e38a54

Authored by Benjamin Renard
1 parent abe09878

Add series and spectro definition for a plot request

js/app/models/PlotObjects/PlotAxisObject.js
... ... @@ -54,8 +54,7 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
54 54 associations : [
55 55 {
56 56 type : 'belongsTo',
57   - model : 'amdaPlotObj.PlotPanelObject',
58   - ownerName : 'panel'
  57 + model : 'amdaPlotObj.PlotPanelObject'
59 58 }
60 59 ],
61 60  
... ... @@ -86,7 +85,7 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
86 85 this.set('axis-color-maxval', 'none');
87 86 },
88 87  
89   - getJsonValues : function(hasId)
  88 + getJsonValues : function()
90 89 {
91 90 var axisValues = new Object();
92 91  
... ...
js/app/models/PlotObjects/PlotObjectConfig.js
... ... @@ -65,6 +65,22 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
65 65 },
66 66 timeFormat : 'dd/mm/yy',
67 67 colorMap : '1'
  68 + },
  69 + serie : {
  70 + yAxis : 'y-left',
  71 + lines : {
  72 + style : 'plain',
  73 + width : 1,
  74 + color : 'auto'
  75 + },
  76 + symbols : {
  77 + type : 'dot',
  78 + size : 1,
  79 + color : 'auto'
  80 + }
  81 + },
  82 + spectro : {
  83 + yAxis : 'y-left'
68 84 }
69 85 },
70 86  
... ... @@ -144,6 +160,36 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
144 160 {'key' : 'DD/MM/YYYY', 'value' : 'DD/MM/YYYY'}
145 161 ],
146 162  
  163 + availableYAxes : [
  164 + {'key' : 'y-left', 'value' : 'Left'},
  165 + {'key' : 'y-right', 'value' : 'Right'}
  166 + ],
  167 +
  168 + availableLinesStyles : [
  169 + {'key' : 'plain', 'value' : 'Plain'},
  170 + {'key' : 'dot', 'value' : 'Dot'},
  171 + {'key' : 'long-spaced-dot', 'value' : 'Long spaced dot'},
  172 + {'key' : 'long-short-dot', 'value' : 'Long short dot'}
  173 + ],
  174 +
  175 + availableSymbolsTypes : [
  176 + {'key' : 'dot', 'value' : 'Dot'},
  177 + {'key' : 'plus', 'value' : 'Plus'},
  178 + {'key' : 'wildcard', 'value' : 'Wildcard'},
  179 + {'key' : 'circle', 'value' : 'Circle'},
  180 + {'key' : 'crux', 'value' : 'Crux'},
  181 + {'key' : 'square', 'value' : 'Square'},
  182 + {'key' : 'triangle', 'value' : 'Triangle'},
  183 + {'key' : 'crux-in-circle', 'value' : 'Crux in circle'},
  184 + {'key' : 'dot-in-circle', 'value' : 'Dot in circle'},
  185 + {'key' : 'diamond', 'value' : 'Diamond'},
  186 + {'key' : 'star', 'value' : 'Star'},
  187 + {'key' : 'david-star', 'value' : 'David star'},
  188 + {'key' : 'full-square', 'value' : 'Full square'},
  189 + {'key' : 'full-circle', 'value' : 'Full circle'},
  190 + {'key' : 'full-star', 'value' : 'Full star'}
  191 + ],
  192 +
147 193 availableColorMaps : [
148 194 {'key' : '0', 'value' : 'Default'},
149 195 {'key' : '1', 'value' : 'Blue Red'},
... ... @@ -161,5 +207,10 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
161 207 {'color' : 'none', 'value' : 'None'},
162 208 {'color' : '#0000FF', 'value' : 'Blue'},
163 209 {'color' : '#FF0000', 'value' : 'Red'}
  210 + ],
  211 +
  212 + availableDrawingTypes : [
  213 + {'key' : 'serie', 'value' : 'Serie'},
  214 + {'key' : 'spectro', 'value' : 'Spectro'}
164 215 ]
165 216 });
166 217 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -16,9 +16,12 @@
16 16 Ext.define('amdaPlotObj.PlotPanelObject', {
17 17 extend: 'Ext.data.Model',
18 18  
  19 + lastParamId : 0,
  20 +
19 21 requires: [
20 22 'amdaPlotObj.PlotObjectConfig',
21   - 'amdaPlotObj.PlotAxisObject'
  23 + 'amdaPlotObj.PlotAxisObject',
  24 + 'amdaPlotObj.PlotParamObject'
22 25 ],
23 26  
24 27 fields : [
... ... @@ -50,9 +53,13 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
50 53 name : 'axes'
51 54 },
52 55 {
  56 + type : 'hasMany',
  57 + model : 'amdaPlotObj.PlotParamObject',
  58 + name : 'params'
  59 + },
  60 + {
53 61 type : 'belongsTo',
54   - model : 'amdaPlotObj.PlotTabObject',
55   - ownerName : 'tab'
  62 + model : 'amdaPlotObj.PlotTabObject'
56 63 }
57 64 ],
58 65  
... ... @@ -113,6 +120,22 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
113 120 }
114 121 },
115 122  
  123 + createNewParam: function() {
  124 + var recs = this.params().add({id : this.get('id')+'-param-'+this.lastParamId});
  125 + ++this.lastParamId;
  126 + recs[0].setDefaultValues('serie');
  127 + return recs[0];
  128 + },
  129 +
  130 + removeParamById: function(paramId) {
  131 + //Retrieve param record
  132 + var paramRecord = this.params().getById(paramId);
  133 + if (paramRecord == null)
  134 + return false;
  135 + this.params().remove(paramRecord);
  136 + return true;
  137 + },
  138 +
116 139 setDefaultValues: function()
117 140 {
118 141 this.set('panel-background-color', amdaPlotObj.PlotObjectConfig.defaultValues.panel.backgroundColor);
... ... @@ -141,7 +164,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
141 164 this.initAxes();
142 165 },
143 166  
144   - getJsonValues : function(hasId)
  167 + getJsonValues : function()
145 168 {
146 169 var panelValues = new Object();
147 170  
... ... @@ -170,6 +193,12 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
170 193 panelValues['axes'][index] = axe.getJsonValues();
171 194 });
172 195  
  196 + panelValues['params'] = [];
  197 +
  198 + this.params().each(function (param, index) {
  199 + panelValues['params'][index] = param.getJsonValues();
  200 + });
  201 +
173 202 return panelValues;
174 203 }
175 204 });
176 205 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotParamObject.js 0 → 100644
... ... @@ -0,0 +1,79 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotParamObject.js
  4 + * @class amdaPlotObj.PlotParamObject
  5 + * @extends Ext.data.Model
  6 + * @brief Plot Param Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotParamObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :17/08/2015: BRE - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.PlotParamObject', {
  17 + extend: 'Ext.data.Model',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig',
  21 + 'amdaPlotObj.PlotSerieObject',
  22 + 'amdaPlotObj.PlotSpectroObject'
  23 + ],
  24 +
  25 + fields : [
  26 + {name: 'id', type: 'string'},
  27 + {name: 'param-id', type: 'string'},
  28 + {name: 'param-drawing-type', type: 'string'},
  29 + {name: 'param-drawing-object', type: 'auto'}
  30 + ],
  31 +
  32 + associations : [
  33 + {
  34 + type : 'belongsTo',
  35 + model : 'amdaPlotObj.PlotPanelObject',
  36 + getterName : 'Panel'
  37 + }
  38 + ],
  39 +
  40 + setDrawingType: function(type)
  41 + {
  42 + this.set('param-drawing-type', type);
  43 +
  44 + //Create drawing object in relation with the type
  45 + switch (type)
  46 + {
  47 + case 'serie' :
  48 + this.set('param-drawing-object', new amdaPlotObj.PlotSerieObject());
  49 + break;
  50 + case 'spectro' :
  51 + this.set('param-drawing-object', new amdaPlotObj.PlotSpectroObject());
  52 + break;
  53 + default :
  54 + this.set('param-drawing-object', null);
  55 + }
  56 +
  57 + //Set drawing object to default status
  58 + if (this.get('param-drawing-object') != null)
  59 + this.get('param-drawing-object').setDefaultValues();
  60 + },
  61 +
  62 + setDefaultValues: function(type)
  63 + {
  64 + this.setDrawingType(type);
  65 + },
  66 +
  67 + getJsonValues : function()
  68 + {
  69 + var paramValues = new Object();
  70 +
  71 + paramValues['param-id'] = this.get('param-id');
  72 + paramValues['param-drawing-type'] = this.get('param-drawing-type');
  73 +
  74 + if (this.get('param-drawing-object') != null)
  75 + paramValues['param-drawing-object'] = this.get('param-drawing-object').getJsonValues();
  76 +
  77 + return paramValues;
  78 + }
  79 +});
0 80 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotRequestObject.js
... ... @@ -56,7 +56,6 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
56 56  
57 57 removeTab: function(tabId) {
58 58 var tabToRemove = this.tabs().get(tabId);
59   - console.log(tabId);
60 59 },
61 60  
62 61 getJsonValues : function(hasId)
... ...
js/app/models/PlotObjects/PlotSerieObject.js 0 → 100644
... ... @@ -0,0 +1,71 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotSerieObject.js
  4 + * @class amdaPlotObj.PlotSerieObject
  5 + * @extends Ext.data.Model
  6 + * @brief Plot Serie Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotSerieObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :18/08/2015: BRE - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.PlotSerieObject', {
  17 + extend: 'Ext.data.Model',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
  22 +
  23 + fields : [
  24 + {name: 'serie-yaxis', type: 'string'},
  25 + {name: 'serie-lines-activated', type: 'bool'},
  26 + {name: 'serie-lines-style', type: 'string'},
  27 + {name: 'serie-lines-width', type: 'float'},
  28 + {name: 'serie-lines-color', type: 'string'},
  29 + {name: 'serie-symbols-activated', type: 'bool'},
  30 + {name: 'serie-symbols-type', type: 'string'},
  31 + {name: 'serie-symbols-size', type: 'float'},
  32 + {name: 'serie-symbols-color', type: 'string'},
  33 + {name: 'serie-colored-param', type: 'string'},
  34 + //Only used for xyPlot
  35 + {name: 'serie-xaxis-param', type: 'string'}
  36 + ],
  37 +
  38 + setDefaultValues: function()
  39 + {
  40 + this.set('serie-yaxis', amdaPlotObj.PlotObjectConfig.defaultValues.serie.yAxis);
  41 + this.set('serie-lines-activated', true);
  42 + this.set('serie-lines-style', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.style);
  43 + this.set('serie-lines-width', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.width);
  44 + this.set('serie-lines-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.color);
  45 + this.set('serie-symbols-activated', false);
  46 + this.set('serie-symbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.type);
  47 + this.set('serie-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.size);
  48 + this.set('serie-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.color);
  49 + this.set('serie-colored-param', '');
  50 + this.set('serie-xaxis-param', '');
  51 + },
  52 +
  53 + getJsonValues : function()
  54 + {
  55 + var serieValues = new Object();
  56 +
  57 + serieValues['serie-yaxis'] = this.get('serie-yaxis');
  58 + serieValues['serie-lines-activated'] = this.get('serie-lines-activated');
  59 + serieValues['serie-lines-style'] = this.get('serie-lines-style');
  60 + serieValues['serie-lines-width'] = this.get('serie-lines-width');
  61 + serieValues['serie-lines-color'] = this.get('serie-lines-color');
  62 + serieValues['serie-symbols-activated'] = this.get('serie-symbols-activated');
  63 + serieValues['serie-symbols-type'] = this.get('serie-symbols-type');
  64 + serieValues['serie-symbols-size'] = this.get('serie-symbols-size');
  65 + serieValues['serie-symbols-color'] = this.get('serie-symbols-color');
  66 + serieValues['serie-colored-param'] = this.get('serie-colored-param');
  67 + serieValues['serie-xaxis-param'] = this.get('serie-xaxis-param');
  68 +
  69 + return serieValues;
  70 + }
  71 +});
0 72 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotSpectroObject.js 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotSpectroObject.js
  4 + * @class amdaPlotObj.PlotSpectroObject
  5 + * @extends Ext.data.Model
  6 + * @brief Plot Spectro Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotSpectroObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :21/08/2015: BRE - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.PlotSpectroObject', {
  17 + extend: 'Ext.data.Model',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
  22 +
  23 + fields : [
  24 + {name: 'spectro-yaxis', type: 'string'}
  25 + ],
  26 +
  27 + setDefaultValues: function()
  28 + {
  29 + this.set('spectro-yaxis', amdaPlotObj.PlotObjectConfig.defaultValues.spectro.yAxis);
  30 + },
  31 +
  32 + getJsonValues : function()
  33 + {
  34 + var spectroValues = new Object();
  35 +
  36 + spectroValues['spectro-yaxis'] = this.get('spectro-yaxis');
  37 +
  38 + return spectroValues;
  39 + }
  40 +});
0 41 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotTabObject.js
... ... @@ -57,8 +57,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
57 57 },
58 58 {
59 59 type : 'belongsTo',
60   - model : 'amdaPlotObj.PlotRequestObject',
61   - ownerName : 'request'
  60 + model : 'amdaPlotObj.PlotRequestObject'
62 61 }
63 62 ],
64 63  
... ... @@ -69,6 +68,15 @@ Ext.define('amdaPlotObj.PlotTabObject', {
69 68 return recs[0];
70 69 },
71 70  
  71 + removePanelById: function(panelId) {
  72 + //Retrieve panel record
  73 + var panelRecord = this.panels().getById(panelId);
  74 + if (panelRecord == null)
  75 + return false;
  76 + this.panels().remove(panelRecord);
  77 + return true;
  78 + },
  79 +
72 80 setDefaultValues: function()
73 81 {
74 82 this.set('page-title-text', '');
... ... @@ -96,7 +104,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
96 104 this.set('page-font-italic', false);
97 105 },
98 106  
99   - getJsonValues : function(hasId)
  107 + getJsonValues : function()
100 108 {
101 109 var tabValues = new Object();
102 110  
... ...
js/app/models/PlotObjects/PlotTreeNode.js
... ... @@ -30,6 +30,9 @@ Ext.define('amdaPlotObj.PlotTreeNode', {
30 30 //Node expanded
31 31 expanded : true,
32 32  
  33 + //Node can be removed by user
  34 + removable : false,
  35 +
33 36 //Link to the object associated to this node
34 37 object: null,
35 38  
... ... @@ -44,6 +47,7 @@ Ext.define('amdaPlotObj.PlotTreeNode', {
44 47 this.set('leaf',this.leaf);
45 48 this.set('expanded',this.expanded);
46 49 this.set('type',this.type);
  50 + this.set('removable',this.removable);
47 51 if (config && config.object)
48 52 this.object = config.object;
49 53 }
... ... @@ -97,6 +101,8 @@ Ext.define('amdaPlotObj.PlotPanelTreeNode', {
97 101  
98 102 type: 'panel',
99 103  
  104 + removable: true,
  105 +
100 106 getAdditionalText: function()
101 107 {
102 108 return ' ('+this.object.get('panel-plot-type')+')';
... ... @@ -187,7 +193,34 @@ Ext.define('amdaPlotObj.PlotColorAxisTreeNode', {
187 193 type: 'color-axis'
188 194 });
189 195  
  196 +Ext.define('amdaPlotObj.PlotParamsTreeNode', {
  197 + extend: 'amdaPlotObj.PlotTreeNode',
  198 +
  199 + iconCls: 'icon-plot-params',
  200 +
  201 + text: 'Params',
  202 +
  203 + type: 'params'
  204 +});
190 205  
  206 +Ext.define('amdaPlotObj.PlotParamTreeNode', {
  207 + extend: 'amdaPlotObj.PlotTreeNode',
  208 +
  209 + leaf: true,
  210 +
  211 + //iconCls: 'icon-plot-params',
  212 +
  213 + text: '',
  214 +
  215 + type: 'param',
  216 +
  217 + removable: true,
  218 +
  219 + getAdditionalText: function()
  220 + {
  221 + return this.object.get('param-id')+' ('+this.object.get('param-drawing-type')+')';
  222 + }
  223 +});
191 224  
192 225 Ext.define('amdaPlotObj.PlotLegendsTreeNode', {
193 226 extend: 'amdaPlotObj.PlotTreeNode',
... ...
js/app/views/PlotComponents/PlotBaseAxisForm.js
... ... @@ -18,8 +18,8 @@ Ext.define('amdaPlotComp.PlotBaseAxisForm', {
18 18  
19 19 getFormItems: function() {
20 20 var rangeItems = [
21   - this.addStandardFloat('axis-range-min', 'Min', Number.MIN_VALUE, Number.MAX_VALUE),
22   - this.addStandardFloat('axis-range-min', 'Max', Number.MIN_VALUE, Number.MAX_VALUE),
  21 + this.addStandardFloat('axis-range-min', 'Min', -Number.MAX_VALUE, Number.MAX_VALUE),
  22 + this.addStandardFloat('axis-range-max', 'Max', -Number.MAX_VALUE, Number.MAX_VALUE),
23 23 this.addStandardCheck('axis-range-extend', 'Extend Axis Range')
24 24 ];
25 25  
... ...
js/app/views/PlotComponents/PlotElementPanel.js
... ... @@ -17,12 +17,12 @@ Ext.define('amdaPlotComp.PlotElementPanel', {
17 17 'amdaPlotComp.PlotBaseAxisForm',
18 18 'amdaPlotComp.PlotTimeAxisForm',
19 19 'amdaPlotComp.PlotEpochAxisForm',
20   - 'amdaPlotComp.PlotColorAxisForm'
  20 + 'amdaPlotComp.PlotColorAxisForm',
  21 + 'amdaPlotComp.PlotParamForm'
21 22 ],
22 23  
23 24 elementFormsManager : new Ext.AbstractManager(),
24 25  
25   - crtObject : null,
26 26 crtTree : null,
27 27  
28 28 constructor: function(config) {
... ... @@ -33,25 +33,26 @@ Ext.define('amdaPlotComp.PlotElementPanel', {
33 33 setElement: function(type, object, tree) {
34 34 this.removeAll(false);
35 35  
36   - crtObject = object;
37   - crtTree = tree;
  36 + this.crtTree = tree;
38 37  
39 38 var elementForm = this.getElementForm(type);
40 39 this.add(elementForm);
  40 + elementForm.crtTree = tree;
41 41 if (elementForm.setObject)
42 42 elementForm.setObject(object);
43 43 },
44 44  
45 45 resetElement: function() {
46   - this.setElement('',null);
  46 + this.setElement('',null,null);
47 47 },
48 48  
49 49 getElementForm: function(type) {
50 50 var formId = type;
51 51 if (type == '')
52 52 formId = 'none';
  53 +
53 54 formId += '-element-form';
54   -
  55 +
55 56 if (!this.elementFormsManager.get(formId))
56 57 {
57 58 //Create element form
... ... @@ -77,6 +78,9 @@ Ext.define('amdaPlotComp.PlotElementPanel', {
77 78 case 'y-right-axis' :
78 79 this.elementFormsManager.register(new amdaPlotComp.PlotBaseAxisForm({id : formId}));
79 80 break;
  81 + case 'param' :
  82 + this.elementFormsManager.register(new amdaPlotComp.PlotParamForm({id : formId}));
  83 + break;
80 84 case '' :
81 85 this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'Select an element to the tree to show options'}));
82 86 break;
... ...
js/app/views/PlotComponents/PlotPageForm.js
... ... @@ -26,7 +26,7 @@ Ext.define('amdaPlotComp.PlotPageForm', {
26 26 ];
27 27  
28 28 return [
29   - this.addStandardCombo('page-mode', 'Mode', amdaPlotObj.PlotObjectConfig.availablePageModes),
  29 + //this.addStandardCombo('page-mode', 'Mode', amdaPlotObj.PlotObjectConfig.availablePageModes),
30 30 this.addStandardCombo('page-orientation', 'Orientation', amdaPlotObj.PlotObjectConfig.availablePageOrientations),
31 31 this.addStandardCombo('page-dimension', 'Dimension', amdaPlotObj.PlotObjectConfig.availablePageDimensions),
32 32 this.addStandardFieldSet('Title', '', titleItems),
... ...
js/app/views/PlotComponents/PlotPanelForm.js
... ... @@ -25,10 +25,11 @@ Ext.define('amdaPlotComp.PlotPanelForm', {
25 25 this.addStandardFloat('panel-margin-y', 'Vertical', 0, 100)
26 26 ];
27 27  
  28 + var me = this;
28 29 return [
29 30 this.addStandardCombo('panel-plot-type', 'Plot type', amdaPlotObj.PlotObjectConfig.availablePlotTypes, function(name, value) {
30   - this.crtObject.initAxes();
31   - this.crtTree.buildPanelAxesNode(this.crtObject);
  31 + me.object.initAxes();
  32 + me.crtTree.buildPanelAxesNode(me.object);
32 33 }),
33 34 this.addStandardColor('panel-background-color', 'Background Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors),
34 35 this.addStandardFieldSet('Title', '', titleItems),
... ...
js/app/views/PlotComponents/PlotParamForm.js 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotParamForm.js
  4 + * @class amdaPlotComp.PlotParamForm
  5 + * @extends amdaPlotComp.PlotParamForm
  6 + * @brief Form to define specifics param options
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotParamForm.js benjamin $
  9 + */
  10 +
  11 +Ext.define('amdaPlotComp.PlotParamForm', {
  12 + extend: 'amdaPlotComp.PlotStandardForm',
  13 +
  14 + requires: [
  15 + 'amdaPlotComp.PlotSerieForm',
  16 + 'amdaPlotComp.PlotSpectroForm'
  17 + ],
  18 +
  19 + drawingOptionsContainer: null,
  20 +
  21 + drawingOptionsFormsManager : new Ext.AbstractManager(),
  22 +
  23 + setObject : function(object) {
  24 + this.object = object;
  25 + this.loadRecord(this.object);
  26 + this.updateDrawingOptions();
  27 + },
  28 +
  29 + getDrawingOptionsForm: function(type) {
  30 + var formId = '';
  31 + if (!type || (type == ''))
  32 + formId = 'none';
  33 + else
  34 + formId = type;
  35 +
  36 + formId += '-drawing-options-form';
  37 +
  38 + if (!this.drawingOptionsFormsManager.get(formId))
  39 + {
  40 + switch(type)
  41 + {
  42 + //Create drawing options form
  43 + case 'serie' :
  44 + this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSerieForm({id : formId}));
  45 + break;
  46 + case 'spectro' :
  47 + this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotSpectroForm({id : formId}));
  48 + break;
  49 + default :
  50 + this.drawingOptionsFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this drawing type'}));
  51 + }
  52 + }
  53 +
  54 + return this.drawingOptionsFormsManager.get(formId);
  55 +
  56 + },
  57 +
  58 + updateDrawingOptions: function() {
  59 + var typeField = this.getForm().findField('param-drawing-type');
  60 +
  61 + this.object.setDrawingType(typeField.getValue());
  62 +
  63 + this.drawingOptionsContainer.removeAll(false);
  64 +
  65 + var drawingOptionsForm = this.getDrawingOptionsForm(typeField.getValue());
  66 + this.drawingOptionsContainer.add(drawingOptionsForm);
  67 + drawingOptionsForm.crtTree = this.crtTree;
  68 + if (drawingOptionsForm.setObject)
  69 + drawingOptionsForm.setObject(this.object);
  70 + },
  71 +
  72 + getFormItems: function() {
  73 + var me = this;
  74 +
  75 + this.drawingOptionsContainer = Ext.create('Ext.container.Container', {
  76 + layout: 'fit'
  77 + });
  78 +
  79 + return [
  80 + this.addStandardCombo('param-drawing-type', 'Drawing type', amdaPlotObj.PlotObjectConfig.availableDrawingTypes, function(name, value) {
  81 + me.updateDrawingOptions();
  82 + }),
  83 + this.drawingOptionsContainer
  84 + ];
  85 + }
  86 +});
0 87 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotSerieForm.js 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotSerieForm.js
  4 + * @class amdaPlotComp.PlotSerieForm
  5 + * @extends amdaPlotComp.PlotSerieForm
  6 + * @brief Form to define specifics serie options
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotSerieForm.js benjamin $
  9 + */
  10 +
  11 +Ext.define('amdaPlotComp.PlotSerieForm', {
  12 + extend: 'amdaPlotComp.PlotStandardForm',
  13 +
  14 + setObject : function(object) {
  15 + this.object = object.get('param-drawing-object');
  16 + this.loadRecord(this.object);
  17 + this.updateOptions(this.crtTree.getSelectedPlotType());
  18 + },
  19 +
  20 + updateOptions: function(plotType) {
  21 + var xParamField = this.getForm().findField('serie-xaxis-param');
  22 + var isScatter = (plotType == 'xyPlot');
  23 + xParamField.setVisible(isScatter);
  24 + },
  25 +
  26 + getFormItems: function() {
  27 + var linesItems = [
  28 + this.addStandardCombo('serie-lines-style', 'Style', amdaPlotObj.PlotObjectConfig.availableLinesStyles),
  29 + this.addStandardFloat('serie-lines-width', 'Width', 1, 10),
  30 + this.addStandardColor('serie-lines-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
  31 + ];
  32 +
  33 + var symbolsItems = [
  34 + this.addStandardCombo('serie-symbols-type', 'Type', amdaPlotObj.PlotObjectConfig.availableSymbolsTypes),
  35 + this.addStandardFloat('serie-symbols-size', 'Size', 1, 10),
  36 + this.addStandardColor('serie-symbols-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
  37 + ];
  38 +
  39 + return [
  40 + this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter'),
  41 + this.addStandardCombo('serie-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes),
  42 + this.addStandardParamDropTarget('serie-colored-param', 'Colored Parameter'),
  43 + this.addStandardFieldSet('Lines', 'serie-lines-activated', linesItems),
  44 + this.addStandardFieldSet('Symbols', 'serie-symbols-activated', symbolsItems)
  45 + ];
  46 + }
  47 +});
0 48 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotSpectroForm.js 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotSpectroForm.js
  4 + * @class amdaPlotComp.PlotSpectroForm
  5 + * @extends amdaPlotComp.PlotSpectroForm
  6 + * @brief Form to define specifics spectro options
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotSpectroForm.js benjamin $
  9 + */
  10 +
  11 +Ext.define('amdaPlotComp.PlotSpectroForm', {
  12 + extend: 'amdaPlotComp.PlotStandardForm',
  13 +
  14 + setObject : function(object) {
  15 + this.object = object.get('param-drawing-object');
  16 + this.loadRecord(this.object);
  17 + },
  18 +
  19 + getFormItems: function() {
  20 + return [
  21 + this.addStandardCombo('spectro-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes)
  22 + ];
  23 + }
  24 +});
0 25 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -18,6 +18,9 @@ Ext.define('amdaPlotComp.PlotStandardForm', {
18 18 //Object associated to this form
19 19 object: null,
20 20  
  21 + //Link to the tree
  22 + crtTree: null,
  23 +
21 24 constructor: function(config) {
22 25 this.init(config);
23 26 this.callParent(arguments);
... ... @@ -227,6 +230,37 @@ Ext.define('amdaPlotComp.PlotStandardForm', {
227 230 };
228 231 },
229 232  
  233 + addStandardParamDropTarget: function(name, label) {
  234 + return {
  235 + xtype: 'textfield',
  236 + name: name,
  237 + fieldLabel: label,
  238 + readOnly: true,
  239 + emptyText: 'Drop a parameter',
  240 + listeners: {
  241 + change: function(field, newValue, oldValue, eOpts) {
  242 + this.object.set(name, newValue);
  243 + },
  244 + afterrender: function(field, eOpts ){
  245 + var paramTarget = new Ext.dd.DropTarget(field.el.dom,
  246 + {
  247 + ddGroup: 'explorerTree',
  248 + notifyEnter: function(ddSource, e, data) {
  249 + },
  250 + notifyDrop: function(ddSource, e, data) {
  251 + var selectedRecord = ddSource.dragData.records[0];
  252 +
  253 + field.setValue(selectedRecord.get('id'));
  254 + return true;
  255 + }
  256 + }
  257 + );
  258 + },
  259 + scope: this
  260 + }
  261 + };
  262 + },
  263 +
230 264 init : function(config) {
231 265 var me = this;
232 266  
... ...
js/app/views/PlotComponents/PlotTree.js
... ... @@ -15,6 +15,9 @@ Ext.define('amdaPlotComp.PlotTree', {
15 15 'amdaPlotObj.PlotTreeNode'
16 16 ],
17 17  
  18 + //
  19 + isSimplifiedView: false,
  20 +
18 21 //Link to the Plot Element Panel
19 22 plotElementPanel: null,
20 23  
... ... @@ -29,32 +32,44 @@ Ext.define('amdaPlotComp.PlotTree', {
29 32 this.callParent(arguments);
30 33 },
31 34  
  35 + setSimplifiedMode: function(isSimplifiedView) {
  36 + this.isSimplifiedView = isSimplifiedView;
  37 + this.buildTree(this.tabObject);
  38 + },
  39 +
32 40 buildTree: function(tabObject) {
33 41 if (this.store.getRootNode().hasChildNodes())
34 42 this.store.getRootNode().removeAll();
35 43  
36 44 this.tabObject = tabObject;
37 45  
38   - //Page Node
39   - var pageNode = this.store.getRootNode().appendChild(new amdaPlotObj.PlotPageTreeNode({object : tabObject}));
  46 + if (!this.isSimplifiedView)
  47 + {
  48 + //Page Node
  49 + var pageNode = this.store.getRootNode().appendChild(new amdaPlotObj.PlotPageTreeNode({object : tabObject}));
40 50  
41   - //Layout node
42   - pageNode.appendChild(new amdaPlotObj.PlotLayoutTreeNode());
  51 + //Layout node
  52 + pageNode.appendChild(new amdaPlotObj.PlotLayoutTreeNode());
43 53  
44   - //Panels node
45   - this.panelsNode = pageNode.appendChild(new amdaPlotObj.PlotPanelsTreeNode());
  54 + //Panels node
  55 + this.panelsNode = pageNode.appendChild(new amdaPlotObj.PlotPanelsTreeNode());
  56 + }
  57 + else
  58 + this.panelsNode = this.store.getRootNode();
  59 +
  60 + this.buildPanelsNode();
  61 + },
  62 +
  63 + buildPanelsNode: function() {
  64 + if (this.panelsNode.hasChildNodes())
  65 + this.panelsNode.removeAll();
46 66  
47 67 var me = this;
48 68 this.tabObject.panels().each(function (panelObject) {
49   - me.addPanel(panelObject);
  69 + me.addPanelNode(panelObject);
50 70 });
51 71 },
52 72  
53   - addPanel: function(panelObject) {
54   - var panelNode = this.panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode({object : panelObject}));
55   - this.buildPanelAxesNode(panelObject);
56   - },
57   -
58 73 buildPanelAxesNode: function(panelObject) {
59 74 var axesNode = null;
60 75  
... ... @@ -66,7 +81,7 @@ Ext.define('amdaPlotComp.PlotTree', {
66 81 axesNode = panelNode.findChild('type', 'axes');
67 82 if (!axesNode)
68 83 //create axes node
69   - axesNode = panelNode.appendChild(new amdaPlotObj.PlotAxesTreeNode());
  84 + axesNode = panelNode.appendChild(new amdaPlotObj.PlotAxesTreeNode({object : panelObject}));
70 85 return;
71 86 }
72 87 });
... ... @@ -104,11 +119,152 @@ Ext.define('amdaPlotComp.PlotTree', {
104 119 this.getView().refresh();
105 120 },
106 121  
  122 + buildPanelParamsNode: function(panelObject) {
  123 + var paramsNode = null;
  124 +
  125 + var me = this;
  126 + this.panelsNode.eachChild(function (panelNode) {
  127 + //Retrieve corresponding panel node
  128 + if (panelNode.object == panelObject)
  129 + {
  130 + if (!me.isSimplifiedView)
  131 + {
  132 + //Retrieve params node
  133 + paramsNode = panelNode.findChild('type', 'params');
  134 + if (!paramsNode)
  135 + //create axes node
  136 + paramsNode = panelNode.appendChild(new amdaPlotObj.PlotParamsTreeNode({object : panelObject}));
  137 + }
  138 + else
  139 + paramsNode = panelNode;
  140 + return;
  141 + }
  142 + });
  143 +
  144 + if (paramsNode == null)
  145 + return;
  146 +
  147 + //Remove old param nodes
  148 + paramsNode.removeAll();
  149 +
  150 + //Add param nodes
  151 + panelObject.params().each(function (paramObject) {
  152 + paramsNode.appendChild(new amdaPlotObj.PlotParamTreeNode({object : paramObject}));
  153 + });
  154 + this.getView().refresh();
  155 + },
  156 +
  157 + addPanelNode: function(panelObject) {
  158 + var panelNode = this.panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode({object : panelObject}));
  159 + if (!this.isSimplifiedView)
  160 + //Axes node
  161 + this.buildPanelAxesNode(panelObject);
  162 + //Params node
  163 + this.buildPanelParamsNode(panelObject);
  164 + return panelNode;
  165 + },
  166 +
  167 + movePanel : function(record,targetNode,position)
  168 + {
  169 + var fromIndex = targetNode.parentNode.indexOf(record);
  170 + var toIndex = targetNode.parentNode.indexOf(targetNode);
  171 +
  172 + var fromRecord = this.tabObject.panels().getAt(fromIndex);
  173 + if (!fromRecord)
  174 + return false;
  175 +
  176 + switch (position)
  177 + {
  178 + case 'before' :
  179 + this.tabObject.panels().data.removeAt(fromIndex);
  180 + var insertIndex = (fromIndex > toIndex) ? toIndex : toIndex - 1;
  181 + this.tabObject.panels().data.insert(insertIndex, fromRecord);
  182 + this.buildPanelsNode();
  183 + this.getSelectionModel().select(this.panelsNode.getChildAt(insertIndex));
  184 + return true;
  185 + case 'after' :
  186 + this.tabObject.panels().data.removeAt(fromIndex);
  187 + var insertIndex = (fromIndex > toIndex) ? toIndex + 1 : toIndex;
  188 + this.tabObject.panels().data.insert(insertIndex, fromRecord);
  189 + this.buildPanelsNode();
  190 + this.getSelectionModel().select(this.panelsNode.getChildAt(insertIndex));
  191 + return true;
  192 + break;
  193 + default :
  194 + return false;
  195 + }
  196 +
  197 + return true;
  198 + },
  199 +
  200 + addParamNode : function(paramsNode, paramObject) {
  201 + var paramNode = paramsNode.appendChild(new amdaPlotObj.PlotParamTreeNode({object : paramObject}));
  202 + return paramNode;
  203 + },
  204 +
  205 + moveParam : function(record,targetNode,position)
  206 + {
  207 + /*var fromIndex = targetNode.parentNode.indexOf(record);
  208 + var toIndex = targetNode.parentNode.indexOf(targetNode);
  209 +
  210 + var fromRecord = this.tabObject.panels().getAt(fromIndex);
  211 + if (!fromRecord)
  212 + return false;
  213 +
  214 + switch (position)
  215 + {
  216 + case 'before' :
  217 + this.tabObject.panels().data.removeAt(fromIndex);
  218 + var insertIndex = (fromIndex > toIndex) ? toIndex : toIndex - 1;
  219 + this.tabObject.panels().data.insert(insertIndex, fromRecord);
  220 + this.buildPanelsNode();
  221 + this.getSelectionModel().select(this.panelsNode.getChildAt(insertIndex));
  222 + return true;
  223 + case 'after' :
  224 + this.tabObject.panels().data.removeAt(fromIndex);
  225 + var insertIndex = (fromIndex > toIndex) ? toIndex + 1 : toIndex;
  226 + this.tabObject.panels().data.insert(insertIndex, fromRecord);
  227 + this.buildPanelsNode();
  228 + this.getSelectionModel().select(this.panelsNode.getChildAt(insertIndex));
  229 + return true;
  230 + break;
  231 + default :
  232 + return false;
  233 + }*/
  234 +
  235 + console.log('ToDo move param');
  236 +
  237 + return true;
  238 + },
  239 +
107 240 onNodeSelect: function(tree,record, index, eOpts) {
108 241 if (this.plotElementPanel != null)
109 242 this.plotElementPanel.setElement(record.type, record.object, this);
110 243 },
111 244  
  245 + onCellClick: function(tree, td, cellIndex, record, tr, rowIndex, e, eOpts) {
  246 + if ((cellIndex === 1) && record.get('removable'))
  247 + {
  248 + switch (record.get('type'))
  249 + {
  250 + case 'panel' :
  251 + if (this.tabObject.removePanelById(record.object.get('id')))
  252 + this.buildPanelsNode();
  253 + break;
  254 + case 'param' :
  255 + var panelObject = null;
  256 + if (!this.isSimplifiedView)
  257 + panelObject = record.parentNode.parentNode.object;
  258 + else
  259 + panelObject = record.parentNode.object;
  260 + //removeParamById
  261 + if (panelObject.removeParamById(record.object.get('id')))
  262 + this.buildPanelsNode();
  263 + break;
  264 + }
  265 + }
  266 + },
  267 +
112 268 getSelectedNode: function() {
113 269 var selection = this.getSelectionModel().getSelection();
114 270 if ((selection == null) || (selection.length == 0))
... ... @@ -116,6 +272,245 @@ Ext.define('amdaPlotComp.PlotTree', {
116 272 return selection[0];
117 273 },
118 274  
  275 + getSelectedPlotType: function() {
  276 + var selectedNode = this.getSelectedNode();
  277 + if (selectedNode == null)
  278 + return 'none';
  279 + var crtNode = selectedNode;
  280 + do {
  281 + if (crtNode.get('type') == 'panel')
  282 + return crtNode.object.get('panel-plot-type');
  283 + crtNode = crtNode.parentNode;
  284 + } while(crtNode != null);
  285 + return 'none';
  286 + },
  287 +
  288 + isValidToDrop : function(record,targetNode,position)
  289 + {
  290 + switch (record.$className)
  291 + {
  292 + case 'amdaModel.LocalParamNode' :
  293 + case 'amdaModel.RemoteParamNode' :
  294 + case 'amdaModel.RemoteSimuParamNode' :
  295 + return record.get('isParameter') && ! record.get('disable');
  296 + case 'amdaModel.AliasNode' :
  297 + case 'amdaModel.DerivedParamNode' :
  298 + case 'amdaModel.MyDataParamNode' :
  299 + return record.isLeaf();
  300 + case 'amdaPlotObj.PlotParamTreeNode' :
  301 + return true;
  302 + case 'amdaPlotObj.PlotPanelTreeNode' :
  303 + switch (position)
  304 + {
  305 + case 'append' :
  306 + return false;
  307 + case 'before' :
  308 + return (targetNode.$className == 'amdaPlotObj.PlotPanelTreeNode');
  309 + case 'after' :
  310 + return ((targetNode.$className == 'amdaPlotObj.PlotPanelTreeNode') && targetNode.isLast());
  311 + }
  312 + }
  313 + return false;
  314 + },
  315 +
  316 + dropParamToCreate : function(targetNode, position, paramId, needsArgs, plotOnly)
  317 + {
  318 + var panelObject = null;
  319 + if (targetNode == null)
  320 + {
  321 + //create new panel
  322 + panelObject = this.tabObject.createNewPanel();
  323 + }
  324 + else
  325 + {
  326 + switch (targetNode.$className)
  327 + {
  328 + case 'amdaPlotObj.PlotParamsTreeNode' :
  329 + case 'amdaPlotObj.PlotPanelTreeNode' :
  330 + case 'amdaPlotObj.PlotAxesTreeNode' :
  331 + panelObject = targetNode.object;
  332 + break;
  333 + case 'amdaPlotObj.PlotTimeAxisTreeNode' :
  334 + case 'amdaPlotObj.PlotEpochAxisTreeNode' :
  335 + case 'amdaPlotObj.PlotXAxisTreeNode' :
  336 + case 'amdaPlotObj.PlotYLeftAxisTreeNode' :
  337 + case 'amdaPlotObj.PlotYRightAxisTreeNode' :
  338 + case 'amdaPlotObj.PlotColorAxisTreeNode' :
  339 + case 'amdaPlotObj.PlotParamTreeNode' :
  340 + panelObject = targetNode.parentNode.object;
  341 + break;
  342 + default:
  343 + //create new panel
  344 + panelObject = this.tabObject.createNewPanel();
  345 + }
  346 + }
  347 +
  348 + //Create param object
  349 + var newParamObject = panelObject.createNewParam();
  350 + newParamObject.set('param-id', paramId);
  351 +
  352 + //Rebuild params node
  353 + this.buildPanelsNode();
  354 + },
  355 +
  356 + dropRecord : function(record,targetNode,position)
  357 + {
  358 + var selModel = this.getSelectionModel();
  359 +
  360 + //select the target node if defined
  361 + if (targetNode)
  362 + selModel.select(targetNode);
  363 + else
  364 + selModel.deselectAll();
  365 +
  366 + switch (record.$className)
  367 + {
  368 + case 'amdaModel.LocalParamNode' :
  369 + case 'amdaModel.RemoteParamNode' :
  370 + case 'amdaModel.RemoteSimuParamNode' :
  371 + if (!record.get('isParameter') || record.get('disable'))
  372 + return false;
  373 +
  374 + var needsArgs = false;
  375 +
  376 + if (record.$className == 'amdaModel.RemoteSimuParamNode') {
  377 + needsArgs = record.get('needsArgs');
  378 + }
  379 + else if (record.$className == 'amdaModel.LocalParamNode') {
  380 + needsArgs = record.get('needsArgs') && !record.get('isSpectra');
  381 + }
  382 +
  383 + if (record.get('alias') != "" )
  384 + this.dropParamToCreate(targetNode, position, "#"+record.get('alias'), needsArgs);
  385 + else
  386 + this.dropParamToCreate(targetNode, position, record.get('id'), needsArgs, record.get('notyet'));
  387 + return true;
  388 + case 'amdaModel.AliasNode' :
  389 + if (!record.isLeaf())
  390 + return false;
  391 + this.dropParamToCreate(targetNode, position, "#"+record.get('text'));
  392 + return true;
  393 + case 'amdaModel.DerivedParamNode' :
  394 + if (!record.isLeaf())
  395 + return false;
  396 + this.dropParamToCreate(targetNode, position, "ws_"+record.get('text'));
  397 + return true;
  398 + case 'amdaModel.MyDataParamNode' :
  399 + if (!record.isLeaf())
  400 + return false;
  401 + this.dropParamToCreate(targetNode, position, "wsd_"+record.get('text'));
  402 + return true;
  403 + case 'amdaPlotObj.PlotParamTreeNode' :
  404 + return this.moveParam(record,targetNode,position);
  405 + case 'amdaPlotObj.PlotPanelTreeNode' :
  406 + return this.movePanel(record,targetNode,position);
  407 + default :
  408 + return false;
  409 + }
  410 + return false;
  411 + },
  412 +
  413 + getDragAndDropPluginConfig : function() {
  414 + var me = this;
  415 +
  416 + return {
  417 + ptype:'treeviewdragdrop',
  418 + ddGroup:'explorerTree',
  419 + enableDrag:true,
  420 + enableDrop:true,
  421 + appendOnly : false,
  422 + allowContainerDrops : true,
  423 + containerScroll : true,
  424 + isValidDropPoint : function (node, position, dragZone, e, data)
  425 + {
  426 + if (!node || !data.item) {
  427 + return false;
  428 + }
  429 +
  430 + var view = this.view,
  431 + targetNode = view.getRecord(node),
  432 + draggedRecords = data.records,
  433 + dataLength = draggedRecords.length,
  434 + ln = draggedRecords.length,
  435 + i, record;
  436 + // No drop position, or dragged records: invalid drop point
  437 + if (!(targetNode && position && dataLength)) {
  438 + return false;
  439 + }
  440 +
  441 + // If the targetNode is within the folder we are dragging
  442 + for (i = 0; i < ln; i++) {
  443 + record = draggedRecords[i];
  444 + if (record.isNode && record.contains(targetNode)) {
  445 + return false;
  446 + }
  447 + }
  448 +
  449 + // Respect the allowDrop field on Tree nodes
  450 + if (position === 'append' && targetNode.get('allowDrop') === false) {
  451 + return false;
  452 + }
  453 +
  454 + // If the target record is in the dragged dataset, then invalid drop
  455 + if (Ext.Array.contains(draggedRecords, targetNode)) {
  456 + return false;
  457 + }
  458 +
  459 + if (dataLength > 1)
  460 + return false;
  461 + var draggedRecord = draggedRecords[0];
  462 +
  463 + return me.isValidToDrop(draggedRecord,targetNode,position);
  464 + },
  465 + onPlotContainerDrop : function(dd, e, data){
  466 + if (data.records.length != 1)
  467 + return false;
  468 + return me.dropRecord(data.records[0],null,null);
  469 + },
  470 + onPlotNodeDrop : function(n, dd, e, data){
  471 + if (data.records.length != 1)
  472 + return false;
  473 + return me.dropRecord(data.records[0],this.view.getRecord(n),this.getPosition(e,n));
  474 + },
  475 + onPlotContainerOver : function(dd, e, data) {
  476 + if (data.records.length != 1)
  477 + return false;
  478 + var draggedRecord = data.records[0];
  479 + return me.isValidToDrop(draggedRecord,null,'append') ? this.dropAllowed : this.dropNotAllowed;
  480 + },
  481 + onViewRender : function(view) {
  482 + var me = this;
  483 +
  484 + if (me.enableDrag) {
  485 + me.dragZone = Ext.create('Ext.tree.ViewDragZone', {
  486 + view: view,
  487 + ddGroup: me.dragGroup || me.ddGroup,
  488 + dragText: me.dragText,
  489 + repairHighlightColor: me.nodeHighlightColor,
  490 + repairHighlight: me.nodeHighlightOnRepair
  491 + });
  492 + }
  493 +
  494 + if (me.enableDrop) {
  495 + me.dropZone = Ext.create('Ext.tree.ViewDropZone', {
  496 + view: view,
  497 + ddGroup: me.dropGroup || me.ddGroup,
  498 + allowContainerDrops: me.allowContainerDrops,
  499 + appendOnly: me.appendOnly,
  500 + allowParentInserts: me.allowParentInserts,
  501 + expandDelay: me.expandDelay,
  502 + dropHighlightColor: me.nodeHighlightColor,
  503 + dropHighlight: me.nodeHighlightOnDrop,
  504 + isValidDropPoint : me.isValidDropPoint,
  505 + onContainerDrop : me.onPlotContainerDrop,
  506 + onNodeDrop : me.onPlotNodeDrop,
  507 + onContainerOver : me.onPlotContainerOver
  508 + });
  509 + }
  510 + }
  511 + }
  512 + },
  513 +
119 514 init : function(config) {
120 515 var me = this;
121 516  
... ... @@ -132,8 +527,13 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
132 527 var myConf = {
133 528 store: store,
134 529 rootVisible: false,
  530 + hideHeaders: true,
  531 + viewConfig:{
  532 + plugins: this.getDragAndDropPluginConfig()
  533 + },
135 534 listeners: {
136 535 select: me.onNodeSelect,
  536 + cellclick: me.onCellClick,
137 537 scope: me
138 538 },
139 539 columns: [
... ... @@ -148,16 +548,40 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
148 548 fullVal += rec.getAdditionalText();
149 549 return fullVal;
150 550 }
  551 + },
  552 + {
  553 + menuDisabled: true,
  554 + align: 'center',
  555 + width: 24,
  556 + renderer: function(v,m,record){
  557 + if (record.get('removable'))
  558 + return'<div class="icon-small-remover" style="width: 16px; height: 16px; vertical-align: middle;"></div>';
  559 + else
  560 + return '';
  561 + }
151 562 }
152 563 ],
153 564 tbar: [
154 565 {
155 566 xtype: 'button',
156 567 text: 'Add panel',
  568 + iconCls: 'icon-add',
157 569 handler: function() {
158   - this.addPanel(this.tabObject.createNewPanel());
  570 + var newPabelNode = this.addPanelNode(this.tabObject.createNewPanel());
  571 + this.getSelectionModel().select(newPabelNode);
159 572 },
160 573 scope: this
  574 + },
  575 + '->',
  576 + {
  577 + xtype: 'checkbox',
  578 + boxLabel: 'Simplified View',
  579 + listeners: {
  580 + change: function(combo, newValue, oldValue, eOpts) {
  581 + this.setSimplifiedMode(newValue);
  582 + },
  583 + scope: this
  584 + }
161 585 }
162 586 ]
163 587 };
... ...
js/resources/css/amda.css
... ... @@ -438,6 +438,10 @@ p + p {
438 438 background-image:url( ../images/16x16/plot_axis_color.png ) !important;
439 439 }
440 440  
  441 +.icon-plot-params {
  442 + background-image:url( ../images/16x16/plot_params.png ) !important;
  443 +}
  444 +
441 445 .x-item-disabled .x-form-item-label {
442 446 filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100) !important;
443 447 opacity: 1.0 !important;
... ...
js/resources/images/16x16/plot_params.png 0 → 100644

126 Bytes