/** * 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' } } });