Function.js
2.49 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* Project : AMDA-NG
* Name : Function.js
* @plugin amdaModel.Function
* @extends Ext.data.Model
* @brief Data model for functions definition
* @author Benjamin
*/
Ext.define('amdaModel.PromptArg', {
extend: 'Ext.data.Model',
fields : [
{name: 'type', mapping: '@type', type:'string', defaultValue: 'float'},
{name: 'subtype', mapping: '@subtype', type:'string', defaultValue: null},
{name: 'default', mapping: '@default', type:'string', defaultValue: ''},
{name: 'prompt', mapping: '/', type: 'string', defaultValue: ''}
]
});
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: 'group', mapping: '@group', type: 'string', defaultValue: 'space'},
{name: 'args', mapping: '@args', type: 'int', defaultValue: 1},
{name: 'argv', mapping: '@argv', type: 'string'},
{name: 'prompt_param', type: 'string', defaultValue: ''},
{name: 'default_args', type: 'string', defaultValue: ''},
{name: 'info_brief', type: 'string', defaultValue: ''}
],
validations: [
{type: 'presence', field: 'name'},
{type: 'presence', field: 'kind'},
{type: 'presence', field: 'group'}/*,
{type: 'inclusion', field: 'kind', list: ['amda','time']}*/
],
hasMany: {
associationKey : 'prompts',
name: 'prompts',
model: 'amdaModel.PromptArg',
reader : {
type: 'xml',
root: 'prompts',
record : 'prompt'
}
},
proxy: {
type: 'ajax',
url : 'generic_data/Functions/functions.xml',
reader: {
type: 'xml',
root: 'functions',
record: 'function'
}
}
});
Ext.define('amdaModel.ArgListValue', {
extend: 'Ext.data.Model',
fields : [
{name: 'key', mapping: '@key', type:'string'},
{name: 'value', mapping: '@value', type: 'string'},
{name: 'info', mapping: '@info', type: 'string', defaultValue: ''}
]
});
Ext.define('amdaModel.ArgList', {
extend: 'Ext.data.Model',
idProperty: 'id',
fields : [
{name: 'id', mapping: '@id', type: 'string'}
],
hasMany: {
associationKey : 'values',
name: 'values',
model: 'amdaModel.ArgListValue',
reader : {
type: 'xml',
root: 'values',
record : 'value'
}
},
proxy: {
type: 'ajax',
url : 'generic_data/Functions/functions_args_list.xml',
reader: {
type: 'xml',
root: 'argslist',
record: 'arglist'
}
}
});