Blame view

js/app/models/Function.js 2.49 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
/**
  * Project      :  AMDA-NG
  * Name         : Function.js
  * @plugin 	  amdaModel.Function
  * @extends 	  Ext.data.Model
  * @brief		 Data model for functions definition
ab55087c   Elena.Budnik   idl => math
7
  * @author Benjamin      
16035364   Benjamin Renard   First commit
8
9
  */

23f569c3   Benjamin Renard   Give the possibil...
10
11
12
13
14
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},
f8d37259   Benjamin Renard   Give the possibil...
15
                {name: 'default', mapping: '@default', type:'string', defaultValue: ''},
23f569c3   Benjamin Renard   Give the possibil...
16
17
18
19
		{name: 'prompt', mapping: '/', type: 'string', defaultValue: ''}
	]
});

16035364   Benjamin Renard   First commit
20
Ext.define('amdaModel.Function', {
ab55087c   Elena.Budnik   idl => math
21
22
23
24
25
26
27

	extend: 'Ext.data.Model',
	idProperty: 'text',

	fields : [
		{name: 'name', mapping: '@name', type:'string'},
		{name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'},
9521cade   Elena.Budnik   rm 8441
28
        {name: 'group', mapping: '@group', type: 'string', defaultValue: 'space'},
3cedc95c   Benjamin Renard   Fix functions def...
29
		{name: 'args', mapping: '@args', type: 'int', defaultValue: 1},
ab55087c   Elena.Budnik   idl => math
30
		{name: 'argv', mapping: '@argv', type: 'string'},
4dadc8ac   Elena.Budnik   rm 8444 +
31
32
        {name: 'prompt_param', type: 'string', defaultValue: ''},
        {name: 'default_args', type: 'string', defaultValue: ''},
ab55087c   Elena.Budnik   idl => math
33
34
		{name: 'info_brief', type: 'string', defaultValue: ''}
	],
16035364   Benjamin Renard   First commit
35
  
ab55087c   Elena.Budnik   idl => math
36
37
38
	validations: [
		{type: 'presence', field: 'name'},
		{type: 'presence', field: 'kind'},
9521cade   Elena.Budnik   rm 8441
39
40
        {type: 'presence', field: 'group'}/*,
		{type: 'inclusion', field: 'kind', list: ['amda','time']}*/
ab55087c   Elena.Budnik   idl => math
41
	],
23f569c3   Benjamin Renard   Give the possibil...
42
43
44
45
46
47
48
49
50
51
52
53

	hasMany: {
		associationKey : 'prompts',
		name: 'prompts',
		model: 'amdaModel.PromptArg',
		reader : {
			type: 'xml',
			root: 'prompts',
			record : 'prompt'
		}
	},
 
ab55087c   Elena.Budnik   idl => math
54
55
56
57
58
59
60
61
62
	proxy: {
			type: 'ajax',    
			url : 'generic_data/Functions/functions.xml',
			reader: {
				type: 'xml',
				root: 'functions',
				record: 'function'
			}
	}
23f569c3   Benjamin Renard   Give the possibil...
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

});

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'
		}
	}
3cedc95c   Benjamin Renard   Fix functions def...
103
});