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

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

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

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

    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.addColumnsLeft(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
            }
        });

    }

});