/// class ProspectDirector.Web.UI.FeatureSets.EditorCollection

/**
[NEEDS DOCUMENTATION]
@class EditorCollection
@namespace Web.UI.FeatureSets
@constructor
**/
ProspectDirector.Web.UI.FeatureSets.EditorCollection = ProspectDirector.Web.List.extend({

    //==============================
    // FIELDS
    //==============================

    _parent: null,

    //==============================
    // CONSTRUCTOR
    //==============================

    init: function (options) {
        this._super();
        this._parent = options.parent;
    },

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

    get_parent: function () {
        return this._parent;
    },

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

    getByGroupId: function (groupId) {

        var result = new ProspectDirector.Web.UI.FeatureSets.EditorCollection({
            parent: this.get_parent()
        });

        this.each(function (index, editor) {
            if (groupId === editor.get_definition().get_groupId()) {
                result.add(editor);
            }
        });

        return result;

    },

    getByName: function (featureName, propertyName) {

        var result = null,
            definition = null;

        this.each(function (index, editor) {

            definition = editor.get_definition();

            if (featureName === definition.get_featureName()) {

                if (propertyName === undefined
                    || propertyName === null
                    || definition.get_name() === propertyName) {
                    result = editor;
                    return false;
                }

            }

        });

        return result;

    }

});