/// class ProspectDirector.Web.UI.Controls.Control

/**
@class Control
@namespace Web.UI.Controls
@constructor
**/
ProspectDirector.Web.UI.Controls.Control = Class.extend({

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

    _id: null,
    _options: {},
    _domNode: null,

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

    init: function (options) {
        this._id = uuid.v4();
        this._options = $.extend({}, this._options, options);
    },

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

    get_id: function () {
        return this._id;
    },

    get_options: function () {
        return this._options;
    },

    get_container: function () {
        return this.get_options().container;
    },

    get_domNode: function () {
        return this._domNode;
    },
    
    //===================================
    // PUBLIC METHODS
    //===================================
    
    render: function (content) {
        if (this.get_container() !== undefined) {
            this.get_container().append(this.get_domNode());
        }
        return this.get_domNode();
    },

    //===================================
    // PROTECTED METHODS
    //===================================
    
    resolveUrl: function (url) {
        return ProspectDirector.RUNTIME.resolveUrl(url);
    },

    setDomNode: function (content) {
        
        if (content === undefined) {
            this._domNode = $("<div></div>").filter(":eq(0)");
        }
        else {
            this._domNode = $(content).filter(":eq(0)");
        }
        

        if (this._id !== null) {
            this.get_domNode().attr("id", this._id);
        }
        
    }

    //===================================
    // PRIVATE METHODS
    //===================================

});