Source: widgets/dropdown/item.js

define('application/widgets/dropdown/item', [
    'application/widgets/pointerfocusablebutton',
    'rofl/widgets/label'
], function (
    Button,
    Label
) {
    'use strict';

    return Button.extend({

        /**
         * Initialises the button.
         *
         * @param {string} text - The button text.
         * @param {string} [id] - The id. Optional.
         */
        init: function init (text, id) {
            init.base.call(this, id);

            this._build(text);
        },

        /**
         * Builds the widget.
         *
         * @param {string} text - The text to set.
         * @private
         */
        _build: function (text) {
            var label = this._label = new Label({ text: text || '' });

            this.appendChildWidget(label);
            this._itemValueObject = null;
        },

        /**
         * Sets item object for button.
         *
         * @param {Object} text - Text for button.
         */
        setValueObject: function (text) {
            this._itemValueObject = text;
        },

        getItemValueObject: function () {
            return this._itemValueObject;
        }
    });
});