Parameter.js
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Project : AMDA-NG
* Name : parameter.js
* Description : Parameter Business Object Definition
* @class amdaModel.Parameter
* @extends amdaModel.AmdaObject
*
* @author cdarmon
* @version $Id: Parameter.js 1435 2013-04-04 14:24:04Z elena $
******************************************************************************
* FT Id : Date : Name - Description
******************************************************************************
* : :15/12/2010: CDA – creation
* : :22/06/2011: elena - extends generic class AmdaObject
*/
Ext.define('amdaModel.Parameter', {
extend: 'amdaModel.AmdaObject',
fields : [
{name: 'timestep', type: 'string'},
{name: 'units', type: 'string'},
{name: 'buildchain', type: 'string'},
{name: 'description', type: 'string'},
{name: 'ytitle', type: 'string'}
],
/**
* get parameter values into object to be sent to Server
* @return object
*/
//TODO utf8_encode() and Ext.urlEncode() ???
getJsonValues : function (hasId) {
var myValues = new Object();
if (hasId) {
myValues.id = this.get('id');
}
myValues.name = this.get('name');
myValues.buildchain = this.get('buildchain').replace(/\n/g," ");
myValues.timestep = this.get('timestep');
myValues.leaf = true;
if (this.get('ytitle').match(/[a-z,0-9]/gi) != null) {
myValues.ytitle = this.get('ytitle');
}
if (this.get('description').match(/[a-z,0-9]/gi) != null) {
myValues.description = this.get('description');
}
if (this.get('units').match(/[a-z,0-9]/gi) != null) {
myValues.units = this.get('units');
}
myValues.nodeType = amdaModel.DerivedParamNode.nodeType;
return myValues;
}
});