var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Settings;
(function (Settings) {
    var Gadget;
    (function (Gadget) {
        // Settings.Gadget.SettingGroup.EnergyEquivalencyImage
        Gadget.SettingGroup = $.extend(Gadget.SettingGroup, {
            EnergyEquivalencyImage: "9f42491a-504d-4444-8e4c-79389476edbc"
        });
        Gadget.FileName = { id: Settings.Gadget.SettingGroup.EnergyEquivalencyImage, name: "FileName" };
    })(Gadget = Settings.Gadget || (Settings.Gadget = {}));
})(Settings || (Settings = {}));
var Dashboards;
(function (Dashboards) {
    var SetupControl;
    (function (SetupControl) {
        var EnergyEquivalencyImage = (function (_super) {
            __extends(EnergyEquivalencyImage, _super);
            function EnergyEquivalencyImage() {
                _super.call(this, Settings.Gadget.SettingGroup.EnergyEquivalencyImage);
                this.title = i18n.loc.s('EnergyGadgets', 'ImageTab_Title');
            }
            EnergyEquivalencyImage.CreateInstance = function () {
                var instance = new EnergyEquivalencyImage();
                return instance;
            };
            EnergyEquivalencyImage.prototype.draw = function () {
                var _this = this;
                this.$container.empty();
                TemplateUtil.LocAndLoad(EnergyEquivalencyImage.SetupControlTemplateUri, new Core.CallBack(function (template) {
                    _this.$container.html(template);
                    _this.render();
                }, this));
            };
            EnergyEquivalencyImage.prototype.beforeCommit = function () {
                var imageName = this.imageManager.getSelectedFilename();
                this.setting(Settings.Gadget.FileName.name, imageName);
            };
            EnergyEquivalencyImage.prototype.isConfigured = function () {
                return true;
            };
            EnergyEquivalencyImage.prototype.isManagedSetting = function (name) {
                var managed = false;
                switch (name) {
                    case Settings.Gadget.FileName.name:
                        managed = true;
                        break;
                }
                ;
                return managed;
            };
            EnergyEquivalencyImage.prototype.render = function () {
                var imageOptions = {
                    fileUploadButtonText: i18n.loc.s('Dashboard', 'Style_UploadImage'),
                    repositoryUrl: fwk.url.format('ImageManager', 'EnergyGadgetImages'),
                    selectedFileName: this.setting(Settings.Gadget.FileName.name) || ''
                };
                this.imageManager = new Controls.FileManager.FileManager(this.$container.find('.fileManager'), imageOptions);
                if (this.isSmallRenderWindow()) {
                    this.$container.find('.eegadgetFileManager').addClass('smallRender');
                }
            };
            EnergyEquivalencyImage.SetupControlTemplateUri = 'Content/Gadgets/EnergyEquivalency/EnergyEquivalencyImageSetupControlTemplate.html';
            return EnergyEquivalencyImage;
        }(Dashboards.Models.SetupControl));
        SetupControl.EnergyEquivalencyImage = EnergyEquivalencyImage;
    })(SetupControl = Dashboards.SetupControl || (Dashboards.SetupControl = {}));
})(Dashboards || (Dashboards = {}));
// Register the Setup Control
Dashboards.Controllers.SetupControl.Register({
    create: Dashboards.SetupControl.EnergyEquivalencyImage.CreateInstance,
    id: Settings.Gadget.SettingGroup.EnergyEquivalencyImage
});
//# sourceMappingURL=EnergyEquivalencyImageSetupControl.js.map