/// class ProspectDirector.Modules.ExplorerModel.Forms.FeatureCanvas
/// using ProspectDirector.Types.Core.Feature

/**
@class FeatureCanvas
@namespace ProspectDirector.Modules.ExplorerModel.Forms
**/
ProspectDirector.Modules.ExplorerModel.Forms.FeatureCanvas = ProspectDirector.Types.Core.Feature.extend({

    //---------------------------
    //--- CONSTRUCTOR
    //---------------------------

    init: function (options) {

        this._super(options);

        this.get_buttonEdit().on("click", $.proxy(this.buttonEdit_onClick, this));

    },

    //---------------------------
    //--- PROPERTIES
    //---------------------------

    get_buttonEdit: function () {
        return this.get_container().find("INPUT[type=button]");
    },

    get_hasChanges: function () {
        return this.get_container().find("INPUT[data-role=has-changes]");
    },

    //---------------------------
    //--- EVENT HANDLERS
    //---------------------------

    buttonEdit_onClick: function (e) {

        var that = this;

        PDJS.Canvas.Design.DesignerDialog.open({
            documentId: this.options.data.documentId,
            entityTypeId: this.options.data.entityTypeId,
            canvasType: PDJS.Canvas.Core.CanvasType.Explorer,
            callbacks: {
                ok: function (sender, e) {
                    if (e.hasChanged) {
                        that.get_hasChanges().val("1");
                        that.get_hasChanges().change();
                    }
                }
            }
        });
        
    },

    formDesign_onOk: function (sender, e) {
        this.updateLayout(e);
    }

});