/// class ProspectDirector.Web.UI.FeatureSets.Editors.AncestorsEditor
/// using ProspectDirector.Web.UI.FeatureSets.Editors.CompositeEditor

ProspectDirector.Web.UI.FeatureSets.Editors.AncestorsEditor =
ProspectDirector.Web.UI.FeatureSets.Editors.CompositeEditor.extend({

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

    get_listNode: function () {
        return this.get_input().find("DIV[data-role=list]");
    },

    //==============================
    // PUBLIC METHODS
    //==============================

    activate: function () {
        this._super();
        this._populate();
    },

    render: function () {

        return "<div id='" + this.getId() + "' class='-pd-micro-editor-composite' style='height:70px;'>" +
            "<div data-role='list' style='position:absolute;top:0;bottom:0;left:0;right:0px;overflow-y:scroll;'></div>" +
        "</div>";

    },

    _populate: function () {

        var that = this;

        this.get_listNode().empty();

        _.each(this.getPrimaryValue(), function (item) {
            var icon = Jade.IconSet.get("pd").resolve(item.typeIcon, Jade.IconSetSizeSpecificDirectory.x16);
            that.get_listNode().append("<div style=\"height:24px;line-height:24px;padding-left:24px;overflow:hidden;text-overflow:ellipsis;background-repeat:no-repeat;background-position:4px center;background-image:url('" + icon + "');\">" +
                item.typeName + "&nbsp;" + item.name + "</div>");
        });

    }

});
