/// class ProspectDirector.Web.UI.Queries.Commands.EditFilter
/// using ProspectDirector.Web.UI.Command

/**
@class EditFilter
@constructor
@namespace Web.UI.Queries.Commands
**/
ProspectDirector.Web.UI.Queries.Commands.EditFilter = ProspectDirector.Web.UI.Command.extend({

    init: function (options) {
        this._super(options);
    },

    //================================
    // PROPERTIES
    //================================

    get_editor: function () {
        return this.get_options().editor;
    },

    get_selectedConstraint: function () {
        return this.get_options().selectedConstraint;
    },

    get_featureSet: function () {
        return this.get_options().featureSet;
    },

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

    execute: function () {

        var that = this,
            filter = this.get_selectedConstraint();

        ProspectDirector.Web.UI.FeatureSets.JsonTargetEditorDialog.open({
            config: {
                title: "Edit Filter - " + filter.get_columnName(),
                height: 350,
                width: 400
            },
            data: {
                attributes: {
                    querySettings: {
                        valueType: "ProspectDirector.Web.UI.Queries.QuerySettings",
                        value: ProspectDirector.Web.UI.Canvas.Charts.ChartUtilities.GetQuerySettings(this.get_featureSet())
                    }
                },
                targetType: "ProspectDirector.Web.UI.Queries.FilterUIO",
                targetData: filter.toJSON(),
                layoutType: ProspectDirector.Web.UI.FeatureSets.Layouts.TabStripLayout
            },
            callbacks: {
                ok: function (sender, e) {
                    that.get_editor().update(e.target);
                }
            }
        });


    }

});
