<commit_before>/*
 *     Copyright (c) 2008-2015 CoNWeT Lab., Universidad Politécnica de Madrid
 *
 *     This file is part of Wirecloud Platform.
 *
 *     Wirecloud Platform is free software: you can redistribute it and/or
 *     modify it under the terms of the GNU Affero General Public License as
 *     published by the Free Software Foundation, either version 3 of the
 *     License, or (at your option) any later version.
 *
 *     Wirecloud is distributed in the hope that it will be useful, but WITHOUT
 *     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
 *     License for more details.
 *
 *     You should have received a copy of the GNU Affero General Public License
 *     along with Wirecloud Platform.  If not, see
 *     <http://www.gnu.org/licenses/>.
 *
 */

/* global CSSPrimitiveValue, StyledElements */


(function (se, utils) {

    "use strict";

    // ==================================================================================
    // CLASS DEFINITION
    // ==================================================================================

    /**
     * Create a new instance of class StyledElement.
     *
     * @constructor
     * @param {String[]} events [description]
     */
    se.StyledElement = utils.defineClass({

        constructor: function StyledElement(events) {
            this.wrapperElement = null;
            this.parentElement = null;

            Object.defineProperties(this, {

                enabled: {
                    get: function get() {
                        return !this.hasClassName('disabled');
                    },
                    set: function set(value) {
                        this.toggleClassName('disabled', !value)
                            ._onenabled(value);
                    }
                },

                hidden: {
                    get: function get() {
                        return this.hasClassName('hidden');
                    },
                    set: function set(value) {
                        this.toggleClassName('hidden', value)
                            ._onhidden(value);
                    }
                }

            });

            this.mixinClass(0, ['hide', 'show'].concat(events));
        },

        mixins: [se.ObjectWithEvents],

        members: {

            /**
             * @protected
             */
            _onenabled: function _onenabled(enabled) {
                // This member can be implemented by subclass.
            },

            /**
             * @protected
             */
            _onhidden: function _onhidden(hidden) {
                // This member can be implemented by subclass.
            },

            /**<commit_msg>Check events is an array before concatenating it<commit_after>/*
 *     Copyright (c) 2008-2015 CoNWeT Lab., Universidad Politécnica de Madrid
 *
 *     This file is part of Wirecloud Platform.
 *
 *     Wirecloud Platform is free software: you can redistribute it and/or
 *     modify it under the terms of the GNU Affero General Public License as
 *     published by the Free Software Foundation, either version 3 of the
 *     License, or (at your option) any later version.
 *
 *     Wirecloud is distributed in the hope that it will be useful, but WITHOUT
 *     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
 *     License for more details.
 *
 *     You should have received a copy of the GNU Affero General Public License
 *     along with Wirecloud Platform.  If not, see
 *     <http://www.gnu.org/licenses/>.
 *
 */

/* global CSSPrimitiveValue, StyledElements */


(function (se, utils) {

    "use strict";

    // ==================================================================================
    // CLASS DEFINITION
    // ==================================================================================

    /**
     * Create a new instance of class StyledElement.
     *
     * @constructor
     * @param {String[]} events [description]
     */
    se.StyledElement = utils.defineClass({

        constructor: function StyledElement(events) {
            this.wrapperElement = null;
            this.parentElement = null;

            Object.defineProperties(this, {

                enabled: {
                    get: function get() {
                        return !this.hasClassName('disabled');
                    },
                    set: function set(value) {
                        this.toggleClassName('disabled', !value)
                            ._onenabled(value);
                    }
                },

                hidden: {
                    get: function get() {
                        return this.hasClassName('hidden');
                    },
                    set: function set(value) {
                        this.toggleClassName('hidden', value)
                            ._onhidden(value);
                    }
                }

            });

            if (!Array.isArray(events)) {
                events = [];
            }
            this.mixinClass(0, ['hide', 'show'].concat(events));
        },

        mixins: [se.ObjectWithEvents],

        members: {

            /**
             * @protected
             */
            _onenabled: function _onenabled(enabled) {
                // This member can be implemented by subclass.
            },

            /**
             * @protected
             */
            _onhidden: function _onhidden(hidden) {
                // This member can be implemented by subclass.
            },

            /**
{'fraction_non_alphanumeric': 0.14106583072100312, 'fraction_numerical': 0.0034831069313827935, 'mean_word_length': 1.5569902048085484, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4441138', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1262, 'n_words': 414}