/// class PD.Web.UI.Controls.ViewGridShowAnchorDialogCommand
/// using PD.Web.UI.Controls.ViewGridCommand

PD.Web.UI.Controls.ViewGridShowAnchorDialogCommand =
PD.Web.UI.Controls.ViewGridCommand.extend({

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

    setDefaults: function () {
        this._super();
        this.props("id", "view-grid/anchor-dialog");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("anchor.png"));
        this.props("label", "Anchor...");
        this.props("tooltip", "Anchor");
    },

    setState: function (state) {
        this._super(state);
        this.props("enabled", this._isEnabled());
    },

    execute: function (e) {
        this._super(e);

        var that = this;

        ProspectDirector.Types.Core.Dialogs.ViewAnchor.show({
            params: {
                viewStateId: this.get_viewStateId()
            },
            callbacks: {
                ok: function () {
                    that.get_viewGrid().build();
                }
            }
        });

    },

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

    _isVisible: function () {
        return this.get_viewGrid().get_configuration().get_settings().allowAnchor;
    }

});