Blame view

js/app/models/PlotObjects/PlotFillObject.js 2.57 KB
486cc3c7   Benjamin Renard   Add fill elements...
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
/**
 * 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'}
    ],
    
a971060f   Benjamin Renard   Fix some bugs
34
35
36
37
38
39
40
41
42
43
44
45
46
47
    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;
    },
    
486cc3c7   Benjamin Renard   Add fill elements...
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
    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;
    }
});