/** * Project  : AMDA-NG * Name : PlotFillObject.js * @class amdaPlotObj.PlotFillObject * @extends Ext.data.Model * @brief Plot Fill Business Object Definition * @author Benjamin Renard * @version $Id: PlotFillObject.js benjamin $ ****************************************************************************** * FT Id : Date : Name - Description ****************************************************************************** * : :04/09/2015: BRE - file creation */ Ext.define('amdaPlotObj.PlotFillObject', { extend: 'Ext.data.Model', idProperty: 'id', requires: [ 'amdaPlotObj.PlotObjectConfig' ], fields : [ {name: 'id', type: 'int'}, {name: 'fill-type', type: 'string'}, {name: 'fill-firstserie-id', type: 'int', useNull:true}, {name: 'fill-secondserie-id', type: 'int', useNull:true}, {name: 'fill-constant-id', type: 'int', useNull:true}, {name: 'fill-greater-color', type: 'string'}, {name: 'fill-less-color', type: 'string'} ], constructor: function(){ var me = this; me.callParent(arguments); if ((arguments.length > 0) && arguments[0]) { } else { //new object, set default fields values me.setDefaultValues(); } this.dirty = false; }, setDefaultValues: function() { this.set('fill-type', amdaPlotObj.PlotObjectConfig.defaultValues.fills.type); this.set('fill-firstserie-id', null); this.set('fill-secondserie-id', null); this.set('fill-constant-id', null); this.set('fill-greater-color', amdaPlotObj.PlotObjectConfig.defaultValues.fills.greaterColor); this.set('fill-less-color', amdaPlotObj.PlotObjectConfig.defaultValues.fills.lessColor); }, getShortInfo : function() { var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableFillTypes, this.get('fill-type')); return type; }, getJsonValues : function() { var fillValues = new Object(); fillValues['id'] = this.get('id'); fillValues['fill-type'] = this.get('fill-type'); fillValues['fill-firstserie-id'] = this.get('fill-firstserie-id'); fillValues['fill-secondserie-id'] = this.get('fill-secondserie-id'); fillValues['fill-constant-id'] = this.get('fill-constant-id'); fillValues['fill-greater-color'] = this.get('fill-greater-color'); fillValues['fill-less-color'] = this.get('fill-less-color'); return fillValues; } });