/// class PD.Manage.Modules.ListSettingFeature

/**
@class ListSettingFeature
@constructor
@namespace Web.UI.Canvas.Charts
@extends Web.UI.FeatureSets.MacroEditorBase
**/
PD.Manage.Modules.ListSettingFeature =
ProspectDirector.Web.UI.FeatureSets.MacroEditorBase.extend({

    //==============================
    // PROPERTIES
    //==============================

    get_input: function () {
        return this.get_container().find("SELECT");
    },

    //==============================
    // EVENT HANDLERS
    //==============================

    //==============================
    // OVERRIDDEN METHODS
    //==============================

    activate: function () {

        var that = this,
            items = new PD.BCL.List(this.getValue("values"));

        items.each(function (index, item) {
            that.get_input().append("<option value='" + item.value + "'>" + item.key + "</option>");
        });

        this.get_input().prop("disabled", this.getValue("isReadOnly"));
        this.get_input().val(this.getValue("value"));
        this.get_input().focus();

    },

    commit: function () {
        this.setValue("value", this.get_input().val());
    },

    render: function () {

        var result = [
            "<div id='" + this.getId() + "' style='padding:10px 10px 10px 10px;font-size:12px;'>",
                "<label for='Value' class='-pd-macro-editor-label'>" + this.getValue("label") + "</label>",
                "<select style='box-sizing:border-box;width:100%;padding:3px;' class='-pd-macro-editor-input'></select><br/>",
            "</div>"
        ];

        return result.join("");

    }

});