Function.js 1.05 KB
/**
  * Project      :  AMDA-NG
  * Name         : Function.js
  * @plugin 	  amdaModel.Function
  * @extends 	  Ext.data.Model
  * @brief		 Data model for functions definition
  * @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: ''}
	],
  
	validations: [
		{type: 'presence', field: 'name'},
		{type: 'presence', field: 'kind'},
		{type: 'inclusion', field: 'kind', list: ['math','amda','time','sliding']}
	],
  
	proxy: {
			type: 'ajax',    
			url : 'generic_data/Functions/functions.xml',
			reader: {
				type: 'xml',
				root: 'functions',
				record: 'function'
			}
	}
});