/// class ProspectDirector.Types.View.FilterEditor

/**
<span style="font-size:60px;color:red;font-weight:bold;">DOCUMENT ME PLEASE!</span>
@class FilterEditor
@namespace ProspectDirector.Types.View
**/
ProspectDirector.Types.View.FilterEditor = Class.extend({

    /* constructor */

    init: function (options) {

        this.options = $.extend({
            dialogSelector: null,
            dataType: null
        }, options);

        this._registerEventHandlers();

    },

    /* control handles */

    get_dialog: function () {
        return $(this.options.dialogSelector);
    },

    okButton: function () {
        return this.get_dialog().find("[data-role=dialog-button][data-command=ok]");
    },

    cancelButton: function () {
        return this.get_dialog().find("[data-role=dialog-button][data-command=cancel]");
    },

    operator: function () {
        return this.get_dialog().find("select[data-role=operator]");
    },

    enabled: function () {
        return this.get_dialog().find("input[data-role=enabled]");
    },

    filterId: function () {
        return this.get_dialog().find("input[data-role=id]");
    },

    /* control event handlers */

    _okButton_onClick: function () {

        var filter = {
            enabled: null,
            id: null,
            operator: null,
            value: null,
            verse: null
        };

        this.get_dialog().data("dialog").hide({
            data: filter,
            command: "ok"
        });

    },

    _cancelButton_onClick: function () {
        this.get_dialog().data("dialog").hide();
    },

    _operator_onChange: function () {
    },

    /* private methods */

    _registerEventHandlers: function () {
        this.okButton().on("click", $.proxy(this._okButton_onClick, this));
        this.cancelButton().on("click", $.proxy(this._cancelButton_onClick, this));
        this.operator().on("change", $.proxy(this._operator_onChange, this));
    }

});