/// class PD.Manage.Modules.LicensePropertiesCommand

PD.Manage.Modules.LicensePropertiesCommand =
PD.Commands.Command.extend({

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

    get_selection: function () {
        return this.state("selection");
    },

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

    setDefaults: function () {

        this.props("id", "license/view");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("magnifying_glass.png"));
        this.props("label", "View License");
        this.props("tooltip", "View the license for the selected product.");

        this.state("selection", []);

    },

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

    isEnabled: function () {
        return this.get_selection() != null
            && this.get_selection().status != "Missing";
    },

    execute: function (e) {

        if (!this.isEnabled()) {
            return;
        }

        var license = this.get_selection();

        ProspectDirector.Web.UI.FeatureSets.NHibTargetEditorDialog.open({
            config: {
                title: (license.name ? license.name + " " : "") + "License",
                height: 500,
                width: 650
            },
            data: {
                targetArbiter: "ProspectDirector.Web.Manage.Modules.Licensing.LicenseArbiter",
                targetType: "ProspectDirector.Web.Manage.Modules.Licensing.LicenseUIO",
                layoutType: ProspectDirector.Web.UI.FeatureSets.Layouts.TabStripLayout,
                targetId: license.id
            }
        });

    }

});