Commit eac92219676ad28c922ade098fe982208e322a0e

Authored by Benjamin Renard
1 parent b1a45580

Do not call onChange callback during rebuild + Move a specific message for plot in the plot module

js/app/views/ParamArgumentsUI.js
@@ -19,7 +19,7 @@ Ext.define('amdaUI.ParamArgumentsUI', { @@ -19,7 +19,7 @@ Ext.define('amdaUI.ParamArgumentsUI', {
19 onChange: null, 19 onChange: null,
20 onModifyHeight: null, 20 onModifyHeight: null,
21 pluginOwner: null, 21 pluginOwner: null,
22 - isFirstMsg : true, 22 + inRebuild : false,
23 23
24 constructor: function(config) { 24 constructor: function(config) {
25 this.init(config); 25 this.init(config);
@@ -66,8 +66,8 @@ Ext.define('amdaUI.ParamArgumentsUI', { @@ -66,8 +66,8 @@ Ext.define('amdaUI.ParamArgumentsUI', {
66 paramRequestObject.set('dim2-index', 0); 66 paramRequestObject.set('dim2-index', 0);
67 } 67 }
68 } 68 }
69 - paramRequestObject.set('is-init', true);  
70 } 69 }
  70 + paramRequestObject.set('is-init', true);
71 } 71 }
72 me.rebuildAll(paramInfo, uiScope); 72 me.rebuildAll(paramInfo, uiScope);
73 } 73 }
@@ -153,6 +153,7 @@ Ext.define('amdaUI.ParamArgumentsUI', { @@ -153,6 +153,7 @@ Ext.define('amdaUI.ParamArgumentsUI', {
153 }, 153 },
154 154
155 rebuildAll: function(paramInfoResult , uiScope) { 155 rebuildAll: function(paramInfoResult , uiScope) {
  156 + this.inRebuild = true;
156 //Rebuild arguments selection 157 //Rebuild arguments selection
157 this.rebuildArguments(paramInfoResult, uiScope); 158 this.rebuildArguments(paramInfoResult, uiScope);
158 //Add default template args values 159 //Add default template args values
@@ -199,6 +200,7 @@ Ext.define('amdaUI.ParamArgumentsUI', { @@ -199,6 +200,7 @@ Ext.define('amdaUI.ParamArgumentsUI', {
199 } 200 }
200 else 201 else
201 item.setValue(this.paramRequestObject.get(item.argId)); 202 item.setValue(this.paramRequestObject.get(item.argId));
  203 + this.inRebuild = false;
202 }, this); 204 }, this);
203 }, 205 },
204 206
@@ -310,26 +312,10 @@ Ext.define('amdaUI.ParamArgumentsUI', { @@ -310,26 +312,10 @@ Ext.define('amdaUI.ParamArgumentsUI', {
310 hidden: (relatedTable ? relatedTable.variable : false), 312 hidden: (relatedTable ? relatedTable.variable : false),
311 listeners: { 313 listeners: {
312 change: function(field, newValue, oldValue, eOpts) { 314 change: function(field, newValue, oldValue, eOpts) {
313 - if (this.paramRequestObject.get('type') == '2' && this.isFirstMsg)  
314 - {  
315 - if (relatedDim == 'dim2' && newValue == '*') {  
316 - var previousCombo = field.previousSibling();  
317 -  
318 - if (previousCombo instanceof Ext.form.FieldSet)  
319 - previousCombo = previousCombo.previousSibling();  
320 -  
321 - if (previousCombo instanceof Ext.form.ComboBox && previousCombo.argId == 'dim1' && previousCombo.getValue() == '*' && !previousCombo.isDisabled()) {  
322 - myDesktopApp.warningMsg('If argument <i>All</i> is set for both dimensions output will be the total sum <b>(not spectra!)</b>');  
323 - this.isFirstMsg = false;  
324 - }  
325 -  
326 - }  
327 - }  
328 -  
329 - this.paramRequestObject.set(relatedDim+'-index', newValue);  
330 - if (this.onChange != null)  
331 - this.onChange(uiScope, relatedDim, newValue, oldValue, false);  
332 - }, 315 + this.paramRequestObject.set(relatedDim+'-index', newValue);
  316 + if (!this.inRebuild && (this.onChange != null))
  317 + this.onChange(uiScope, relatedDim, newValue, oldValue, false);
  318 + },
333 scope: this 319 scope: this
334 } 320 }
335 321
@@ -363,7 +349,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -363,7 +349,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
363 field.up().down('[name=value_max_'+relatedDim+']').setVisible(newValue == 1); 349 field.up().down('[name=value_max_'+relatedDim+']').setVisible(newValue == 1);
364 field.up().down('[name=index_min_'+relatedDim+']').setVisible(newValue == 2); 350 field.up().down('[name=index_min_'+relatedDim+']').setVisible(newValue == 2);
365 field.up().down('[name=index_max_'+relatedDim+']').setVisible(newValue == 2); 351 field.up().down('[name=index_max_'+relatedDim+']').setVisible(newValue == 2);
366 - if (this.onChange != null) 352 + if (!this.inRebuild && (this.onChange != null))
367 this.onChange(uiScope, relatedDim, newValue, oldValue, false); 353 this.onChange(uiScope, relatedDim, newValue, oldValue, false);
368 }, 354 },
369 scope: this 355 scope: this
@@ -378,7 +364,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -378,7 +364,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
378 listeners: { 364 listeners: {
379 change: function(field, newValue, oldValue, eOpts) { 365 change: function(field, newValue, oldValue, eOpts) {
380 this.paramRequestObject.set(relatedDim+'-min-value', newValue); 366 this.paramRequestObject.set(relatedDim+'-min-value', newValue);
381 - if (this.onChange != null) 367 + if (!this.inRebuild && (this.onChange != null))
382 this.onChange(uiScope, relatedDim, newValue, oldValue, false); 368 this.onChange(uiScope, relatedDim, newValue, oldValue, false);
383 }, 369 },
384 scope: this 370 scope: this
@@ -393,7 +379,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -393,7 +379,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
393 listeners: { 379 listeners: {
394 change: function(field, newValue, oldValue, eOpts) { 380 change: function(field, newValue, oldValue, eOpts) {
395 this.paramRequestObject.set(relatedDim+'-max-value', newValue); 381 this.paramRequestObject.set(relatedDim+'-max-value', newValue);
396 - if (this.onChange != null) 382 + if (!this.inRebuild && (this.onChange != null))
397 this.onChange(uiScope, relatedDim, newValue, oldValue, false); 383 this.onChange(uiScope, relatedDim, newValue, oldValue, false);
398 }, 384 },
399 scope: this 385 scope: this
@@ -410,7 +396,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -410,7 +396,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
410 listeners: { 396 listeners: {
411 change: function(field, newValue, oldValue, eOpts) { 397 change: function(field, newValue, oldValue, eOpts) {
412 this.paramRequestObject.set(relatedDim+'-min-index', newValue); 398 this.paramRequestObject.set(relatedDim+'-min-index', newValue);
413 - if (this.onChange != null) 399 + if (!this.inRebuild && (this.onChange != null))
414 this.onChange(uiScope, relatedDim, newValue, oldValue, false); 400 this.onChange(uiScope, relatedDim, newValue, oldValue, false);
415 }, 401 },
416 scope: this 402 scope: this
@@ -427,7 +413,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -427,7 +413,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
427 listeners: { 413 listeners: {
428 change: function(field, newValue, oldValue, eOpts) { 414 change: function(field, newValue, oldValue, eOpts) {
429 this.paramRequestObject.set(relatedDim+'-max-index', newValue); 415 this.paramRequestObject.set(relatedDim+'-max-index', newValue);
430 - if (this.onChange != null) 416 + if (!this.inRebuild && (this.onChange != null))
431 this.onChange(uiScope, relatedDim, newValue, oldValue, false); 417 this.onChange(uiScope, relatedDim, newValue, oldValue, false);
432 }, 418 },
433 scope: this 419 scope: this
@@ -454,7 +440,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -454,7 +440,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
454 } 440 }
455 fieldset.down('[name=sum_type_'+relatedDim+']').setValue(this.paramRequestObject.get(relatedDim+'-sum-type')); 441 fieldset.down('[name=sum_type_'+relatedDim+']').setValue(this.paramRequestObject.get(relatedDim+'-sum-type'));
456 indexesCombo.setDisabled(true); 442 indexesCombo.setDisabled(true);
457 - if (this.onChange != null) 443 + if (!this.inRebuild && (this.onChange != null))
458 this.onChange(uiScope, relatedDim, true, false, false); 444 this.onChange(uiScope, relatedDim, true, false, false);
459 if (this.onModifyHeight) 445 if (this.onModifyHeight)
460 this.onModifyHeight(this.pluginOwner); 446 this.onModifyHeight(this.pluginOwner);
@@ -462,7 +448,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -462,7 +448,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
462 collapse: function(fieldset, eOpts) { 448 collapse: function(fieldset, eOpts) {
463 indexesCombo.setDisabled(false); 449 indexesCombo.setDisabled(false);
464 this.paramRequestObject.set(relatedDim+'-sum-type', 0); 450 this.paramRequestObject.set(relatedDim+'-sum-type', 0);
465 - if (this.onChange != null) 451 + if (!this.inRebuild && (this.onChange != null))
466 this.onChange(uiScope, relatedDim, false, true, false); 452 this.onChange(uiScope, relatedDim, false, true, false);
467 if (this.onModifyHeight) 453 if (this.onModifyHeight)
468 this.onModifyHeight(this.pluginOwner); 454 this.onModifyHeight(this.pluginOwner);
@@ -493,7 +479,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -493,7 +479,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
493 template_args = {}; 479 template_args = {};
494 template_args[key] = newValue; 480 template_args[key] = newValue;
495 me.paramRequestObject.set('template_args', template_args); 481 me.paramRequestObject.set('template_args', template_args);
496 - if (me.onChange != null) 482 + if (!this.inRebuild && (me.onChange != null))
497 me.onChange(uiScope, key, newValue, oldValue, true); 483 me.onChange(uiScope, key, newValue, oldValue, true);
498 }, 484 },
499 scope: me 485 scope: me
@@ -529,7 +515,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -529,7 +515,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
529 template_args = {}; 515 template_args = {};
530 template_args[key] = newValue; 516 template_args[key] = newValue;
531 me.paramRequestObject.set('template_args', template_args); 517 me.paramRequestObject.set('template_args', template_args);
532 - if (me.onChange != null) 518 + if (!this.inRebuild && (me.onChange != null))
533 me.onChange(uiScope, key, newValue, oldValue, true); 519 me.onChange(uiScope, key, newValue, oldValue, true);
534 }, 520 },
535 scope: me 521 scope: me
@@ -551,7 +537,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, { @@ -551,7 +537,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
551 template_args = {}; 537 template_args = {};
552 template_args[key] = newValue; 538 template_args[key] = newValue;
553 me.paramRequestObject.set('template_args', template_args); 539 me.paramRequestObject.set('template_args', template_args);
554 - if (me.onChange != null) 540 + if (!this.inRebuild && (me.onChange != null))
555 me.onChange(uiScope, key, newValue, oldValue, true); 541 me.onChange(uiScope, key, newValue, oldValue, true);
556 }, 542 },
557 scope: me 543 scope: me
js/app/views/PlotComponents/PlotParamForm.js
@@ -27,6 +27,8 @@ Ext.define(&#39;amdaPlotComp.PlotParamForm&#39;, { @@ -27,6 +27,8 @@ Ext.define(&#39;amdaPlotComp.PlotParamForm&#39;, {
27 drawingOptionsFormsManager : new Ext.AbstractManager(), 27 drawingOptionsFormsManager : new Ext.AbstractManager(),
28 28
29 paramArgs : null, 29 paramArgs : null,
  30 +
  31 + isFirstMsg: true,
30 32
31 destroy: function() { 33 destroy: function() {
32 this.drawingOptionsFormsManager.each(function (key, value, length) { 34 this.drawingOptionsFormsManager.each(function (key, value, length) {
@@ -108,6 +110,11 @@ Ext.define(&#39;amdaPlotComp.PlotParamForm&#39;, { @@ -108,6 +110,11 @@ Ext.define(&#39;amdaPlotComp.PlotParamForm&#39;, {
108 }, 110 },
109 111
110 onChangeParamArgs: function(uiScope, args_key, newValue, oldValue, isTemplateArg) { 112 onChangeParamArgs: function(uiScope, args_key, newValue, oldValue, isTemplateArg) {
  113 + if ((uiScope.isFirstMsg) && (uiScope.object.get('type') == 2) && (uiScope.object.get('dim1-sum-type') == 0) && (uiScope.object.get('dim2-sum-type') == 0) &&
  114 + (uiScope.object.get('dim1-index') == '*') && (uiScope.object.get('dim2-index') == '*')) {
  115 + uiScope.isFirstMsg = false;
  116 + myDesktopApp.warningMsg('If argument <i>All</i> is set for both dimensions output will be the total sum <b>(not spectra!)</b>');
  117 + }
111 uiScope.crtTree.refresh(); 118 uiScope.crtTree.refresh();
112 }, 119 },
113 120