/// class PD.Web.UI.Controls.ViewGridColumnAddColumnsRightCommand
/// using PD.Web.UI.Controls.ViewGridColumnCommand

PD.Web.UI.Controls.ViewGridColumnAddColumnsRightCommand =
PD.Web.UI.Controls.ViewGridColumnCommand.extend({

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

    setDefaults: function () {
        this._super();
        this.props("id", "column/add-columns-right");
        this.props("enabled", true);
        this.props("visible", true);
        this.props("icon", PD.Path.to16x16("navigate_right.png"));
        this.props("label", "Add Columns Right...");
        this.props("tooltip", "Add Columns Right");
    },

    execute: function (e) {
        this._super(e);
        
        var that = this,
            service = new PD.Web.UI.Controls.ViewGridService();

        this._showDialog(function (sender, e) {

            var columnIds = _.map(e, "id")

            service.addColumnsRight(that.get_viewStateId(), that.get_columnId(), columnIds, function () {
                that.get_viewGrid().build();
            });

        });
        
    },

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

    _showDialog: function (callback) {

        ProspectDirector.Types.Core.Dialogs.FindColumnInDesign.show({
            params: {
                viewStateId: this.get_viewStateId(),
                columnId: this.get_columnId(),
                insert: 0
            },
            callbacks: {
                ok: callback
            }
        });

    }

});