Code coverage report for Model/GraphsModel/Legend.js

Statements: 100% (30 / 30)      Branches: 68.75% (11 / 16)      Functions: 87.5% (7 / 8)      Lines: 100% (30 / 30)      Ignored: none     

All files » Model/GraphsModel/ » Legend.js
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 80 81                                                1       1 80 80 80     80 73 73   73 4   73 4           195 3 3 3   3 3   3 3         195 26   195 5   195 26       1   195 80     195  
/*jshint node: true */
'use strict';
 
/*
* Name :  Legend.js
* Module : FrontEnd::Model::GraphsModel
* Location : /frontend/app/Model/GraphsModel
*
* History :
* Version       Date        Programmer                  Description
* ===============================================================================================================
* 1.0.0         2015-05-17  Maria Giovanna Chinellato   Tested
*
* 0.1.2         2015-05-15  Maria Giovanna Chinellato   Fix attributes
*
* 0.1.1         2015-05-15  Francesco Rossetto          Variuos Fix
*
* 0.1.0         2015-05-14  Maria Giovanna Chinellato   Add attributes and methods
*
* 0.0.1         2015-05-14  Maria Giovanna Chinellato   Initial code      
* ===============================================================================================================
*
*/
 
angular.module('norris-nrti')
.factory('LegendFactory', function(){
 
    // costruttore di Legend
    function Legend(info){
        this._position = 'E';
        this._fontColor = '#000';
        this._backgroundColor = '#FFF';
 
        // imposta i valori dei campi dati se il JSON 'info' รจ definito, altrimenti lascia i valori di default
        if (info !== undefined){
            Eif (info.position !== undefined) {
                this._position = info.position;
            }
            if (info.fontColor !== undefined) {
                this._fontColor = info.fontColor;
            }
            if (info.backgroundColor !== undefined) {
                this._backgroundColor = info.backgroundColor;
            }
        }
    }
 
    // funzione che aggiorna i valori dei campi dati della legenda
    Legend.prototype.updateParameters = function(info){
        Eif (info !== undefined) {
            Eif (info.position !== undefined) {
                this._position = info.position;
            }
            Eif (info.fontColor !== undefined) {
                this._fontColor = info.fontColor;
            }
            Eif (info.backgroundColor !== undefined) {
                this._backgroundColor = info.backgroundColor;
            }
        }
    };
 
    Legend.prototype.getPosition = function(){
        return this._position; // ritorna la posizione della legenda
    };
    Legend.prototype.getFontColor = function(){
        return this._fontColor; // ritorna il colore del testo della legenda
    };
    Legend.prototype.getBackgroundColor = function(){
        return this._backgroundColor; // ritorna il colore di background della legenda
    };
 
    // costruttore di default di LegendFactory
    function LegendFactory() {}
 
    LegendFactory.build = function(info) {
        return new Legend(info); // ritorna una nuova istanza di Legend
    };
    
    return( LegendFactory );
});