Source: widgets/guide/nextdayasset.js

define('application/widgets/guide/nextdayasset', [
    'rofl/widgets/button',
    'rofl/widgets/label',
    'application/widgets/pointerfocusableasset'
], function (
    Button,
    Label,
    PointerFocusableButton
) {
    'use strict';

    return PointerFocusableButton.extend({

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

            this._buildNextAsset();
        },

        /**
         * Returns string of date.
         *
         * @returns {string} - Date in string form.
         */
        getText: function () {
            if (this._dateLabel) {
                return this._dateLabel.getText();
            }
        },

        /**
         * Sets buttons date label.
         *
         * @param {string} date - Next date string.
         */
        setDate: function (date) {
            var dateLabel = this._dateLabel = new Label({ text: date, classNames: ['date-label'] });

            this._assetbutton.appendChildWidget(dateLabel);
        },

        /**
        * Builds next asset button.
        *
        * @private
        */
        _buildNextAsset: function () {
            var assetButton = this._assetbutton = new Button(),
                icon = new Label({ text: '', classNames: ['icon', 'icon-chevron-right'] });

            assetButton.addClass('assetbutton');
            assetButton.appendChildWidget(icon);
            this.appendChildWidget(assetButton);
        }
    });
});