diff --git a/js/app/models/PlotObjects/PlotPanelObject.js b/js/app/models/PlotObjects/PlotPanelObject.js index 5662cc5..8432698 100644 --- a/js/app/models/PlotObjects/PlotPanelObject.js +++ b/js/app/models/PlotObjects/PlotPanelObject.js @@ -223,7 +223,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', { break; case 'xyPlot' : //X Axis - var recs = this.axes().add({id : 'x'}); + var recs = this.axes().add({id : 'xaxis_id'}); recs[0].setDefaultValues('x'); //Y Left Axis recs = this.axes().add({id : 'y-left'}); @@ -237,7 +237,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', { break; case 'instantPlot' : //X Axis - var recs = this.axes().add({id : 'x'}); + var recs = this.axes().add({id : 'xaxis_id'}); recs[0].setDefaultValues('x'); //Y Left Axis recs = this.axes().add({id : 'y-left'}); diff --git a/js/app/views/PlotComponents/EraseTrigger.js b/js/app/views/PlotComponents/EraseTrigger.js new file mode 100644 index 0000000..3d48f9e --- /dev/null +++ b/js/app/views/PlotComponents/EraseTrigger.js @@ -0,0 +1,25 @@ +/** + * Project : AMDA-NG + * Name : EraseTrigger.js + * @class amdaPlotComp.EraseTrigger + * @extends Ext.form.field.Trigger + * @brief Erase button used to define a dropped parameter (cf. function addStandardParamDropTarget of PlotStandardForm) + * @author Benjamin Renard + * @version $Id: EraseTrigger.js benjamin $ + */ + +Ext.define('amdaPlotComp.EraseTrigger', { + extend: 'Ext.form.field.Trigger', + alias: 'widget.erasetrigger', + initComponent: function () { + var me = this; + + me.triggerCls = 'x-form-clear-trigger'; // native ExtJS class & icon + + me.callParent(arguments); + }, + // override onTriggerClick + onTriggerClick: function() { + this.setValue(''); + } +}); \ No newline at end of file diff --git a/js/app/views/PlotComponents/PlotStandardForm.js b/js/app/views/PlotComponents/PlotStandardForm.js index 49075e6..0a7926b 100644 --- a/js/app/views/PlotComponents/PlotStandardForm.js +++ b/js/app/views/PlotComponents/PlotStandardForm.js @@ -12,7 +12,8 @@ Ext.define('amdaPlotComp.PlotStandardForm', { extend: 'Ext.form.Panel', requires : [ - 'amdaPlotObj.PlotObjectConfig' + 'amdaPlotObj.PlotObjectConfig', + 'amdaPlotComp.EraseTrigger' ], //Object associated to this form @@ -249,10 +250,9 @@ Ext.define('amdaPlotComp.PlotStandardForm', { addStandardParamDropTarget: function(name, label, onChange) { return { - xtype: 'textfield', + xtype: 'erasetrigger', name: name, fieldLabel: label, - readOnly: true, emptyText: 'Drop a parameter', listeners: { change: function(field, newValue, oldValue, eOpts) { @@ -269,8 +269,36 @@ Ext.define('amdaPlotComp.PlotStandardForm', { notifyDrop: function(ddSource, e, data) { var selectedRecord = ddSource.dragData.records[0]; - field.setValue(selectedRecord.get('id')); - + switch (selectedRecord.$className) + { + case 'amdaModel.LocalParamNode' : + case 'amdaModel.RemoteParamNode' : + case 'amdaModel.RemoteSimuParamNode' : + if (!selectedRecord.get('isParameter') || selectedRecord.get('disable')) + return false; + if (selectedRecord.get('alias') != "" ) + field.setValue("#"+selectedRecord.get('alias')); + else + field.setValue(selectedRecord.get('id')); + return true; + case 'amdaModel.AliasNode' : + if (!selectedRecord.isLeaf()) + return false; + field.setValue("#"+selectedRecord.get('text')); + return true; + case 'amdaModel.DerivedParamNode' : + if (!selectedRecord.isLeaf()) + return false; + field.setValue("ws_"+selectedRecord.get('text')); + return true; + case 'amdaModel.MyDataParamNode' : + if (!selectedRecord.isLeaf()) + return false; + field.setValue("wsd_"+selectedRecord.get('text')); + return true; + default : + return false; + } return true; } } -- libgit2 0.21.2