diff --git a/generic_data/Functions/functions.xml b/generic_data/Functions/functions.xml index 3f69a47..f14c960 100644 --- a/generic_data/Functions/functions.xml +++ b/generic_data/Functions/functions.xml @@ -88,91 +88,91 @@ GSE to SM transformation --> - + Cross product cross - + Dot product dot - + Absolute value abs - + Arc-cosine acos - + Natural logarithm log - + Logarithm to the base 10 log10 - + Arc-sine asin - + Arc-tangent atan - + Arc-tangent atan_2f - + Closest integer greater than or equal to its argument Ceil - + cosine cos - + Hyperbolic cosine cosh - + deriv() function with possibly unequal point spacing #deriv - + Natural exponential function exp - + Integer Fix - + Closest integer less than or equal to its argument Floor - + Sign Sign - + Sine sin - + Hyperbolic sine sinh - + Tangent tan - + Hyperbolic tangent tanh - + Square root sqrt diff --git a/js/app/models/Function.js b/js/app/models/Function.js index 517c828..a116196 100644 --- a/js/app/models/Function.js +++ b/js/app/models/Function.js @@ -4,43 +4,37 @@ * @plugin amdaModel.Function * @extends Ext.data.Model * @brief Data model for functions definition - * @author Benjamin - * @version $Id: Function.js 1399 2013-03-27 12:44:50Z elena $ - ******************************************************************************** - * FT Id : Date : Name - Description - ******************************************************************************* - * : + * @author Benjamin */ Ext.define('amdaModel.Function', { - - extend: 'Ext.data.Model', - idProperty: 'text', - - fields : [ - {name: 'name', mapping: '@name', type:'string'}, - {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'}, - {name: 'args', mapping: '@args', type: 'int', defaultValue: 0}, - {name: 'argv', mapping: '@argv', type: 'string'}, - {name: 'params', mapping: '@params', type:'int', defaultValue: 1}, - {name: 'prompt', type: 'string', defaultValue: ''}, - {name: 'info_brief', type: 'string', defaultValue: ''} - ], + + extend: 'Ext.data.Model', + idProperty: 'text', + + fields : [ + {name: 'name', mapping: '@name', type:'string'}, + {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'}, + {name: 'args', mapping: '@args', type: 'int', defaultValue: 0}, + {name: 'argv', mapping: '@argv', type: 'string'}, + {name: 'params', mapping: '@params', type:'int', defaultValue: 1}, + {name: 'prompt', type: 'string', defaultValue: ''}, + {name: 'info_brief', type: 'string', defaultValue: ''} + ], - validations: [ - {type: 'presence', field: 'name'}, - {type: 'presence', field: 'kind'}, - {type: 'inclusion', field: 'kind', list: ['idl','amda','time','sliding']} - ], + validations: [ + {type: 'presence', field: 'name'}, + {type: 'presence', field: 'kind'}, + {type: 'inclusion', field: 'kind', list: ['math','amda','time','sliding']} + ], - proxy: { - type: 'ajax', -//TODO url into generique settings - url : 'generic_data/Functions/functions.xml', - reader: { - type: 'xml', - root: 'functions', - record: 'function' - } - } + proxy: { + type: 'ajax', + url : 'generic_data/Functions/functions.xml', + reader: { + type: 'xml', + root: 'functions', + record: 'function' + } + } }); \ No newline at end of file diff --git a/js/app/views/CalculatorUI.js b/js/app/views/CalculatorUI.js index c445f34..c8f75ed 100644 --- a/js/app/views/CalculatorUI.js +++ b/js/app/views/CalculatorUI.js @@ -4,16 +4,7 @@ * @class amdaDesktop.ExplorerModule * @extends Ext.util.Observable * @brief Calculator Plugin used in SearchUI and ParameterUI - * @author elena - * @version $Id: CalculatorUI.js 1399 2013-03-27 12:44:50Z elena $ - * - ****************************************************************************** - * FT Id : Date : Name - Description - ****************************************************************************** - * - * : :06/05/2011: CDA - Extjs 4.0.0 Migration - * : :16/06/2011: elena - resolve rendering problem (sencha support) - * : :26/10/2011: BRE -autoload constants and functions from xml files + * @author elena */ @@ -27,21 +18,21 @@ var CalculatorData = ['1','2','3','4','5','6','7','8','9','0','(',')','[',']','+ Ext.define('amdaUI.CalculatorUI', { extend: 'Ext.util.Observable', - + requires : [ - 'amdaModel.Constant', - 'amdaModel.Function' + 'amdaModel.Constant', + 'amdaModel.Function' ], alias: 'plugin.calculator', statics : { - constantStore : null, - functionStore : null + constantStore : null, + functionStore : null }, win: null, - + constructor: function(config) { Ext.apply(this, config); this.callParent(arguments); @@ -49,18 +40,17 @@ Ext.define('amdaUI.CalculatorUI', { init: function(cmp) { - this.hostCmp = cmp; - this.hostCmp.on({ - scope: this, - added: function(){ - this.hostCmp.ownerCt.on({ - render: this.onRender, - show: this.onShow, - hide : this.onHide, - scope: this }); - } - }); - + this.hostCmp = cmp; + this.hostCmp.on({ + scope: this, + added: function(){ + this.hostCmp.ownerCt.on({ + render: this.onRender, + show: this.onShow, + hide : this.onHide, + scope: this }); + } + }); }, onRender: function() @@ -88,24 +78,24 @@ Ext.define('amdaUI.CalculatorUI', { }, getConstrainVector: function(constrainTo){ var me = this; - if (me.constrain || me.constrainHeader) { - constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent(); - return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo); - } - } + if (me.constrain || me.constrainHeader) { + constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent(); + return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo); + } + } }); //load constants store if (!amdaUI.CalculatorUI.constantStore) { - amdaUI.CalculatorUI.constantStore = Ext.create('Ext.data.Store',{model: 'amdaModel.Constant'}); - amdaUI.CalculatorUI.constantStore.load({ - scope : this, - callback: function(records, operation, success) - { - this.createConstantBtns(); - } - }); + amdaUI.CalculatorUI.constantStore = Ext.create('Ext.data.Store',{model: 'amdaModel.Constant'}); + amdaUI.CalculatorUI.constantStore.load({ + scope : this, + callback: function(records, operation, success) + { + this.createConstantBtns(); + } + }); } else this.createConstantBtns(); @@ -113,19 +103,17 @@ Ext.define('amdaUI.CalculatorUI', { //load functions store if (!amdaUI.CalculatorUI.functionStore) { - amdaUI.CalculatorUI.functionStore = Ext.create('Ext.data.Store',{model: 'amdaModel.Function'}); - amdaUI.CalculatorUI.functionStore.load({ - scope : this, - callback: function(records, operation, success) - { - this.createAllFunctionBtns(); - } - }); + amdaUI.CalculatorUI.functionStore = Ext.create('Ext.data.Store',{model: 'amdaModel.Function'}); + amdaUI.CalculatorUI.functionStore.load({ + scope : this, + callback: function(records, operation, success) + { + this.createAllFunctionBtns(); + } + }); } else this.createAllFunctionBtns(); - - }, onShow: function() { @@ -350,40 +338,40 @@ Ext.define('amdaUI.CalculatorUI', { }, createConstantBtns : function(){ - var constTab = this.win.query('#calc_tab_const_id'); - - if (constTab.length < 1) - return; + var constTab = this.win.query('#calc_tab_const_id'); + + if (constTab.length < 1) + return; - amdaUI.CalculatorUI.constantStore.each( function(c){ - constTab[0].add( - { - text: c.get('name'), - tooltip: c.get('units') == '' ? c.get('info')+'
'+c.get('value') : - c.get('info')+'
'+c.get('value')+' '+c.get('units'), - scope: this, - handler: function(b,e){ - // keep selection into construction field - var selection = this.hostCmp.constructionField.getSelection(); - // the new value of construction field - var newConstruction = ""; - // replacement of selection into construction field by text of clicked button - newConstruction = selection.beforeText + '@'+b.text; - var caretPos = newConstruction.length; - newConstruction += selection.afterText; - this.hostCmp.constructionField.setValue(newConstruction); - // set Caret Position after inserted Text - this.hostCmp.constructionField.setCaretPosition(caretPos); - } - }); + amdaUI.CalculatorUI.constantStore.each( function(c){ + constTab[0].add( + { + text: c.get('name'), + tooltip: c.get('units') == '' ? c.get('info')+'
'+c.get('value') : + c.get('info')+'
'+c.get('value')+' '+c.get('units'), + scope: this, + handler: function(b,e){ + // keep selection into construction field + var selection = this.hostCmp.constructionField.getSelection(); + // the new value of construction field + var newConstruction = ""; + // replacement of selection into construction field by text of clicked button + newConstruction = selection.beforeText + '@'+b.text; + var caretPos = newConstruction.length; + newConstruction += selection.afterText; + this.hostCmp.constructionField.setValue(newConstruction); + // set Caret Position after inserted Text + this.hostCmp.constructionField.setCaretPosition(caretPos); + } + }); },this); }, createAllFunctionBtns : function() { - this.createFunctionBtns('IdlFunctions','Simple Maths'); - this.createFunctionBtns('TimeFunctions','Statistics'); - this.createFunctionBtns('FunctionsSliding','Statistics/Sliding'); + this.createFunctionBtns('MathFunctions','Simple Maths'); + this.createFunctionBtns('TimeFunctions','Statistics'); + this.createFunctionBtns('FunctionsSliding','Statistics/Sliding'); this.createFunctionBtns('AmdaFunctions','Space Physics'); }, @@ -396,8 +384,8 @@ Ext.define('amdaUI.CalculatorUI', { switch (item) { - case 'IdlFunctions' : - amdaUI.CalculatorUI.functionStore.filter('kind','idl'); + case 'MathFunctions' : + amdaUI.CalculatorUI.functionStore.filter('kind','math'); break; case 'AmdaFunctions' : amdaUI.CalculatorUI.functionStore.filter('kind','amda'); @@ -421,10 +409,9 @@ Ext.define('amdaUI.CalculatorUI', { { text: f.get('name'), args: f.get('args'), - params: f.get('params'),//"+", + params: f.get('params'), prompt: f.get('prompt'), tooltip: f.get('info_brief'), - // disabled: f.get('argv') == 'vector', scope: this, handler: function(b,e){ var selection = this.hostCmp.constructionField.getSelection(); @@ -469,22 +456,21 @@ Ext.define('amdaUI.CalculatorUI', { } } }); - }, - this - ); - //clear filter - amdaUI.CalculatorUI.functionStore.clearFilter(); - + }, + this + ); + //clear filter + amdaUI.CalculatorUI.functionStore.clearFilter(); }, getItems: function(item) { - switch (item) - { - case 'Calculator': - return this.getCalculatorBtn(); + switch (item) + { + case 'Calculator': + return this.getCalculatorBtn(); default: break; - } - return []; - } + } + return []; + } }); -- libgit2 0.21.2