diff --git a/frontend-js/src/main/css/global.css b/frontend-js/src/main/css/global.css index 917e223e46705a56d10aaa94ca6ef2b16b968cf7..fc3b3c5126705ada64e975640944518f26dfd817 100644 --- a/frontend-js/src/main/css/global.css +++ b/frontend-js/src/main/css/global.css @@ -425,6 +425,12 @@ table.minerva-window-drug-table td { } .minerva-plugin { + width: 300px; + max-width: 600px; + min-width: 150px; + height: 100%; + position: relative; + display: none; } .minerva-annotation-row-odd { diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js index 3a7e83e4f4c693eae4d6db66666c232a58f0c9b1..5d9b6934f4708e8c2d57d60ee2316f7293ff0fc7 100644 --- a/frontend-js/src/main/js/minerva.js +++ b/frontend-js/src/main/js/minerva.js @@ -341,7 +341,7 @@ function create(params) { var pluginManager = new PluginManager({ element: functions.getElementByClassName(element, "minerva-plugin"), - map: customMap, + customMap: customMap, project: params.getProject(), configuration: params.getConfiguration() }); diff --git a/frontend-js/src/main/js/plugin/PluginManager.js b/frontend-js/src/main/js/plugin/PluginManager.js index 525af16e07547be29c97f41a06f722489628d060..7d8eeb9e40bdc576657bbe27ddf4e876f2c4f43e 100644 --- a/frontend-js/src/main/js/plugin/PluginManager.js +++ b/frontend-js/src/main/js/plugin/PluginManager.js @@ -1,6 +1,6 @@ "use strict"; -var ObjectWithListeners = require('../ObjectWithListeners'); +var AbstractGuiElement = require('../gui/AbstractGuiElement'); var Plugin = require('./Plugin'); var GuiUtils = require('../gui/leftPanel/GuiUtils'); var GuiConnector = require('../GuiConnector'); @@ -12,14 +12,19 @@ var Promise = require("bluebird"); // noinspection JSUnusedLocalSymbols var logger = require('../logger'); - +/** + * + * @param options + * @param {HTMLElement} options.element + * @param {CustomMap} options.customMap + * @param {Configuration} options.configuration + * @param {Project} options.project + * @constructor + * @extends {AbstractGuiElement} + */ function PluginManager(options) { - ObjectWithListeners.call(this); + AbstractGuiElement.call(this, options); var self = this; - self.setProject(options.project); - self.setMap(options.map); - self.setElement(options.element); - self.setConfiguration(options.configuration); self._plugins = []; self._pluginOnResizeHandlers = {}; @@ -33,32 +38,8 @@ function PluginManager(options) { }); } -PluginManager.prototype = Object.create(ObjectWithListeners.prototype); -PluginManager.prototype.constructor = ObjectWithListeners; - -PluginManager.prototype.setProject = function (project) { - this._project = project; -}; -PluginManager.prototype.setMap = function (map) { - this._map = map; -}; -PluginManager.prototype.getMap = function () { - return this._map; -}; -PluginManager.prototype.setElement = function (element) { - this._element = element; -}; -PluginManager.prototype.getElement = function () { - return this._element; -}; - -PluginManager.prototype.setConfiguration = function (configuration) { - this._configuration = configuration; -}; - -PluginManager.prototype.getConfiguration = function () { - return this._configuration; -}; +PluginManager.prototype = Object.create(AbstractGuiElement.prototype); +PluginManager.prototype.constructor = AbstractGuiElement; PluginManager.prototype.getPlugins = function () { return this._plugins; @@ -120,11 +101,7 @@ PluginManager.prototype.createTabForPlugin = function () { var tabData = self._tabData; var guiUtils = new GuiUtils(self.getConfiguration()); if (tabData === undefined) { - self.getElement().style.width = "300px"; - self.getElement().style.maxWidth = "600px"; - self.getElement().style.minWidth = "150px"; - self.getElement().style.height = "100%"; - self.getElement().style.position = "relative"; + $(self.getElement()).show(); self._tabData = guiUtils.createTabDiv({element: self.getElement(), id: "plugin_tab"}); tabData = self._tabData; $(tabData.element).css('position', 'absolute'); diff --git a/frontend-js/src/test/js/gui/OptionsMenu-test.js b/frontend-js/src/test/js/gui/OptionsMenu-test.js index e10ca3ac301155205d73ad7193555c72de410620..7e51307df42a49d356803ed39a54082539d2dc32 100644 --- a/frontend-js/src/test/js/gui/OptionsMenu-test.js +++ b/frontend-js/src/test/js/gui/OptionsMenu-test.js @@ -33,7 +33,12 @@ describe('OptionsMenu', function () { var pluginManager; return ServerConnector.getProject().then(function (project) { - pluginManager = new PluginManager({project: project}); + pluginManager = new PluginManager({ + project: project, + customMap: map, + element: div, + configuration: helper.getConfiguration() + }); return menu.init(); }).then(function () { menu.setPluginManager(pluginManager); diff --git a/frontend-js/src/test/js/plugin/PluginManager-test.js b/frontend-js/src/test/js/plugin/PluginManager-test.js index ab03699985eafba027ece2e2cab7f3236e6299bc..8a5e800a5b34b3d15830ec05f30bd72bf244a95b 100644 --- a/frontend-js/src/test/js/plugin/PluginManager-test.js +++ b/frontend-js/src/test/js/plugin/PluginManager-test.js @@ -14,7 +14,7 @@ describe('PluginManager', function () { var createParams = function () { var map = helper.createCustomMap(); return { - map: map, + customMap: map, configuration: helper.getConfiguration(), element: testDiv };