<commit_before>// ==========================================================================
// Project:   The M-Project - Mobile HTML5 Application Framework
// Copyright: 2010 M-Way Solutions GmbH. All rights reserved.
// Creator:   Dominik
// Date:      02.11.2010
// License:   Dual licensed under the MIT or GPL Version 2 licenses.
//            http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE
//            http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE
// ==========================================================================

/**
 * @class
 *
 * The root object for LabelViews.
 *
 */
M.LabelView = M.View.extend({

    /**
     * The type of this object.
     *
     * @property {String}
     */
    type: 'M.LabelView',

    /**
     * Mapping to value attribute.
     * text property is mixed in when extended.
     */
    //value: this.text,

    /**
     * Renders a LabelView as a div tag with corresponding data-role attribute and inner text defined by value
     */
    render: function() {
        this.computeValue();
        this.html += '<div id="' + this.id + '"' + this.style() + '>' + this.value + '</div>';
        return this.html;
    },

    /**
     * Updates the value of the label with DOM access by jQuery. 
     */
    renderUpdate: function() {
        this.computeValue();
        $('#' + this.id).html(this.value);
    },

    /**
     * Applies some style-attributes to the label.
     */
    style: function() {
        var html = '';<commit_msg>Added nl2br() to transform new lines to html line breaks<commit_after>// ==========================================================================
// Project:   The M-Project - Mobile HTML5 Application Framework
// Copyright: 2010 M-Way Solutions GmbH. All rights reserved.
// Creator:   Dominik
// Date:      02.11.2010
// License:   Dual licensed under the MIT or GPL Version 2 licenses.
//            http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE
//            http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE
// ==========================================================================

/**
 * @class
 *
 * The root object for LabelViews.
 *
 */
M.LabelView = M.View.extend({

    /**
     * The type of this object.
     *
     * @property {String}
     */
    type: 'M.LabelView',

    /**
     * Determines whether a new line '\n' within the label's value should be transformed
     * into a line break '<br/>' before it is rendered. Default: YES.
     *
     * @property {Boolean}
     */
    newLineToBreak: YES,

    /**
     * Mapping to value attribute.
     * text property is mixed in when extended.
     */
    //value: this.text,

    /**
     * Renders a LabelView as a div tag with corresponding data-role attribute and inner text defined by value
     */
    render: function() {
        this.computeValue();
        this.html += '<div id="' + this.id + '"' + this.style() + '>';
        this.html += this.newLineToBreak ? this.nl2br(this.value) : this.value;
        this.html += '</div>';
        
        return this.html;
    },

    /**
     * Updates the value of the label with DOM access by jQuery. 
     */
    renderUpdate: function() {
        this.computeValue();
        $('#' + this.id).html(this.newLineToBreak ? this.nl2br(this.value) : this.value);
    },

    /**
     * Applies some style-attributes to the label.
     */
    style: function() {
        var html = '';
{'fraction_non_alphanumeric': 0.21587301587301588, 'fraction_numerical': 0.008946608946608947, 'mean_word_length': 2.2978116079923883, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7617091', 'n_tokens_mistral': 1023, 'n_tokens_neox': 956, 'n_words': 277}