/// 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", "anchor.14px.font");
        this.props("label", "Anchor...");
        this.props("tooltip", "Anchor");
    },

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

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

        PDJS.Shared.Features.FeatureDialogForNhib.open({
            title: "View Anchors",
            width: 600,
            height: 500,
            args: {
                targetType: "ProspectDirector.Web.Shared.Modules.Views.ViewAnchorsUIO",
                arbiterType: "ProspectDirector.Web.Shared.Modules.Views.ViewAnchorsArbiter",
                properties: {
                    viewStateId: this.get_viewStateId()
                }
            },
            select: {
                ok: (sender, e) => {
                    this.get_viewGrid().build();
                    this.get_viewGrid().refresh();
                }
            }
        });

    },

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

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

});