Blame view

js/app/models/PlotObjects/PlotFillObject.js 2.5 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
    setDefaultValues: function()
    {
b1dc2eb3   Erdogan Furkan   More modifications
50
    	this.set('fill-type', amdaDefaultValues.plot.fills.type);
486cc3c7   Benjamin Renard   Add fill elements...
51
52
53
    	this.set('fill-firstserie-id', null);
    	this.set('fill-secondserie-id', null);
    	this.set('fill-constant-id', null);
b1dc2eb3   Erdogan Furkan   More modifications
54
55
    	this.set('fill-greater-color', amdaDefaultValues.plot.fills.greaterColor);
    	this.set('fill-less-color', amdaDefaultValues.plot.fills.lessColor);
486cc3c7   Benjamin Renard   Add fill elements...
56
57
58
59
    },
    
    getShortInfo : function()
    {
4f728fd9   Erdogan Furkan   For now 2
60
    	var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaDefaultConfigs.availableFillTypes, this.get('fill-type'));
486cc3c7   Benjamin Renard   Add fill elements...
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
		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;
    }
});