From fb60b04cd59946d9b580d455ec6ffa63c3e5be20 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Thu, 23 Aug 2018 14:22:13 +0200 Subject: [PATCH] jsdoc type definition added --- frontend-js/src/main/js/Configuration.js | 155 ++++++++++++++++- .../src/main/js/ConfigurationOption.js | 55 ++++++ frontend-js/src/main/js/Functions.js | 68 ++++++++ frontend-js/src/main/js/GuiConnector.js | 57 +++++- .../src/main/js/InvalidArgumentError.js | 6 + .../src/main/js/InvalidCredentialsError.js | 6 + frontend-js/src/main/js/NetworkError.js | 11 ++ .../src/main/js/ObjectWithListeners.js | 5 + frontend-js/src/main/js/SecurityError.js | 6 + frontend-js/src/main/js/SessionData.js | 162 +++++++++++++---- frontend-js/src/main/js/ValidationError.js | 6 + .../src/main/js/gui/AddOverlayDialog.js | 22 ++- frontend-js/src/main/js/gui/CommentDialog.js | 132 +++++++++++++- frontend-js/src/main/js/gui/ContextMenu.js | 39 +++++ .../src/main/js/gui/GuiMessageError.js | 6 + frontend-js/src/main/js/gui/Header.js | 43 +++++ frontend-js/src/main/js/gui/Legend.js | 44 +++++ frontend-js/src/main/js/gui/LoginDialog.js | 41 ++++- frontend-js/src/main/js/gui/MapContextMenu.js | 30 +++- frontend-js/src/main/js/gui/OptionsMenu.js | 34 ++++ frontend-js/src/main/js/gui/OverviewDialog.js | 33 ++++ frontend-js/src/main/js/gui/Panel.js | 70 ++++++++ frontend-js/src/main/js/gui/PluginDialog.js | 39 +++++ .../src/main/js/gui/SelectionContextMenu.js | 21 +++ .../js/gui/admin/AbstractAnnotatorsDialog.js | 12 ++ .../js/gui/admin/ChooseAnnotatorsDialog.js | 42 +++++ .../main/js/gui/admin/CommentsAdminPanel.js | 31 ++++ .../src/main/js/gui/admin/LogListDialog.js | 40 +++++ .../src/main/js/gui/admin/MapsAdminPanel.js | 78 ++++++++- frontend-js/src/main/js/gui/admin/ZipEntry.js | 34 ++++ .../main/js/gui/export/AbstractExportPanel.js | 131 ++++++++++++++ .../main/js/gui/export/ElementExportPanel.js | 30 ++++ .../main/js/gui/export/GraphicsExportPanel.js | 40 +++++ .../main/js/gui/export/NetworkExportPanel.js | 39 ++++- .../main/js/gui/leftPanel/AbstractDbPanel.js | 40 ++++- .../main/js/gui/leftPanel/ChemicalPanel.js | 37 ++++ .../src/main/js/gui/leftPanel/DrugPanel.js | 27 +++ .../js/gui/leftPanel/GenericSearchPanel.js | 30 ++++ .../src/main/js/gui/leftPanel/LeftPanel.js | 60 +++++++ .../src/main/js/gui/leftPanel/MiRnaPanel.js | 38 ++++ .../src/main/js/gui/leftPanel/OverlayPanel.js | 9 +- .../main/js/gui/leftPanel/ProjectInfoPanel.js | 48 +++++- .../js/gui/leftPanel/PublicationListDialog.js | 32 ++++ .../src/main/js/gui/leftPanel/SubmapPanel.js | 38 ++++ .../src/main/js/gui/topMenu/TopMenu.js | 44 +++++ frontend-js/src/main/js/map/CustomMap.js | 3 + .../src/main/js/map/CustomMapOptions.js | 9 + frontend-js/src/main/js/map/OverlayParser.js | 4 + frontend-js/src/main/js/map/Submap.js | 3 + frontend-js/src/main/js/map/data/Annotator.js | 72 ++++++++ .../src/main/js/map/data/DataOverlay.js | 8 + .../src/main/js/map/data/IdentifiedElement.js | 45 ++++- .../src/main/js/map/data/KineticLaw.js | 49 ++++++ .../src/main/js/map/data/LayoutAlias.js | 64 +++++++ .../src/main/js/map/data/LayoutReaction.js | 64 +++++-- frontend-js/src/main/js/map/data/MapModel.js | 163 +++++++++++++++++- frontend-js/src/main/js/map/data/Mesh.js | 53 ++++++ frontend-js/src/main/js/map/data/MiRna.js | 6 + .../src/main/js/map/data/MiriamType.js | 54 ++++++ .../main/js/map/data/ModificationStateType.js | 49 +++++- frontend-js/src/main/js/map/data/Modifier.js | 29 ++++ frontend-js/src/main/js/map/data/PointData.js | 4 + .../src/main/js/map/data/PrivilegeType.js | 48 ++++++ frontend-js/src/main/js/map/data/Product.js | 26 ++- frontend-js/src/main/js/map/data/Project.js | 33 +++- .../src/main/js/map/data/ProjectStatistics.js | 59 +++++-- frontend-js/src/main/js/map/data/Reactant.js | 30 +++- frontend-js/src/main/js/map/data/Reaction.js | 113 ++++++++++++ .../src/main/js/map/data/ReferenceGenome.js | 17 ++ .../js/map/data/ReferenceGenomeGeneMapping.js | 15 ++ .../src/main/js/map/data/SbmlFunction.js | 68 +++++++- .../src/main/js/map/data/SbmlParameter.js | 65 +++++++ .../main/js/map/data/SearchBioEntityGroup.js | 136 ++++++++++++++- frontend-js/src/main/js/map/data/Target.js | 73 ++++++-- .../main/js/map/data/TargettingStructure.js | 37 ++++ .../src/main/js/map/data/UserPreferences.js | 19 ++ .../src/main/js/map/marker/AliasMarker.js | 4 + .../main/js/map/overlay/AbstractDbOverlay.js | 113 +++++++++++- .../overlay/AbstractTargettingDbOverlay.js | 37 +++- .../main/js/map/overlay/ChemicalDbOverlay.js | 16 ++ .../main/js/map/overlay/CommentDbOverlay.js | 54 ++++-- .../js/map/overlay/DbOverlayCollection.js | 6 + .../src/main/js/map/overlay/DrugDbOverlay.js | 16 ++ .../src/main/js/map/overlay/MiRnaDbOverlay.js | 16 ++ .../main/js/map/overlay/SearchDbOverlay.js | 33 +++- .../src/main/js/map/overlay/UserDbOverlay.js | 54 ++++++ .../src/main/js/map/structure/MolArt.js | 35 +++- .../src/main/js/map/surface/AliasSurface.js | 5 + .../src/main/js/map/window/AliasInfoWindow.js | 3 + frontend-js/src/main/js/minerva.js | 64 ++++++- .../src/main/js/plugin/MinervaPluginProxy.js | 92 +++++++++- frontend-js/src/main/js/plugin/Plugin.js | 59 +++++++ .../src/main/js/plugin/PluginManager.js | 13 ++ 93 files changed, 3877 insertions(+), 132 deletions(-) diff --git a/frontend-js/src/main/js/Configuration.js b/frontend-js/src/main/js/Configuration.js index be283044b0..912bd07f4a 100644 --- a/frontend-js/src/main/js/Configuration.js +++ b/frontend-js/src/main/js/Configuration.js @@ -27,6 +27,29 @@ var ModificationStateType = require('./map/data/ModificationStateType'); * */ +/** + * @typedef {Object} ImageConverter + * @property {string} name + * @property {string} handler + */ + +/** + * @typedef {Object} ModelConverter + * @property {string} name + * @property {string} handler + */ + +/** + * @typedef {Object} MapType + * @property {string} id + * @property {string} name + */ + +/** + * @typedef {Object} MapCanvasType + * @property {string} id + * @property {string} name + */ /** * @@ -184,26 +207,58 @@ Configuration.prototype.getOverlayTypes = function () { return this._overlayTypes; }; +/** + * + * @param {ImageConverter[]} imageConverters + */ Configuration.prototype.setImageConverters = function (imageConverters) { this._imageConverters = imageConverters; }; + +/** + * + * @returns {ImageConverter[]} + */ Configuration.prototype.getImageConverters = function () { return this._imageConverters; }; +/** + * + * @param {ModelConverter[]} modelConverters + */ Configuration.prototype.setModelConverters = function (modelConverters) { this._modelConverters = modelConverters; }; + +/** + * + * @returns {ModelConverter[]} + */ Configuration.prototype.getModelConverters = function () { return this._modelConverters; }; +/** + * + * @param {BioEntityType[]} elementTypes + */ Configuration.prototype.setElementTypes = function (elementTypes) { this._elementTypes = elementTypes; }; + +/** + * + * @returns {BioEntityType[]} + */ Configuration.prototype.getElementTypes = function () { return this._elementTypes; }; + +/** + * + * @returns {string[]} + */ Configuration.prototype.getElementTypeNames = function () { var result = []; for (var i = 0; i < this._elementTypes.length; i++) { @@ -212,6 +267,11 @@ Configuration.prototype.getElementTypeNames = function () { return result; }; +/** + * + * @param {BioEntityType} elementType + * @returns {BioEntityType|null} + */ Configuration.prototype.getParentType = function (elementType) { var i; for (i = 0; i < this._elementTypes.length; i++) { @@ -227,6 +287,10 @@ Configuration.prototype.getParentType = function (elementType) { return null; }; +/** + * + * @returns {string[]} + */ Configuration.prototype.getSimpleElementTypeNames = function () { var classesToBeExcluded = {}; var i; @@ -242,14 +306,27 @@ Configuration.prototype.getSimpleElementTypeNames = function () { return result; }; - +/** + * + * @param {BioEntityType[]} reactionTypes + */ Configuration.prototype.setReactionTypes = function (reactionTypes) { this._reactionTypes = reactionTypes; }; + +/** + * + * @returns {BioEntityType[]} + */ Configuration.prototype.getReactionTypes = function () { return this._reactionTypes; }; + +/** + * + * @param {Object<string,MiriamTypeOptions>} miriamTypes + */ Configuration.prototype.setMiriamTypes = function (miriamTypes) { this._miriamTypes = []; for (var key in miriamTypes) { @@ -268,16 +345,25 @@ Configuration.prototype.setMiriamTypes = function (miriamTypes) { ); }; +/** + * + * @param {MapType[]} mapTypes + */ Configuration.prototype.setMapTypes = function (mapTypes) { this._mapTypes = mapTypes; }; + +/** + * + * @returns {MapType[]} + */ Configuration.prototype.getMapTypes = function () { return this._mapTypes; }; /** * - * @param {Array}mapCanvasTypes + * @param {MapCanvasType[]} mapCanvasTypes */ Configuration.prototype.setMapCanvasTypes = function (mapCanvasTypes) { this._mapCanvasTypes = mapCanvasTypes; @@ -285,12 +371,16 @@ Configuration.prototype.setMapCanvasTypes = function (mapCanvasTypes) { /** * - * @returns {Array} + * @returns {MapCanvasType[]} */ Configuration.prototype.getMapCanvasTypes = function () { return this._mapCanvasTypes; }; +/** + * + * @param {Object<string,PrivilegeTypeOptions>} privilegeTypes + */ Configuration.prototype.setPrivilegeTypes = function (privilegeTypes) { this._privilegeTypes = []; for (var key in privilegeTypes) { @@ -311,7 +401,7 @@ Configuration.prototype.getPrivilegeTypes = function () { /** * - * @param name + * @param {string} name * @returns {PrivilegeType} */ Configuration.prototype.getPrivilegeType = function (name) { @@ -326,6 +416,11 @@ Configuration.prototype.getPrivilegeType = function (name) { return null; }; +/** + * + * @param {string} name + * @returns {MiriamType|null} + */ Configuration.prototype.getMiriamTypeByName = function (name) { var self = this; for (var i = 0; i < self._miriamTypes.length; i++) { @@ -337,10 +432,18 @@ Configuration.prototype.getMiriamTypeByName = function (name) { return null; }; +/** + * + * @returns {MiriamType[]} + */ Configuration.prototype.getMiriamTypes = function () { return this._miriamTypes; }; +/** + * + * @param {Object<string,ModificationStateTypeOptions>} modificationStateTypes + */ Configuration.prototype.setModificationStateTypes = function (modificationStateTypes) { this._modificationStateTypes = []; for (var key in modificationStateTypes) { @@ -350,9 +453,20 @@ Configuration.prototype.setModificationStateTypes = function (modificationStateT } } }; + +/** + * + * @returns {ModificationStateType[]} + */ Configuration.prototype.getModificationStateTypes = function () { return this._modificationStateTypes; }; + +/** + * + * @param {string} name + * @returns {ModificationStateType} + */ Configuration.prototype.getModificationStateTypeByName = function (name) { var self = this; for (var i = 0; i < self._modificationStateTypes.length; i++) { @@ -364,6 +478,10 @@ Configuration.prototype.getModificationStateTypeByName = function (name) { return null; }; +/** + * + * @param {AnnotatorOptions[]} annotators + */ Configuration.prototype.setAnnotators = function (annotators) { this._annotators = []; for (var key in annotators) { @@ -374,17 +492,36 @@ Configuration.prototype.setAnnotators = function (annotators) { } }; +/** + * + * @returns {Array} + */ Configuration.prototype.getPluginsData = function () { return this._pluginsData; }; + +/** + * + * @param {Array} pluginsData + */ Configuration.prototype.setPluginsData = function (pluginsData) { this._pluginsData = pluginsData; }; +/** + * + * @returns {Annotator[]} + */ Configuration.prototype.getAnnotators = function () { return this._annotators; }; +/** + * + * @param {BioEntityType} [type] - element type for which we want to get annotators, if empty all annotators will + * be returned + * @returns {Array} + */ Configuration.prototype.getElementAnnotators = function (type) { if (type === undefined) { return this._annotators; @@ -413,6 +550,12 @@ Configuration.prototype.getElementAnnotators = function (type) { return result; }; +/** + * + * @param {T} original + * @returns {T} + * @template T + */ function createCopy(original) { if (Object.prototype.toString.call(original) === '[object Array]') { var result = []; @@ -425,6 +568,10 @@ function createCopy(original) { } } +/** + * + * @param {Configuration} original + */ Configuration.prototype.update = function (original) { var self = this; var i; diff --git a/frontend-js/src/main/js/ConfigurationOption.js b/frontend-js/src/main/js/ConfigurationOption.js index d7ce2f8fd3..e8a0328f38 100644 --- a/frontend-js/src/main/js/ConfigurationOption.js +++ b/frontend-js/src/main/js/ConfigurationOption.js @@ -4,6 +4,21 @@ var ObjectWithListeners = require('./ObjectWithListeners'); var logger = require('./logger'); +/** + * @typedef {Object} ConfigurationOptionParam + * @property {string} type + * @property {string} commonName + * @property {string} group + * @property {string} value + * @property {string} valueType + */ + +/** + * + * @param {ConfigurationOption|ConfigurationOptionParam} data + * @constructor + * @extends ObjectWithListeners + */ function ConfigurationOption(data) { // call super constructor ObjectWithListeners.call(this); @@ -27,42 +42,82 @@ function ConfigurationOption(data) { ConfigurationOption.prototype = Object.create(ObjectWithListeners.prototype); ConfigurationOption.prototype.constructor = ConfigurationOption; +/** + * + * @param {string} type + */ ConfigurationOption.prototype.setType = function (type) { this._type = type; }; +/** + * + * @returns {string} + */ ConfigurationOption.prototype.getType = function () { return this._type; }; +/** + * + * @param {string} value + */ ConfigurationOption.prototype.setValue = function (value) { this._value = value; }; +/** + * + * @returns {string} + */ ConfigurationOption.prototype.getValue = function () { return this._value; }; +/** + * + * @param {string} valueType + */ ConfigurationOption.prototype.setValueType = function (valueType) { this._valueType = valueType; }; +/** + * + * @returns {string} + */ ConfigurationOption.prototype.getValueType = function () { return this._valueType; }; +/** + * + * @param {string} commonName + */ ConfigurationOption.prototype.setCommonName = function (commonName) { this._commonName = commonName; }; +/** + * + * @returns {string} + */ ConfigurationOption.prototype.getCommonName = function () { return this._commonName; }; +/** + * + * @param {string} group + */ ConfigurationOption.prototype.setGroup = function (group) { this._group = group; }; +/** + * + * @returns {string} + */ ConfigurationOption.prototype.getGroup = function () { return this._group; }; diff --git a/frontend-js/src/main/js/Functions.js b/frontend-js/src/main/js/Functions.js index b233ee58d6..2eefe04ecd 100644 --- a/frontend-js/src/main/js/Functions.js +++ b/frontend-js/src/main/js/Functions.js @@ -61,14 +61,29 @@ Functions.prototype.bound = function (value, minVal, maxVal) { return value; }; +/** + * + * @param {number} deg + * @returns {number} + */ Functions.prototype.degreesToRadians = function (deg) { return deg * (Math.PI / 180); }; +/** + * + * @param {number} rad + * @returns {number} + */ Functions.prototype.radiansToDegrees = function (rad) { return rad / (Math.PI / 180); }; +/** + * + * @param {number} value + * @returns {string} + */ Functions.prototype.intToColorString = function (value) { /* jslint bitwise: true */ var trimmedValue = (value & 0xFFFFFF); @@ -295,6 +310,12 @@ Functions.prototype.overlayToColor = function (elementOverlay) { } }; +/** + * + * @param {HTMLElement} element + * @param {string} name + * @returns {HTMLElement} + */ Functions.prototype.getElementByName = function (element, name) { if (element !== undefined) { if (element.getAttribute("name") === name) { @@ -395,14 +416,32 @@ Functions.prototype.createElement = function (params) { return result; }; +/** + * + * @param {number} x + * @returns {number} + */ function sqr(x) { return x * x; } +/** + * + * @param {Point} v + * @param {Point} w + * @returns {number} + */ function dist2(v, w) { return sqr(v.x - w.x) + sqr(v.y - w.y); } +/** + * + * @param {Point} p + * @param {Point} v + * @param {Point} w + * @returns {number} + */ function distToSegmentSquared(p, v, w) { var l2 = dist2(v, w); @@ -422,6 +461,12 @@ function distToSegmentSquared(p, v, w) { return dist2(p, new Point(v.x + t * (w.x - v.x), v.y + t * (w.y - v.y))); } +/** + * + * @param {Point} p1 + * @param {Point| {start:Point, end:Point}} el2 + * @returns {number} + */ Functions.prototype.distance = function (p1, el2) { if (el2 instanceof Point) { var p2 = el2; @@ -431,6 +476,10 @@ Functions.prototype.distance = function (p1, el2) { } }; +/** + * + * @param {HTMLElement} element + */ Functions.prototype.removeChildren = function (element) { while (element.firstChild) { element.removeChild(element.firstChild); @@ -438,6 +487,7 @@ Functions.prototype.removeChildren = function (element) { }; /** + * @param {string} url * * @returns {Promise} resolved after javascript is loaded */ @@ -464,6 +514,11 @@ Functions.prototype.loadScript = function (url) { }); }; +/** + * + * @param {string} s + * @returns {string} + */ Functions.prototype.computeMD5 = function (s) { function L(k, d) { return (k << d) | (k >>> (32 - d)) @@ -476,10 +531,13 @@ Functions.prototype.computeMD5 = function (s) { I = (G & 1073741824); d = (k & 1073741824); x = (G & 1073741823) + (k & 1073741823); + // noinspection JSBitwiseOperatorUsage if (I & d) { return (x ^ 2147483648 ^ F ^ H) } + // noinspection JSBitwiseOperatorUsage if (I | d) { + // noinspection JSBitwiseOperatorUsage if (x & 1073741824) { return (x ^ 3221225472 ^ F ^ H) } else { @@ -549,6 +607,11 @@ Functions.prototype.computeMD5 = function (s) { return aa } + /** + * + * @param {number} x + * @returns {string} + */ function B(x) { var k = "", F = "", G, d; for (d = 0; d <= 3; d++) { @@ -597,6 +660,7 @@ Functions.prototype.computeMD5 = function (s) { E = X; v = W; g = V; + // noinspection PointlessArithmeticExpressionJS Y = u(Y, X, W, V, C[P + 0], S, 3614090360); V = u(V, Y, X, W, C[P + 1], Q, 3905402710); W = u(W, V, Y, X, C[P + 2], N, 606105819); @@ -616,6 +680,7 @@ Functions.prototype.computeMD5 = function (s) { Y = f(Y, X, W, V, C[P + 1], A, 4129170786); V = f(V, Y, X, W, C[P + 6], z, 3225465664); W = f(W, V, Y, X, C[P + 11], y, 643717713); + // noinspection PointlessArithmeticExpressionJS X = f(X, W, V, Y, C[P + 0], w, 3921069994); Y = f(Y, X, W, V, C[P + 5], A, 3593408605); V = f(V, Y, X, W, C[P + 10], z, 38016083); @@ -638,6 +703,7 @@ Functions.prototype.computeMD5 = function (s) { W = D(W, V, Y, X, C[P + 7], l, 4139469664); X = D(X, W, V, Y, C[P + 10], j, 3200236656); Y = D(Y, X, W, V, C[P + 13], o, 681279174); + // noinspection PointlessArithmeticExpressionJS V = D(V, Y, X, W, C[P + 0], m, 3936430074); W = D(W, V, Y, X, C[P + 3], l, 3572445317); X = D(X, W, V, Y, C[P + 6], j, 76029189); @@ -645,6 +711,7 @@ Functions.prototype.computeMD5 = function (s) { V = D(V, Y, X, W, C[P + 12], m, 3873151461); W = D(W, V, Y, X, C[P + 15], l, 530742520); X = D(X, W, V, Y, C[P + 2], j, 3299628645); + // noinspection PointlessArithmeticExpressionJS Y = t(Y, X, W, V, C[P + 0], U, 4096336452); V = t(V, Y, X, W, C[P + 7], T, 1126891415); W = t(W, V, Y, X, C[P + 14], R, 2878612391); @@ -666,6 +733,7 @@ Functions.prototype.computeMD5 = function (s) { W = K(W, v); V = K(V, g) } + // noinspection JSSuspiciousNameCombination var i = B(Y) + B(X) + B(W) + B(V); return i.toLowerCase() }; diff --git a/frontend-js/src/main/js/GuiConnector.js b/frontend-js/src/main/js/GuiConnector.js index 137259eee3..dfaa7c33f6 100644 --- a/frontend-js/src/main/js/GuiConnector.js +++ b/frontend-js/src/main/js/GuiConnector.js @@ -25,6 +25,11 @@ function GuiConnector() { this.getParams = []; } +/** + * + * @param {GuiConnector} object + * @returns {GuiConnector} + */ function returnThisOrSingleton(object) { if (object === undefined || object === null) { return GuiConnector.singleton; @@ -46,6 +51,7 @@ GuiConnector.prototype.init = function () { return d >= 0 && this.lastIndexOf(pattern) === d; }; } + // noinspection PointlessBooleanExpressionJS var isIE = /* @cc_on!@ */false || !!document.documentMode; if (isIE) { @@ -103,10 +109,18 @@ GuiConnector.prototype.init = function () { } }; +/** + * + * @param {function} handler + */ GuiConnector.prototype.addWindowResizeEvent = function (handler) { this._windowResizeEvents.push(handler); }; +/** + * + * @param {function} handler + */ GuiConnector.prototype.removeWindowResizeEvent = function (handler) { var events = this._windowResizeEvents; var index = events.indexOf(handler); @@ -123,6 +137,7 @@ GuiConnector.prototype.removeWindowResizeEvent = function (handler) { * @param bigLogo * {@link Boolean} value determining if we want to have big logo or * small one + * @returns {string} */ GuiConnector.prototype.getLcsbLogoImg = function (bigLogo) { if (bigLogo) { @@ -135,18 +150,23 @@ GuiConnector.prototype.getLcsbLogoImg = function (bigLogo) { /** * Returns name of the file with image that should be presented when we are * waiting for data to be loaded. + * @returns {string} */ GuiConnector.prototype.getLoadingImg = function () { return "icons/ajax-loader.gif"; }; - +/** + * + * @returns {string} + */ GuiConnector.prototype.getEmptyTileUrl = function () { return "resources/images/empty_tile.png"; }; /** * Returns home directory for images in the application. + * @returns {string} */ GuiConnector.prototype.getImgPrefix = function () { return "resources/images/"; @@ -154,6 +174,9 @@ GuiConnector.prototype.getImgPrefix = function () { /** * Updates coordinates of the mouse in the browser. + * + * @param {number} x + * @param {number} y */ GuiConnector.prototype.updateMouseCoordinates = function (x, y) { var self = returnThisOrSingleton(this); @@ -161,6 +184,10 @@ GuiConnector.prototype.updateMouseCoordinates = function (x, y) { self.yPos = y; }; +/** + * + * @param {string} messageText + */ GuiConnector.prototype.showProcessing = function (messageText) { var self = returnThisOrSingleton(this); if (self._processingDialog === undefined) { @@ -192,11 +219,19 @@ GuiConnector.prototype.showProcessing = function (messageText) { $(self._processingDialog).dialog("open"); }; +/** + * + */ GuiConnector.prototype.hideProcessing = function () { var self = returnThisOrSingleton(this); $(self._processingDialog).dialog("close"); }; +/** + * + * @param {string} error + * @param {boolean} [redirectIfSecurityError] + */ GuiConnector.prototype.alert = function (error, redirectIfSecurityError) { if (redirectIfSecurityError === undefined) { redirectIfSecurityError = false; @@ -224,6 +259,11 @@ GuiConnector.prototype.alert = function (error, redirectIfSecurityError) { } }; +/** + * + * @param {Error|string} error + * @returns {string} + */ GuiConnector.prototype.getErrorMessageForError = function (error) { var message = error; if (message instanceof SecurityError) { @@ -243,6 +283,10 @@ GuiConnector.prototype.getErrorMessageForError = function (error) { return message; }; +/** + * + * @param {string} message + */ GuiConnector.prototype.info = function (message) { var self = returnThisOrSingleton(this); if (self._infoDialog === undefined) { @@ -263,6 +307,10 @@ GuiConnector.prototype.info = function (message) { }; +/** + * + * @param {{message:string, [title]:string}} params + */ GuiConnector.prototype.showConfirmationDialog = function (params) { var message = params.message; var title = params.title; @@ -292,6 +340,9 @@ GuiConnector.prototype.showConfirmationDialog = function (params) { }); }; +/** + * + */ GuiConnector.prototype.destroy = function () { var self = returnThisOrSingleton(this); @@ -315,6 +366,10 @@ GuiConnector.prototype.destroy = function () { }; +/** + * + * @param {string} message + */ GuiConnector.prototype.warn = function (message) { var self = GuiConnector; logger.warn(message); diff --git a/frontend-js/src/main/js/InvalidArgumentError.js b/frontend-js/src/main/js/InvalidArgumentError.js index b016647977..41fb1e1140 100644 --- a/frontend-js/src/main/js/InvalidArgumentError.js +++ b/frontend-js/src/main/js/InvalidArgumentError.js @@ -4,6 +4,12 @@ var logger = require('./logger'); +/** + * + * @param {string} message + * @constructor + * @extends Error + */ function InvalidArgumentError(message) { this.message = message; this.stack = (new Error()).stack; diff --git a/frontend-js/src/main/js/InvalidCredentialsError.js b/frontend-js/src/main/js/InvalidCredentialsError.js index 7e5f85ce4f..ccbed75899 100644 --- a/frontend-js/src/main/js/InvalidCredentialsError.js +++ b/frontend-js/src/main/js/InvalidCredentialsError.js @@ -6,6 +6,12 @@ var logger = require('./logger'); var SecurityError = require("./SecurityError"); +/** + * + * @param {string} message + * @constructor + * @extends SecurityError + */ function InvalidCredentialsError(message) { this.message = message; this.stack = (new Error()).stack; diff --git a/frontend-js/src/main/js/NetworkError.js b/frontend-js/src/main/js/NetworkError.js index 0b693ae0ba..75cbb6f19b 100644 --- a/frontend-js/src/main/js/NetworkError.js +++ b/frontend-js/src/main/js/NetworkError.js @@ -5,6 +5,17 @@ // noinspection JSUnusedLocalSymbols var logger = require('./logger'); +/** + * + * @param {string} message + * @param {Object} [connectionParams] + * @param {number} connectionParams.statusCode + * @param {string} connectionParams.url + * @param {string} connectionParams.content + * + * @constructor + * @extends Error + */ function NetworkError(message, connectionParams) { this.message = message; this.stack = (new Error()).stack; diff --git a/frontend-js/src/main/js/ObjectWithListeners.js b/frontend-js/src/main/js/ObjectWithListeners.js index c930048dd6..41b332c6d2 100644 --- a/frontend-js/src/main/js/ObjectWithListeners.js +++ b/frontend-js/src/main/js/ObjectWithListeners.js @@ -170,6 +170,11 @@ ObjectWithListeners.prototype.callListeners = function (type, arg) { return Promise.all(promises); }; +/** + * + * @param {string} type + * @returns {function[]} + */ ObjectWithListeners.prototype.getListeners = function (type) { if (this._validListeners[type] === undefined) { throw new Error("Unknown listener type: " + type); diff --git a/frontend-js/src/main/js/SecurityError.js b/frontend-js/src/main/js/SecurityError.js index c5755cafbf..e388bd04d4 100644 --- a/frontend-js/src/main/js/SecurityError.js +++ b/frontend-js/src/main/js/SecurityError.js @@ -4,6 +4,12 @@ var logger = require('./logger'); +/** + * + * @param {string} message + * @constructor + * @extends Error + */ function SecurityError(message) { this.message = message; this.stack = (new Error()).stack; diff --git a/frontend-js/src/main/js/SessionData.js b/frontend-js/src/main/js/SessionData.js index 30b8d32347..d09649faf3 100644 --- a/frontend-js/src/main/js/SessionData.js +++ b/frontend-js/src/main/js/SessionData.js @@ -9,6 +9,11 @@ var Cookies = require('js-cookie'); var logger = require('./logger'); +/** + * + * @param {Project} project + * @constructor + */ function SessionData(project) { if (project === undefined) { throw new Error("Project must be passed as an argument"); @@ -16,29 +21,55 @@ function SessionData(project) { this.setProject(project); } -SessionData.prototype.setProject = function(project) { +/** + * + * @param {Project} project + */ +SessionData.prototype.setProject = function (project) { this._project = project; }; -SessionData.prototype.getProject = function() { +/** + * + * @returns {Project} + */ +SessionData.prototype.getProject = function () { return this._project; }; -SessionData.prototype.getProjectId = function() { +/** + * + * @returns {string} + */ +SessionData.prototype.getProjectId = function () { return this._project.getProjectId(); }; -SessionData.prototype.getShowComments = function() { +/** + * + * @returns {boolean} + */ +SessionData.prototype.getShowComments = function () { var key = this.getKey(SessionObjectType.SHOW_COMMENT); return Cookies.get(key) === "true"; }; -SessionData.prototype.setSearchQuery = function(value) { +/** + * + * @param {Object} value + */ +SessionData.prototype.setSearchQuery = function (value) { var key = this.getKey(SessionObjectType.SEARCH_QUERY); Cookies.set(key, JSON.stringify(value)); }; -SessionData.prototype.setQuery = function(param) { +/** + * + * @param {Object} param + * @param {string} param.type + * @param {Object} param.query + */ +SessionData.prototype.setQuery = function (param) { if (param.type === "drug") { this.setDrugQuery(param.query); } else if (param.type === "search") { @@ -52,7 +83,11 @@ SessionData.prototype.setQuery = function(param) { } }; -SessionData.prototype.getSearchQuery = function() { +/** + * + * @returns {any} + */ +SessionData.prototype.getSearchQuery = function () { var key = this.getKey(SessionObjectType.SEARCH_QUERY); var result = Cookies.get(key); if (result !== undefined) { @@ -61,12 +96,20 @@ SessionData.prototype.getSearchQuery = function() { return result; }; -SessionData.prototype.setDrugQuery = function(value) { +/** + * + * @param {Object} value + */ +SessionData.prototype.setDrugQuery = function (value) { var key = this.getKey(SessionObjectType.DRUG_QUERY); Cookies.set(key, JSON.stringify(value)); }; -SessionData.prototype.getDrugQuery = function() { +/** + * + * @returns {any} + */ +SessionData.prototype.getDrugQuery = function () { var key = this.getKey(SessionObjectType.DRUG_QUERY); var result = Cookies.get(key); if (result !== undefined) { @@ -75,12 +118,20 @@ SessionData.prototype.getDrugQuery = function() { return result; }; -SessionData.prototype.setMiRnaQuery = function(value) { +/** + * + * @param {Object} value + */ +SessionData.prototype.setMiRnaQuery = function (value) { var key = this.getKey(SessionObjectType.MI_RNA_QUERY); Cookies.set(key, JSON.stringify(value)); }; -SessionData.prototype.getMiRnaQuery = function() { +/** + * + * @returns {any} + */ +SessionData.prototype.getMiRnaQuery = function () { var key = this.getKey(SessionObjectType.MI_RNA_QUERY); var result = Cookies.get(key); if (result !== undefined) { @@ -89,12 +140,20 @@ SessionData.prototype.getMiRnaQuery = function() { return result; }; -SessionData.prototype.setChemicalQuery = function(value) { +/** + * + * @param {Object} value + */ +SessionData.prototype.setChemicalQuery = function (value) { var key = this.getKey(SessionObjectType.CHEMICAL_QUERY); Cookies.set(key, JSON.stringify(value)); }; -SessionData.prototype.getChemicalQuery = function() { +/** + * + * @returns {any} + */ +SessionData.prototype.getChemicalQuery = function () { var key = this.getKey(SessionObjectType.CHEMICAL_QUERY); var result = Cookies.get(key); if (result !== undefined) { @@ -103,22 +162,38 @@ SessionData.prototype.getChemicalQuery = function() { return result; }; -SessionData.prototype.setShowComments = function(value) { +/** + * + * @param {boolean} value + */ +SessionData.prototype.setShowComments = function (value) { var key = this.getKey(SessionObjectType.SHOW_COMMENT); Cookies.set(key, value + ""); }; -SessionData.prototype.getSelectedBackgroundOverlay = function() { +/** + * + * @returns {number} + */ +SessionData.prototype.getSelectedBackgroundOverlay = function () { var key = this.getKey(SessionObjectType.SELECTED_BACKGROUND_OVERLAY); return Cookies.get(key); }; -SessionData.prototype.setSelectedBackgroundOverlay = function(value) { +/** + * + * @param {number} value + */ +SessionData.prototype.setSelectedBackgroundOverlay = function (value) { var key = this.getKey(SessionObjectType.SELECTED_BACKGROUND_OVERLAY); Cookies.set(key, value + ""); }; -SessionData.prototype.getVisibleOverlays = function() { +/** + * + * @returns {number[]} + */ +SessionData.prototype.getVisibleOverlays = function () { var key = this.getKey(SessionObjectType.VISIBLE_OVERLAYS); var value = Cookies.get(key); if (value === undefined || value === "") { @@ -129,7 +204,11 @@ SessionData.prototype.getVisibleOverlays = function() { return value; }; -SessionData.prototype.setVisibleOverlays = function(value) { +/** + * + * @param {string} value + */ +SessionData.prototype.setVisibleOverlays = function (value) { var key = this.getKey(SessionObjectType.VISIBLE_OVERLAYS); Cookies.set(key, value + ""); }; @@ -139,8 +218,8 @@ SessionData.prototype.setVisibleOverlays = function(value) { * @param {MapModel} model * @param {number} value */ -SessionData.prototype.setZoomLevel = function(model, value) { - var key = this.getKey(SessionObjectType.ZOOM_LEVEL, [ model.getId() ]); +SessionData.prototype.setZoomLevel = function (model, value) { + var key = this.getKey(SessionObjectType.ZOOM_LEVEL, [model.getId()]); Cookies.set(key, value + ""); }; @@ -149,8 +228,8 @@ SessionData.prototype.setZoomLevel = function(model, value) { * @param {MapModel} model * @returns {number} */ -SessionData.prototype.getZoomLevel = function(model) { - var key = this.getKey(SessionObjectType.ZOOM_LEVEL, [ model.getId() ]); +SessionData.prototype.getZoomLevel = function (model) { + var key = this.getKey(SessionObjectType.ZOOM_LEVEL, [model.getId()]); var value = Cookies.get(key); if (value !== undefined) { value = parseInt(value); @@ -158,7 +237,11 @@ SessionData.prototype.getZoomLevel = function(model) { return value; }; -SessionData.prototype.setToken = function(token) { +/** + * TODO remove this method + * @param {string} token + */ +SessionData.prototype.setToken = function (token) { var key = SessionObjectType.TOKEN; if (token === undefined) { Cookies.remove(key); @@ -167,12 +250,20 @@ SessionData.prototype.setToken = function(token) { } }; -SessionData.prototype.getToken = function() { +/** + * TODO remove this method + * @returns {string} + */ +SessionData.prototype.getToken = function () { var key = SessionObjectType.TOKEN; return Cookies.get(key); }; -SessionData.prototype.setLogin = function(login) { +/** + * + * @param {string} login + */ +SessionData.prototype.setLogin = function (login) { var key = SessionObjectType.LOGIN; if (login === undefined) { Cookies.remove(key); @@ -181,13 +272,22 @@ SessionData.prototype.setLogin = function(login) { } }; -SessionData.prototype.getLogin = function() { +/** + * + * @returns {string} + */ +SessionData.prototype.getLogin = function () { var key = SessionObjectType.LOGIN; return Cookies.get(key); }; -SessionData.prototype.setCenter = function(model, value) { - var key = this.getKey(SessionObjectType.CENTER, [ model.getId() ]); +/** + * + * @param {MapModel} model + * @param {Point} value + */ +SessionData.prototype.setCenter = function (model, value) { + var key = this.getKey(SessionObjectType.CENTER, [model.getId()]); Cookies.set(key, value.x + "," + value.y); }; @@ -196,8 +296,8 @@ SessionData.prototype.setCenter = function(model, value) { * @param {MapModel} model * @returns {Point} */ -SessionData.prototype.getCenter = function(model) { - var key = this.getKey(SessionObjectType.CENTER, [ model.getId() ]); +SessionData.prototype.getCenter = function (model) { + var key = this.getKey(SessionObjectType.CENTER, [model.getId()]); var value = Cookies.get(key); if (value !== undefined) { var tmp = value.split(","); @@ -212,7 +312,7 @@ SessionData.prototype.getCenter = function(model) { * @param {Array} [args] * @returns {string} */ -SessionData.prototype.getKey = function(type, args) { +SessionData.prototype.getKey = function (type, args) { if (type === undefined) { throw new Error("Undefined type"); } diff --git a/frontend-js/src/main/js/ValidationError.js b/frontend-js/src/main/js/ValidationError.js index aaa83e2edf..2a1bec9469 100644 --- a/frontend-js/src/main/js/ValidationError.js +++ b/frontend-js/src/main/js/ValidationError.js @@ -4,6 +4,12 @@ var logger = require('./logger'); +/** + * + * @param {string} message + * @constructor + * @extends Error + */ function ValidationError(message) { this.message = message; this.stack = (new Error()).stack; diff --git a/frontend-js/src/main/js/gui/AddOverlayDialog.js b/frontend-js/src/main/js/gui/AddOverlayDialog.js index d4d8871d96..1754a7c1ed 100644 --- a/frontend-js/src/main/js/gui/AddOverlayDialog.js +++ b/frontend-js/src/main/js/gui/AddOverlayDialog.js @@ -120,6 +120,11 @@ AddOverlayDialog.prototype.createGui = function () { self.getElement().appendChild(content); }; +/** + * + * @param file + * @returns {Promise} + */ AddOverlayDialog.prototype.processFile = function (file) { var self = this; self.setFileContent(null); @@ -172,6 +177,11 @@ AddOverlayDialog.prototype.processFile = function (file) { } }; + +/** + * + * @param {string} fileContent + */ AddOverlayDialog.prototype.setFileContent = function (fileContent) { if (typeof fileContent === 'string' || fileContent instanceof String) { fileContent = new TextEncoder("UTF8").encode(fileContent); @@ -180,6 +190,10 @@ AddOverlayDialog.prototype.setFileContent = function (fileContent) { this._fileContent = fileContent; }; +/** + * + * @returns {string|null} + */ AddOverlayDialog.prototype.getFileContent = function () { var self = this; var contentInput = $("[name='overlay-content']", self.getElement())[0]; @@ -205,7 +219,10 @@ AddOverlayDialog.prototype.init = function () { return Promise.resolve(); }; - +/** + * + * @returns {Promise} + */ AddOverlayDialog.prototype.addOverlay = function () { var self = this; var nameInput = $("[name='overlay-name']", self.getElement())[0]; @@ -250,6 +267,9 @@ AddOverlayDialog.prototype.destroy = function () { return Promise.resolve(); }; +/** + * + */ AddOverlayDialog.prototype.open = function () { var self = this; var div = self.getElement(); diff --git a/frontend-js/src/main/js/gui/CommentDialog.js b/frontend-js/src/main/js/gui/CommentDialog.js index 4a9dea6082..41bf2073ba 100644 --- a/frontend-js/src/main/js/gui/CommentDialog.js +++ b/frontend-js/src/main/js/gui/CommentDialog.js @@ -11,6 +11,19 @@ var Reaction = require('../map/data/Reaction'); var logger = require('../logger'); var Functions = require('../Functions'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * + * @extends AbstractGuiElement + */ function CommentDialog(params) { AbstractGuiElement.call(this, params); var self = this; @@ -28,6 +41,11 @@ CommentDialog.prototype.constructor = CommentDialog; CommentDialog.GENERAL = "<General>"; +/** + * + * @param {HTMLElement} elements + * @returns {HTMLTableRowElement} + */ function createRow(elements) { var row = document.createElement('tr'); for (var i = 0; i < elements.length; i++) { @@ -38,6 +56,11 @@ function createRow(elements) { return row; } +/** + * + * @param {IdentifiedElement[]} identifiedElements + * @returns {Promise} + */ CommentDialog.prototype.open = function (identifiedElements) { var self = this; self.setTypes([CommentDialog.GENERAL]); @@ -66,6 +89,10 @@ CommentDialog.prototype.open = function (identifiedElements) { }); }; +/** + * + * @private + */ CommentDialog.prototype._createGui = function () { var self = this; @@ -160,6 +187,11 @@ CommentDialog.prototype._createGui = function () { detailDiv.innerHTML = text; }; }; + +/** + * + * @param {Array<BioEntity|string>} types + */ CommentDialog.prototype.setTypes = function (types) { var typeOptions = this.getTypeOptions(); while (typeOptions.firstChild) { @@ -185,14 +217,26 @@ CommentDialog.prototype.setTypes = function (types) { typeOptions.onchange(); }; +/** + * + * @returns {Array<BioEntity|string>} + */ CommentDialog.prototype.getTypes = function () { return this._types; }; +/** + * + * @returns {BioEntity|string} + */ CommentDialog.prototype.getSelectedType = function () { return this._types[this.getTypeOptions().value]; }; +/** + * + * @param {number} value + */ CommentDialog.prototype.setSelectedType = function (value) { if (Functions.isInt(value)) { this.getTypeOptions().value = value; @@ -202,65 +246,138 @@ CommentDialog.prototype.setSelectedType = function (value) { } }; +/** + * + * @returns {HTMLElement} + */ CommentDialog.prototype.getTypeOptions = function () { return this._typeOptions; }; + +/** + * + * @param {HTMLElement} typeOptions + */ CommentDialog.prototype.setTypeOptions = function (typeOptions) { this._typeOptions = typeOptions; }; + +/** + * + * @param {HTMLElement} contentInput + */ CommentDialog.prototype.setContentInput = function (contentInput) { this._contentInput = contentInput; }; + +/** + * + * @returns {HTMLElement} + */ CommentDialog.prototype.getContentInput = function () { return this._contentInput; }; + +/** + * + * @param {HTMLElement} nameInput + */ CommentDialog.prototype.setNameInput = function (nameInput) { this._nameInput = nameInput; }; + +/** + * + * @returns {HTMLElement} + */ CommentDialog.prototype.getNameInput = function () { return this._nameInput; }; + +/** + * + * @param {HTMLElement} emailInput + */ CommentDialog.prototype.setEmailInput = function (emailInput) { this._emailInput = emailInput; }; + +/** + * + * @returns {HTMLElement} + */ CommentDialog.prototype.getEmailInput = function () { return this._emailInput; }; + +/** + * + * @param {HTMLElement} pinnedCheckbox + */ CommentDialog.prototype.setPinnedCheckbox = function (pinnedCheckbox) { this._pinnedCheckbox = pinnedCheckbox; }; +/** + * + * @returns {HTMLElement} + */ CommentDialog.prototype.getPinnedCheckbox = function () { return this._pinnedCheckbox; }; -CommentDialog.prototype.getTypes = function () { - return this._types; -}; - +/** + * + * @param {string} name + */ CommentDialog.prototype.setName = function (name) { this.getNameInput().value = name; }; +/** + * + * @returns {string} + */ CommentDialog.prototype.getName = function () { return this.getNameInput().value; }; +/** + * + * @returns {string} + */ CommentDialog.prototype.getEmail = function () { return this.getEmailInput().value; }; +/** + * + * @param {string} email + */ CommentDialog.prototype.setEmail = function (email) { this.getEmailInput().value = email; }; +/** + * + * @returns {string} + */ CommentDialog.prototype.getContent = function () { return this.getContentInput().value; }; +/** + * + * @returns {boolean} + */ CommentDialog.prototype.isPinned = function () { return this.getPinnedCheckbox().checked; }; + +/** + * + * @returns {number | string} + */ CommentDialog.prototype.getSelectedTypeId = function () { var selected = this.getSelectedType(); if (selected instanceof Alias) { @@ -272,6 +389,10 @@ CommentDialog.prototype.getSelectedTypeId = function () { } }; +/** + * + * @returns {string} + */ CommentDialog.prototype.getSelectedTypeClass = function () { var selected = this.getSelectedType(); if (selected instanceof Alias) { @@ -310,6 +431,9 @@ CommentDialog.prototype.addComment = function () { }); }; +/** + * + */ CommentDialog.prototype.destroy = function () { $(this.getElement()).dialog("destroy"); }; diff --git a/frontend-js/src/main/js/gui/ContextMenu.js b/frontend-js/src/main/js/gui/ContextMenu.js index f8fdbc8c05..6437fe197c 100644 --- a/frontend-js/src/main/js/gui/ContextMenu.js +++ b/frontend-js/src/main/js/gui/ContextMenu.js @@ -12,6 +12,19 @@ var logger = require('../logger'); var MARGIN = 5; +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * + * @extends AbstractGuiElement + */ function ContextMenu(params) { AbstractGuiElement.call(this, params); var self = this; @@ -42,12 +55,21 @@ function ContextMenu(params) { ContextMenu.prototype = Object.create(AbstractGuiElement.prototype); ContextMenu.prototype.constructor = ContextMenu; +/** + * + */ ContextMenu.prototype.destroy = function () { var self = this; $(document).off('click', self._documentClickListener); $(document).off('touchstart', self._documentClickListener); }; +/** + * + * @param {string|SubMenu} name + * @param {function} [handler] + * @param {boolean} [disabled] + */ ContextMenu.prototype.addOption = function (name, handler, disabled) { if (!disabled) disabled = false; var self = this; @@ -109,6 +131,10 @@ ContextMenu.prototype.open = function (x, y, timestamp) { }); }; +/** + * + * @param {number} timestamp + */ ContextMenu.prototype.hide = function (timestamp) { var self = this; if (self._handledTimeStamp < timestamp) { @@ -117,6 +143,11 @@ ContextMenu.prototype.hide = function (timestamp) { } }; +/** + * + * @param {DataOverlay[]} dataOverlays + * @returns {number[]} + */ function extractDataOverlayIds(dataOverlays) { var ids = []; for (var i = 0; i < dataOverlays.length; i++) { @@ -125,6 +156,10 @@ function extractDataOverlayIds(dataOverlays) { return ids; } +/** + * + * @returns {Promise} + */ ContextMenu.prototype.createExportAsImageSubmenu = function () { var self = this; return self.getMap().getServerConnector().getImageConverters().then(function (converters) { @@ -160,6 +195,10 @@ ContextMenu.prototype.createExportAsImageSubmenu = function () { }); }; +/** + * + * @returns {Promise} + */ ContextMenu.prototype.createExportAsModelSubmenu = function () { var self = this; return self.getMap().getServerConnector().getModelConverters().then(function (converters) { diff --git a/frontend-js/src/main/js/gui/GuiMessageError.js b/frontend-js/src/main/js/gui/GuiMessageError.js index 9cb6b8367a..e978ff15b3 100644 --- a/frontend-js/src/main/js/gui/GuiMessageError.js +++ b/frontend-js/src/main/js/gui/GuiMessageError.js @@ -4,6 +4,12 @@ var logger = require('../logger'); +/** + * + * @param {string} message + * @constructor + * @extends {Error} + */ function GuiMessageError(message) { this.message = message; this.stack = (new Error()).stack; diff --git a/frontend-js/src/main/js/gui/Header.js b/frontend-js/src/main/js/gui/Header.js index 2e2eeab613..c41db05d06 100644 --- a/frontend-js/src/main/js/gui/Header.js +++ b/frontend-js/src/main/js/gui/Header.js @@ -13,6 +13,19 @@ var Promise = require("bluebird"); var logger = require('../logger'); var xss = require('xss'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * + * @extends AbstractGuiElement + */ function Header(params) { AbstractGuiElement.call(this, params); var self = this; @@ -31,6 +44,13 @@ function Header(params) { Header.prototype = Object.create(AbstractGuiElement.prototype); Header.prototype.constructor = Header; +/** + * + * @param {Object} guiParams + * @param {boolean} guiParams.adminLink + * @param {boolean} guiParams.optionsMenu + * @private + */ Header.prototype._createHeaderGui = function (guiParams) { var self = this; self.getElement().className = "minerva-header"; @@ -103,10 +123,19 @@ Header.prototype._createHeaderGui = function (guiParams) { self.getElement().appendChild(homeLink); }; +/** + * + * @param {string} message + */ Header.prototype.addLoadMessage = function (message) { var self = this; self._loadMessages.push(message); }; + +/** + * + * @param {string} message + */ Header.prototype.removeLoadMessage = function (message) { var self = this; var index = self._loadMessages.indexOf(message); @@ -117,6 +146,9 @@ Header.prototype.removeLoadMessage = function (message) { } }; +/** + * return {Promise} + */ Header.prototype.init = function () { var self = this; return new Promise(function (resolve) { @@ -143,6 +175,9 @@ Header.prototype.init = function () { }); }; +/** + * + */ Header.prototype.destroy = function () { var self = this; if (self._onDataLoadStart) { @@ -154,6 +189,10 @@ Header.prototype.destroy = function () { } }; +/** + * + * @param {PluginManager} pluginManager + */ Header.prototype.setPluginManager = function (pluginManager) { var self = this; self._pluginManager = pluginManager; @@ -162,6 +201,10 @@ Header.prototype.setPluginManager = function (pluginManager) { } }; +/** + * + * @returns {PluginManager} + */ Header.prototype.getPluginManager = function () { return this._pluginManager; }; diff --git a/frontend-js/src/main/js/gui/Legend.js b/frontend-js/src/main/js/gui/Legend.js index be280e8225..6be26eeed2 100644 --- a/frontend-js/src/main/js/gui/Legend.js +++ b/frontend-js/src/main/js/gui/Legend.js @@ -8,6 +8,18 @@ var PanelControlElementType = require('./PanelControlElementType'); // noinspection JSUnusedLocalSymbols var logger = require('../logger'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * @extends AbstractGuiElement + */ function Legend(params) { AbstractGuiElement.call(this, params); @@ -17,6 +29,10 @@ function Legend(params) { Legend.prototype = Object.create(AbstractGuiElement.prototype); Legend.prototype.constructor = Legend; +/** + * + * @private + */ Legend.prototype._initializeGui = function () { var self = this; @@ -69,9 +85,16 @@ Legend.prototype._initializeGui = function () { legendDiv.appendChild(rightButton); }; +/** + * + */ Legend.prototype.hide = function () { this.getElement().style.display = "none"; }; + +/** + * + */ Legend.prototype.show = function () { var maxZIndex = Math.max.apply(null, $.map($('body *'), function (e) { @@ -84,6 +107,12 @@ Legend.prototype.show = function () { $(this.getElement()).css('z-index', maxZIndex + 1); }; +/** + * + * @param {string} file + * @param {number} index + * @returns {HTMLLIElement} + */ function createLegendIndicator(file, index) { var result = document.createElement("li"); result.setAttribute("data-target", "legend"); @@ -94,6 +123,12 @@ function createLegendIndicator(file, index) { return result; } +/** + * + * @param {string} file + * @param {number} index + * @returns {HTMLDivElement} + */ function createLegendSlide(file, index) { var result = document.createElement("div"); if (index === 0) { @@ -107,6 +142,11 @@ function createLegendSlide(file, index) { return result; } +/** + * + * @param {string[]}legendFiles + * @returns {Promise<string[]>} + */ function getValidLegendFiles(legendFiles) { var result = []; @@ -130,6 +170,10 @@ function getValidLegendFiles(legendFiles) { }); } +/** + * + * @returns {Promise} + */ Legend.prototype.init = function () { var self = this; var element = self.getElement(); diff --git a/frontend-js/src/main/js/gui/LoginDialog.js b/frontend-js/src/main/js/gui/LoginDialog.js index a32a49e44f..ab627c505d 100644 --- a/frontend-js/src/main/js/gui/LoginDialog.js +++ b/frontend-js/src/main/js/gui/LoginDialog.js @@ -11,19 +11,31 @@ var ConfigurationType = require("../ConfigurationType"); var Functions = require('../Functions'); var logger = require('../logger'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * @extends AbstractGuiElement + */ function LoginDialog(params) { AbstractGuiElement.call(this, params); var self = this; self._createLoginTab(); var loginButton = self.getControlElement(PanelControlElementType.USER_TAB_LOGIN_BUTTON); - loginButton.onclick = function() { + loginButton.onclick = function () { var login = self.getControlElement(PanelControlElementType.USER_TAB_LOGIN_INPUT_TEXT).value; var password = self.getControlElement(PanelControlElementType.USER_TAB_PASSWORD_INPUT_TEXT).value; - return ServerConnector.login(login, password).then(function() { + return ServerConnector.login(login, password).then(function () { window.location.reload(false); - }).then(null, function(error) { + }).then(null, function (error) { if (error instanceof InvalidCredentialsError) { GuiConnector.alert("invalid credentials"); } else { @@ -37,6 +49,11 @@ function LoginDialog(params) { LoginDialog.prototype = Object.create(AbstractGuiElement.prototype); LoginDialog.prototype.constructor = LoginDialog; +/** + * + * @param {HTMLElement[]} elements + * @returns {HTMLElement} + */ LoginDialog.prototype.createTableRow = function (elements) { var row = Functions.createElement({ type: "div", @@ -45,8 +62,8 @@ LoginDialog.prototype.createTableRow = function (elements) { for (var i = 0; i < elements.length; i++) { var cell = Functions.createElement({ - type : "div", - style : "display: table-cell;" + type: "div", + style: "display: table-cell;" }); cell.appendChild(elements[i]); row.appendChild(cell); @@ -54,6 +71,10 @@ LoginDialog.prototype.createTableRow = function (elements) { return row; }; +/** + * + * @private + */ LoginDialog.prototype._createLoginTab = function () { var self = this; @@ -114,6 +135,10 @@ LoginDialog.prototype._createLoginTab = function () { }; +/** + * + * @returns {Promise} + */ LoginDialog.prototype.init = function () { var self = this; return ServerConnector.getConfigurationParam(ConfigurationType.REQUEST_ACCOUNT_EMAIL).then(function (value) { @@ -122,6 +147,9 @@ LoginDialog.prototype.init = function () { }); }; +/** + * + */ LoginDialog.prototype.open = function () { var self = this; var div = self.getElement(); @@ -136,6 +164,9 @@ LoginDialog.prototype.open = function () { $(div).dialog("open"); }; +/** + * + */ LoginDialog.prototype.destroy = function () { var self = this; if ($(self.getElement()).hasClass("ui-dialog-content")) { diff --git a/frontend-js/src/main/js/gui/MapContextMenu.js b/frontend-js/src/main/js/gui/MapContextMenu.js index 048e16d10b..1bc7ba8719 100644 --- a/frontend-js/src/main/js/gui/MapContextMenu.js +++ b/frontend-js/src/main/js/gui/MapContextMenu.js @@ -6,6 +6,19 @@ var ContextMenu = require('./ContextMenu'); var logger = require('../logger'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * + * @extends ContextMenu + */ function MapContextMenu(params) { ContextMenu.call(this, params); var self = this; @@ -17,7 +30,10 @@ function MapContextMenu(params) { MapContextMenu.prototype = Object.create(ContextMenu.prototype); MapContextMenu.prototype.constructor = MapContextMenu; - +/** + * + * @private + */ MapContextMenu.prototype._createMapContextMenuGui = function() { var self = this; self.addOption("Add comment", function() { @@ -28,6 +44,10 @@ MapContextMenu.prototype._createMapContextMenuGui = function() { }); }; +/** + * + * @returns {Promise} + */ MapContextMenu.prototype.init = function() { var self = this; return self.createExportAsImageSubmenu().then(function(submenu){ @@ -38,10 +58,18 @@ MapContextMenu.prototype.init = function() { }); }; +/** + * + * @param {MolArt} molArt + */ MapContextMenu.prototype.setMolArt = function(molArt){ this._molArt = molArt; }; +/** + * + * @returns {MolArt} + */ MapContextMenu.prototype.getMolArt = function(){ return this._molArt; }; diff --git a/frontend-js/src/main/js/gui/OptionsMenu.js b/frontend-js/src/main/js/gui/OptionsMenu.js index 178fa188ae..03b1bec4b4 100644 --- a/frontend-js/src/main/js/gui/OptionsMenu.js +++ b/frontend-js/src/main/js/gui/OptionsMenu.js @@ -4,6 +4,19 @@ var ContextMenu = require('./ContextMenu'); var PluginDialog = require('./PluginDialog'); var Promise = require('bluebird'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * + * @extends ContextMenu + */ function OptionsMenu(params) { ContextMenu.call(this, params); var self = this; @@ -15,6 +28,10 @@ OptionsMenu.prototype = Object.create(ContextMenu.prototype); OptionsMenu.prototype.constructor = OptionsMenu; +/** + * + * @private + */ OptionsMenu.prototype._createMenuGui = function () { var self = this; self.addOption("Plugins", function () { @@ -33,9 +50,18 @@ OptionsMenu.prototype._createMenuGui = function () { }); }; +/** + * + * @returns {Promise} + */ OptionsMenu.prototype.init = function () { return Promise.resolve(); }; + +/** + * + * @returns {Promise} + */ OptionsMenu.prototype.destroy = function () { var self = this; var promises = []; @@ -45,10 +71,18 @@ OptionsMenu.prototype.destroy = function () { return Promise.all(promises); }; +/** + * + * @param {PluginManager} pluginManager + */ OptionsMenu.prototype.setPluginManager = function (pluginManager) { this._pluginManager = pluginManager; }; +/** + * + * @returns {PluginManager} + */ OptionsMenu.prototype.getPluginManager = function () { return this._pluginManager; }; diff --git a/frontend-js/src/main/js/gui/OverviewDialog.js b/frontend-js/src/main/js/gui/OverviewDialog.js index 864743375a..6dabef39ae 100644 --- a/frontend-js/src/main/js/gui/OverviewDialog.js +++ b/frontend-js/src/main/js/gui/OverviewDialog.js @@ -9,6 +9,19 @@ var Point = require('../map/canvas/Point'); var functions = require('../Functions'); var logger = require('../logger'); + +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * @extends AbstractGuiElement + */ function OverviewDialog(params) { AbstractGuiElement.call(this, params); var self = this; @@ -21,6 +34,10 @@ function OverviewDialog(params) { OverviewDialog.prototype = Object.create(AbstractGuiElement.prototype); OverviewDialog.prototype.constructor = OverviewDialog; +/** + * + * @param {number} overviewImageId + */ OverviewDialog.prototype.showOverview = function (overviewImageId) { var self = this; var map = self.getMap(); @@ -174,6 +191,14 @@ OverviewDialog.prototype.showOverview = function (overviewImageId) { $(self.getElement()).dialog("open"); }; +/** + * + * @param {Object} link + * @param {string} link.type + * @param {number} [link.modelLinkId] + * @param {number} [link.imageLinkId] + * @returns {Promise} + */ OverviewDialog.prototype.openLink = function (link) { var self = this; var map = self.getMap(); @@ -201,6 +226,11 @@ OverviewDialog.prototype.openLink = function (link) { } }; +/** + * + * @param {HTMLCanvasElement} canvas + * @param {number} ratio + */ OverviewDialog.prototype.drawClickableShapes = function (canvas, ratio) { var ctx = canvas.getContext("2d"); // clear canvas @@ -220,6 +250,9 @@ OverviewDialog.prototype.drawClickableShapes = function (canvas, ratio) { } }; +/** + * + */ OverviewDialog.prototype.destroy = function () { $(this.getElement()).dialog("destroy"); }; diff --git a/frontend-js/src/main/js/gui/Panel.js b/frontend-js/src/main/js/gui/Panel.js index 309fc1c674..f9208296ff 100644 --- a/frontend-js/src/main/js/gui/Panel.js +++ b/frontend-js/src/main/js/gui/Panel.js @@ -67,12 +67,19 @@ function Panel(params) { Panel.prototype = Object.create(AbstractGuiElement.prototype); Panel.prototype.constructor = Panel; +/** + * + */ Panel.prototype.createHelpButton = function () { var self = this; var helpTipButton = self.getGuiUtils().createHelpButton(self.getHelpTip()); self.getElement().appendChild(helpTipButton); }; +/** + * + * @param {string} message + */ Panel.prototype.disablePanel = function (message) { var self = this; @@ -90,19 +97,36 @@ Panel.prototype.disablePanel = function (message) { $(self.getElement()).prepend(hideReasonDiv); }; +/** + * + * @returns {boolean} + */ Panel.prototype.isDisabled = function () { var self = this; var searchQueryElement = self.getControlElement(PanelControlElementType.SEARCH_DIV); return searchQueryElement.style.visibility === "hidden"; }; + +/** + * + * @param {CustomMap} map + */ Panel.prototype.setMap = function (map) { this._map = map; }; +/** + * + * @param {string} panelName + */ Panel.prototype.setPanelName = function (panelName) { this._panelName = panelName; }; +/** + * + * @returns {string} + */ Panel.prototype.getPanelName = function () { return this._panelName; }; @@ -126,6 +150,12 @@ Panel.prototype.getElement = function () { return this._element; }; +/** + * + * @param {HTMLElement} element + * @param {string} name + * @returns {HTMLElement} + */ Panel.prototype.getElementByName = function (element, name) { if (element !== undefined) { if (element.getAttribute("name") === name) { @@ -143,6 +173,11 @@ Panel.prototype.getElementByName = function (element, name) { return undefined; }; +/** + * + * @param {string} id + * @returns {HTMLElement} + */ Panel.prototype.getDialogDiv = function (id) { var dialogs = this.getElementByName(this.getElement(), "dialogs"); if (dialogs === undefined) { @@ -171,6 +206,11 @@ Panel.prototype.getDialogDiv = function (id) { return dialogDiv; }; +/** + * + * @param {HTMLElement} div + * @param params + */ Panel.prototype.assignDialogOptions = function (div, params) { var dialog = $(div); for (var key in params) { @@ -194,6 +234,11 @@ Panel.prototype.assignDialogOptions = function (div, params) { } }; +/** + * + * @param {string} content + * @param options + */ Panel.prototype.openDialog = function (content, options) { if (options === undefined) { options = {}; @@ -225,14 +270,25 @@ Panel.prototype.openDialog = function (content, options) { $(div).dialog("open"); }; +/** + * + */ Panel.prototype.init = function () { throw new Error(this.getPanelName() + " Not implemented"); }; +/** + * + * @param {AbstractGuiElement} parent + */ Panel.prototype.setParent = function (parent) { this._parent = parent; }; +/** + * + * @returns {AbstractGuiElement} + */ Panel.prototype.getParent = function () { return this._parent; }; @@ -253,6 +309,10 @@ Panel.prototype.getGuiUtils = function () { return this._guiUtils; }; +/** + * + * @param {string} helpTip + */ Panel.prototype.setHelpTip = function (helpTip) { if (this._helpTip === undefined && helpTip !== undefined) { this._helpTip = helpTip; @@ -260,10 +320,17 @@ Panel.prototype.setHelpTip = function (helpTip) { } }; +/** + * + * @returns {string} + */ Panel.prototype.getHelpTip = function () { return this._helpTip; }; +/** + * + */ Panel.prototype.onresize = function () { var self = this; var footerPosition = window.innerHeight; @@ -295,6 +362,9 @@ Panel.prototype.onresize = function () { }; +/** + * + */ Panel.prototype.destroy = function () { for (var id in this._dialogs) { if (this._dialogs.hasOwnProperty(id)) { diff --git a/frontend-js/src/main/js/gui/PluginDialog.js b/frontend-js/src/main/js/gui/PluginDialog.js index 0837775528..572c5c6c11 100644 --- a/frontend-js/src/main/js/gui/PluginDialog.js +++ b/frontend-js/src/main/js/gui/PluginDialog.js @@ -5,6 +5,19 @@ var GuiUtils = require('./leftPanel/GuiUtils'); var Functions = require('../Functions'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * + * @extends AbstractGuiElement + */ function PluginDialog(params) { AbstractGuiElement.call(this, params); var self = this; @@ -15,6 +28,10 @@ function PluginDialog(params) { PluginDialog.prototype = Object.create(AbstractGuiElement.prototype); PluginDialog.prototype.constructor = PluginDialog; +/** + * + * @private + */ PluginDialog.prototype._createPluginGui = function () { var self = this; var guiUtils = new GuiUtils(); @@ -112,6 +129,10 @@ PluginDialog.prototype._createPluginGui = function () { } }; +/** + * + * @returns {Promise} + */ PluginDialog.prototype.init = function () { var self = this; return ServerConnector.getConfiguration().then(function (configuration) { @@ -123,6 +144,9 @@ PluginDialog.prototype.init = function () { }); }; +/** + * + */ PluginDialog.prototype.open = function () { var self = this; self._createPluginGui(); @@ -138,11 +162,18 @@ PluginDialog.prototype.open = function () { $(div).dialog('option', 'title', 'PLUGINS'); $(div).dialog("open"); }; + +/** + * + */ PluginDialog.prototype.close = function () { var self = this; $(self.getElement()).dialog("close"); }; +/** + * + */ PluginDialog.prototype.destroy = function () { var self = this; var div = self.getElement(); @@ -151,10 +182,18 @@ PluginDialog.prototype.destroy = function () { } }; +/** + * + * @param {PluginManager} pluginManager + */ PluginDialog.prototype.setPluginManager = function (pluginManager) { this._pluginManager = pluginManager; }; +/** + * + * @returns {PluginManager} + */ PluginDialog.prototype.getPluginManager = function () { return this._pluginManager; }; diff --git a/frontend-js/src/main/js/gui/SelectionContextMenu.js b/frontend-js/src/main/js/gui/SelectionContextMenu.js index 1c22528851..86faf78f93 100644 --- a/frontend-js/src/main/js/gui/SelectionContextMenu.js +++ b/frontend-js/src/main/js/gui/SelectionContextMenu.js @@ -6,6 +6,19 @@ var ContextMenu = require('./ContextMenu'); var logger = require('../logger'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} params.project + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * + * @extends ContextMenu + */ function SelectionContextMenu(params) { ContextMenu.call(this, params); var self = this; @@ -16,6 +29,10 @@ function SelectionContextMenu(params) { SelectionContextMenu.prototype = Object.create(ContextMenu.prototype); SelectionContextMenu.prototype.constructor = SelectionContextMenu; +/** + * + * @returns {Promise} + */ SelectionContextMenu.prototype.init = function () { var self = this; return self.createExportAsImageSubmenu().then(function (submenu) { @@ -26,6 +43,10 @@ SelectionContextMenu.prototype.init = function () { }); }; +/** + * + * @private + */ SelectionContextMenu.prototype._createSelectionContextMenuGui = function () { var self = this; self.addOption("Remove Selection", function () { diff --git a/frontend-js/src/main/js/gui/admin/AbstractAnnotatorsDialog.js b/frontend-js/src/main/js/gui/admin/AbstractAnnotatorsDialog.js index 275de12a40..d13c51e060 100644 --- a/frontend-js/src/main/js/gui/admin/AbstractAnnotatorsDialog.js +++ b/frontend-js/src/main/js/gui/admin/AbstractAnnotatorsDialog.js @@ -7,6 +7,18 @@ var AbstractGuiElement = require('../AbstractGuiElement'); // noinspection JSUnusedLocalSymbols var logger = require('../../logger'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} [params.customMap] + * @param {Configuration} params.configuration + * @param {Project} [params.project] + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * @extends AbstractGuiElement + */ function AbstractAnnotatorsDialog(params) { AbstractGuiElement.call(this, params); } diff --git a/frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js b/frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js index 63bc240de4..a43363dbea 100644 --- a/frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js +++ b/frontend-js/src/main/js/gui/admin/ChooseAnnotatorsDialog.js @@ -11,6 +11,18 @@ var Functions = require('../../Functions'); // noinspection JSUnusedLocalSymbols var logger = require('../../logger'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} [params.customMap] + * @param {Configuration} params.configuration + * @param {Project} [params.project] + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * @extends AbstractAnnotatorsDialog + */ function ChooseAnnotatorsDialog(params) { AbstractAnnotatorsDialog.call(this, params); var self = this; @@ -20,6 +32,9 @@ function ChooseAnnotatorsDialog(params) { ChooseAnnotatorsDialog.prototype = Object.create(AbstractAnnotatorsDialog.prototype); ChooseAnnotatorsDialog.prototype.constructor = ChooseAnnotatorsDialog; +/** + * + */ ChooseAnnotatorsDialog.prototype.createGui = function () { var self = this; var content = Functions.createElement({ @@ -44,6 +59,12 @@ ChooseAnnotatorsDialog.prototype.createGui = function () { self.getElement().appendChild(content); }; +/** + * + * @param {HTMLElement} element + * @param {User} user + * @returns {Promise} + */ function onChangeParameterValue(element, user) { var name = $(element).siblings(".minerva-annotator-param-name")[0].childNodes[0].nodeValue; var annotatorClassName = $(element).parent().parent().attr('name'); @@ -59,6 +80,12 @@ function onChangeParameterValue(element, user) { return ServerConnector.updateUserPreferences({user: user, preferences: data}).then(null, GuiConnector.alert); } +/** + * + * @param {BioEntityType[][]} elementTypes + * @param {string[]} selectedAnnotators + * @returns {Promise} + */ ChooseAnnotatorsDialog.prototype.saveAnnotatorsInfo = function (elementTypes, selectedAnnotators) { selectedAnnotators = selectedAnnotators.slice(); return ServerConnector.getLoggedUser().then(function (user) { @@ -81,6 +108,11 @@ ChooseAnnotatorsDialog.prototype.saveAnnotatorsInfo = function (elementTypes, se }).catch(GuiConnector.alert); }; +/** + * + * @param {BioEntityTypeTreeNode} elementType + * @returns {Promise} + */ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) { var self = this; @@ -313,6 +345,10 @@ ChooseAnnotatorsDialog.prototype.setElementType = function (elementType) { }; +/** + * + * @returns {Promise} + */ ChooseAnnotatorsDialog.prototype.init = function () { var self = this; return ServerConnector.getConfiguration().then(function (configuration) { @@ -334,10 +370,16 @@ ChooseAnnotatorsDialog.prototype.init = function () { }); }; +/** + * + */ ChooseAnnotatorsDialog.prototype.destroy = function () { $(this.getElement()).dialog("destroy"); }; +/** + * + */ ChooseAnnotatorsDialog.prototype.open = function () { var self = this; var div = self.getElement(); diff --git a/frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js b/frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js index 5c9f1c7791..5d42c41079 100644 --- a/frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js +++ b/frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js @@ -11,6 +11,17 @@ var logger = require('../../logger'); var Promise = require("bluebird"); var xss = require('xss'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {Configuration} params.configuration + * @param {Project} [params.project] + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * @extends AbstractGuiElement + */ function CommentsAdminPanel(params) { params.customMap = null; AbstractGuiElement.call(this, params); @@ -21,6 +32,10 @@ function CommentsAdminPanel(params) { CommentsAdminPanel.prototype = Object.create(AbstractGuiElement.prototype); CommentsAdminPanel.prototype.constructor = CommentsAdminPanel; +/** + * + * @private + */ CommentsAdminPanel.prototype._createGui = function () { var self = this; @@ -53,11 +68,19 @@ CommentsAdminPanel.prototype._createGui = function () { }; +/** + * + * @returns {Promise} + */ CommentsAdminPanel.prototype.init = function () { var self = this; return self.refreshProjects(); }; +/** + * + * @returns {Promise} + */ CommentsAdminPanel.prototype.refreshComments = function () { var self = this; @@ -91,6 +114,11 @@ CommentsAdminPanel.prototype.refreshComments = function () { }); }; +/** + * + * @param {Comment} comment + * @returns {string[]} + */ CommentsAdminPanel.prototype.commentToTableRow = function (comment) { var self = this; var projectId = self.getProject().getProjectId(); @@ -139,6 +167,9 @@ CommentsAdminPanel.prototype.commentToTableRow = function (comment) { toYesNo(comment.isPinned())]; }; +/** + * + */ CommentsAdminPanel.prototype.destroy = function () { var self = this; var table = $("[name='commentsTable']", self.getElement())[0]; diff --git a/frontend-js/src/main/js/gui/admin/LogListDialog.js b/frontend-js/src/main/js/gui/admin/LogListDialog.js index 14dd795f50..6bc07a0f0b 100644 --- a/frontend-js/src/main/js/gui/admin/LogListDialog.js +++ b/frontend-js/src/main/js/gui/admin/LogListDialog.js @@ -10,6 +10,18 @@ var Functions = require('../../Functions'); var GuiConnector = require('../../GuiConnector'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} [params.customMap] + * @param {Configuration} params.configuration + * @param {Project} [params.project] + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * @extends AbstractGuiElement + */ function LogListDialog(params) { AbstractGuiElement.call(this, params); var self = this; @@ -21,6 +33,9 @@ function LogListDialog(params) { LogListDialog.prototype = Object.create(AbstractGuiElement.prototype); LogListDialog.prototype.constructor = LogListDialog; +/** + * + */ LogListDialog.prototype.createLogListDialogGui = function () { var self = this; var head = Functions.createElement({ @@ -76,6 +91,13 @@ LogListDialog.prototype.createLogListDialogGui = function () { }; +/** + * + * @param {Object} data + * @param {function} callback + * @returns {Promise} + * @private + */ LogListDialog.prototype._dataTableAjaxCall = function (data, callback) { var self = this; return ServerConnector.getProjectLogs({ @@ -105,6 +127,12 @@ LogListDialog.prototype._dataTableAjaxCall = function (data, callback) { }); }; +/** + * + * @param {Object} data + * @param {function} callback + * @returns {Promise} + */ LogListDialog.prototype.downloadAll = function (data, callback) { var self = this; return ServerConnector.getProjectLogs({ @@ -152,6 +180,10 @@ LogListDialog.prototype.open = function () { }; +/** + * + * @returns {Array} + */ LogListDialog.prototype.getColumnsDefinition = function () { return [{ name: "id" @@ -160,9 +192,17 @@ LogListDialog.prototype.getColumnsDefinition = function () { }]; }; +/** + * + * @returns {Promise} + */ LogListDialog.prototype.init = function () { return Promise.resolve(); }; + +/** + * + */ LogListDialog.prototype.destroy = function () { var self = this; var div = self.getElement(); diff --git a/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js b/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js index 56f74f8883..16eeb4efd8 100644 --- a/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js +++ b/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js @@ -16,6 +16,18 @@ var Functions = require('../../Functions'); var GuiConnector = require('../../GuiConnector'); var Promise = require("bluebird"); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} [params.customMap] + * @param {Configuration} params.configuration + * @param {Project} [params.project] + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * @extends AbstractGuiElement + */ function MapsAdminPanel(params) { var self = this; AbstractAdminPanel.call(self, params); @@ -28,6 +40,10 @@ function MapsAdminPanel(params) { MapsAdminPanel.prototype = Object.create(AbstractAdminPanel.prototype); MapsAdminPanel.prototype.constructor = MapsAdminPanel; +/** + * + * @private + */ MapsAdminPanel.prototype._createGui = function () { var self = this; var projectsDiv = Functions.createElement({ @@ -47,6 +63,11 @@ MapsAdminPanel.prototype._createGui = function () { }; +/** + * + * @returns {HTMLElement} + * @private + */ MapsAdminPanel.prototype._createMenuRow = function () { var self = this; var menuRow = Functions.createElement({ @@ -78,6 +99,11 @@ MapsAdminPanel.prototype._createMenuRow = function () { return menuRow; }; +/** + * + * @returns {HTMLElement} + * @private + */ MapsAdminPanel.prototype._createProjectTableRow = function () { var self = this; var projectsRow = Functions.createElement({ @@ -213,6 +239,11 @@ MapsAdminPanel.prototype.projectToTableRow = function (project, row, user) { return row; }; +/** + * + * @param {Annotation} annotation + * @returns {string} + */ MapsAdminPanel.prototype.getHtmlStringLink = function (annotation) { var self = this; if (annotation !== undefined && annotation !== null) { @@ -250,6 +281,11 @@ MapsAdminPanel.prototype.setProjects = function (projects) { }); }; +/** + * + * @param {Project} project + * @param {Array} dataTableRow + */ MapsAdminPanel.prototype.addUpdateListener = function (project, dataTableRow) { var self = this; @@ -273,6 +309,10 @@ MapsAdminPanel.prototype.addUpdateListener = function (project, dataTableRow) { project.addListener("onreload", listener); }; +/** + * + * @returns {Promise} + */ MapsAdminPanel.prototype.onAddClicked = function () { var self = this; var dialog = self._addDialog; @@ -299,6 +339,10 @@ MapsAdminPanel.prototype.onAddClicked = function () { } }; +/** + * + * @returns {Promise} + */ MapsAdminPanel.prototype.destroy = function () { var promises = []; var self = this; @@ -325,6 +369,10 @@ MapsAdminPanel.prototype.destroy = function () { return Promise.all(promises); }; +/** + * + * @returns {Promise} + */ MapsAdminPanel.prototype.onRefreshClicked = function () { var self = this; return ServerConnector.getProjects(true).then(function (projects) { @@ -342,6 +390,11 @@ MapsAdminPanel.prototype.onRefreshClicked = function () { }); }; +/** + * + * @param project + * @returns {*} + */ MapsAdminPanel.prototype.getDialog = function (project) { var self = this; if (self._dialogs === undefined) { @@ -356,7 +409,7 @@ MapsAdminPanel.prototype.getDialog = function (project) { project: project, configuration: self.getConfiguration(), customMap: null, - serverConnector:self.getServerConnector() + serverConnector: self.getServerConnector() }); self._dialogs[project.getProjectId()] = dialog; return dialog.init().then(function () { @@ -371,6 +424,12 @@ MapsAdminPanel.prototype.getDialog = function (project) { } }; +/** + * + * @param {string} projectId + * @param {string} level + * @returns {Promise<LogListDialog>} + */ MapsAdminPanel.prototype.getLogDialog = function (projectId, level) { var self = this; if (self._logDialogs === undefined) { @@ -395,6 +454,11 @@ MapsAdminPanel.prototype.getLogDialog = function (projectId, level) { } }; +/** + * + * @param {string} id projectId + * @returns {Promise} + */ MapsAdminPanel.prototype.showEditDialog = function (id) { var self = this; GuiConnector.showProcessing(); @@ -410,6 +474,12 @@ MapsAdminPanel.prototype.showEditDialog = function (id) { }); }; +/** + * + * @param {string} id projectId + * @param {string} level + * @returns {Promise<LogListDialog>} + */ MapsAdminPanel.prototype.showLogs = function (id, level) { var self = this; GuiConnector.showProcessing(); @@ -423,7 +493,11 @@ MapsAdminPanel.prototype.showLogs = function (id, level) { }); }; - +/** + * + * @param {string} id projectId + * @returns {Promise} + */ MapsAdminPanel.prototype.removeProject = function (id) { var self = this; return ServerConnector.removeProject(id).then(function () { diff --git a/frontend-js/src/main/js/gui/admin/ZipEntry.js b/frontend-js/src/main/js/gui/admin/ZipEntry.js index d774a22332..9a4c40d851 100644 --- a/frontend-js/src/main/js/gui/admin/ZipEntry.js +++ b/frontend-js/src/main/js/gui/admin/ZipEntry.js @@ -2,6 +2,14 @@ var types = ["IMAGE", "OVERLAY", "MAP"]; +/** + * + * @param {Object} params + * @param {string} params.type + * @param {string} params.filename + * @param {string} params.data + * @constructor + */ function ZipEntry(params) { var self = this; self.setType(params.type); @@ -9,27 +17,53 @@ function ZipEntry(params) { self.setData(params.data); } +/** + * + * @param {string} type + */ ZipEntry.prototype.setType = function (type) { if (types.indexOf(type) === -1) { throw new Error("Unknown ZipEntryType: " + type + ".") } this._type = type; }; + +/** + * + * @returns {string} + */ ZipEntry.prototype.getType = function () { return this._type; }; +/** + * + * @param {string} filename + */ ZipEntry.prototype.setFilename = function (filename) { this._filename = filename; }; +/** + * + * @returns {string} + */ ZipEntry.prototype.getFilename = function () { return this._filename; }; +/** + * + * @param {string} data + */ ZipEntry.prototype.setData = function (data) { this._data = data; }; + +/** + * + * @returns {string} + */ ZipEntry.prototype.getData = function () { return this._data; }; diff --git a/frontend-js/src/main/js/gui/export/AbstractExportPanel.js b/frontend-js/src/main/js/gui/export/AbstractExportPanel.js index b38d50a2c1..74db8cafbb 100644 --- a/frontend-js/src/main/js/gui/export/AbstractExportPanel.js +++ b/frontend-js/src/main/js/gui/export/AbstractExportPanel.js @@ -10,6 +10,19 @@ var Functions = require('../../Functions'); var DualListbox = require('dual-listbox').DualListbox; var Promise = require("bluebird"); +/** + * + * @param {Configuration} [params.configuration] + * @param {HTMLElement} params.element + * @param {Project} params.project + * @param {CustomMap} params.customMap + * @param {string} params.panelName + * @param {string} [params.helpTip] + * @param params.parent + * + * @constructor + * @extends Panel + */ function AbstractExportPanel(params) { params.scrollable = true; Panel.call(this, params); @@ -19,10 +32,19 @@ function AbstractExportPanel(params) { AbstractExportPanel.prototype = Object.create(Panel.prototype); AbstractExportPanel.prototype.constructor = AbstractExportPanel; +/** + * + */ AbstractExportPanel.prototype.init = function () { }; +/** + * + * @param {Object} val1 + * @param {Object} val2 + * @returns {number} + */ function compareSimple(val1, val2) { if (val1 < val2) { return -1; @@ -33,6 +55,12 @@ function compareSimple(val1, val2) { } } +/** + * + * @param annotations + * @returns {HTMLElement} + * @private + */ AbstractExportPanel.prototype._createMiriamTypeDiv = function (annotations) { var self = this; var typeDiv = Functions.createElement({ @@ -80,6 +108,11 @@ AbstractExportPanel.prototype._createMiriamTypeDiv = function (annotations) { return typeDiv; }; +/** + * + * @param {HTMLElement} selectElement + * @returns {DualListbox} + */ AbstractExportPanel.prototype.createDualListbox = function (selectElement) { return new DualListbox(selectElement, { availableTitle: 'Available', @@ -91,6 +124,12 @@ AbstractExportPanel.prototype.createDualListbox = function (selectElement) { }); }; +/** + * + * @param {BioEntityType[]} elementTypes + * @returns {HTMLElement} + * @private + */ AbstractExportPanel.prototype._createSelectTypeDiv = function (elementTypes) { var typeDiv = Functions.createElement({ type: "div", @@ -132,6 +171,10 @@ AbstractExportPanel.prototype._createSelectTypeDiv = function (elementTypes) { return typeDiv; }; +/** + * + * @returns {Promise<BioEntityType[]>} + */ AbstractExportPanel.prototype.getSelectedTypes = function () { var self = this; @@ -153,13 +196,28 @@ AbstractExportPanel.prototype.getSelectedTypes = function () { return Promise.resolve(result); }; +/** + * + * @param {DualListbox} dualListbox + */ AbstractExportPanel.prototype.setMiriamTypesDualListbox = function (dualListbox) { this._miriamTypesDualListbox = dualListbox; }; + +/** + * + * @returns {DualListbox} + */ AbstractExportPanel.prototype.getMiriamTypesDualListbox = function () { return this._miriamTypesDualListbox; }; +/** + * + * @param {{columnName:string, name:string}[]} columnTypes + * @returns {HTMLElement} + * @private + */ AbstractExportPanel.prototype._createSelectColumnDiv = function (columnTypes) { var columnDiv = Functions.createElement({ type: "div", @@ -193,6 +251,10 @@ AbstractExportPanel.prototype._createSelectColumnDiv = function (columnTypes) { return columnDiv; }; +/** + * + * @returns {Promise<MiriamType[]>} + */ AbstractExportPanel.prototype.getSelectedMiriamTypes = function () { var self = this; return ServerConnector.getConfiguration().then(function (configuration) { @@ -206,6 +268,10 @@ AbstractExportPanel.prototype.getSelectedMiriamTypes = function () { }); }; +/** + * + * @returns {Promise} + */ AbstractExportPanel.prototype.getSelectedColumns = function () { var self = this; @@ -235,6 +301,11 @@ AbstractExportPanel.prototype.getSelectedColumns = function () { return Promise.resolve(result); }; +/** + * + * @returns {Promise<string[]>} + * @private + */ AbstractExportPanel.prototype._getCompartmentNames = function () { var self = this; var compartments = []; @@ -252,10 +323,19 @@ AbstractExportPanel.prototype._getCompartmentNames = function () { }); }; +/** + * + * @returns {MapModel[]} + */ AbstractExportPanel.prototype.getModels = function () { return this.getProject().getModels(); }; +/** + * + * @returns {Promise} + * @private + */ AbstractExportPanel.prototype._getAllCompartments = function () { var self = this; var compartments = []; @@ -278,6 +358,11 @@ AbstractExportPanel.prototype._getAllCompartments = function () { }); }; +/** + * + * @returns {HTMLElement} + * @private + */ AbstractExportPanel.prototype._createDownloadButton = function () { var self = this; var downloadDiv = Functions.createElement({ @@ -310,11 +395,20 @@ AbstractExportPanel.prototype._createDownloadButton = function () { return downloadDiv; }; +/** + * + * @returns {string} + */ AbstractExportPanel.prototype.getSaveFilename = function () { var self = this; return self.getProject().getProjectId() + "-" + self.getPanelName() + ".txt"; }; +/** + * + * @returns {Promise<HTMLElement>} + * @private + */ AbstractExportPanel.prototype._createSelectIncludedCompartmentDiv = function () { var self = this; var typeDiv = Functions.createElement({ @@ -348,6 +442,11 @@ AbstractExportPanel.prototype._createSelectIncludedCompartmentDiv = function () }); }; +/** + * + * @returns {Promise<HTMLElement>} + * @private + */ AbstractExportPanel.prototype._createSelectExcludedCompartmentDiv = function () { var self = this; var typeDiv = Functions.createElement({ @@ -381,13 +480,26 @@ AbstractExportPanel.prototype._createSelectExcludedCompartmentDiv = function () }); }; +/** + * + * @param {DualListbox} dualListbox + */ AbstractExportPanel.prototype.setIncludedCompartmentsDualListbox = function (dualListbox) { this._includedCompartmentsDualListbox = dualListbox; }; + +/** + * + * @returns {DualListbox} + */ AbstractExportPanel.prototype.getIncludedCompartmentsDualListbox = function () { return this._includedCompartmentsDualListbox; }; +/** + * + * @returns {Promise<Array>} + */ AbstractExportPanel.prototype.getSelectedIncludedCompartments = function () { var self = this; var list = self.getIncludedCompartmentsDualListbox().selected; @@ -408,13 +520,26 @@ AbstractExportPanel.prototype.getSelectedIncludedCompartments = function () { }); }; +/** + * + * @param {DualListbox} dualListbox + */ AbstractExportPanel.prototype.setExcludedCompartmentsDualListbox = function (dualListbox) { this._excludedCompartmentsDualListbox = dualListbox; }; + +/** + * + * @returns {DualListbox} + */ AbstractExportPanel.prototype.getExcludedCompartmentsDualListbox = function () { return this._excludedCompartmentsDualListbox; }; +/** + * + * @returns {Promise<Array>} + */ AbstractExportPanel.prototype.getSelectedExcludedCompartments = function () { var self = this; var list = self.getExcludedCompartmentsDualListbox().selected; @@ -435,6 +560,12 @@ AbstractExportPanel.prototype.getSelectedExcludedCompartments = function () { }); }; +/** + * + * @param {{name:string}[]} columns + * @param {MiriamType[]> miriamTypes + * @returns {string} + */ AbstractExportPanel.prototype.createResponseHeader = function (columns, miriamTypes) { var stringBuilder = []; var i; diff --git a/frontend-js/src/main/js/gui/export/ElementExportPanel.js b/frontend-js/src/main/js/gui/export/ElementExportPanel.js index 5b1b0ae483..ceb0ddd96d 100644 --- a/frontend-js/src/main/js/gui/export/ElementExportPanel.js +++ b/frontend-js/src/main/js/gui/export/ElementExportPanel.js @@ -9,6 +9,17 @@ var logger = require('../../logger'); var Promise = require("bluebird"); +/** + * + * @param {Configuration} [params.configuration] + * @param {HTMLElement} params.element + * @param {Project} params.project + * @param {string} [params.helpTip] + * @param params.parent + * + * @constructor + * @extends AbstractExportPanel + */ function ElementExportPanel(params) { params.panelName = "elementExport"; AbstractExportPanel.call(this, params); @@ -17,6 +28,10 @@ function ElementExportPanel(params) { ElementExportPanel.prototype = Object.create(AbstractExportPanel.prototype); ElementExportPanel.prototype.constructor = ElementExportPanel; +/** + * + * @returns {Promise} + */ ElementExportPanel.prototype.init = function () { var self = this; var element = self.getElement(); @@ -43,6 +58,10 @@ ElementExportPanel.prototype.init = function () { }); }; +/** + * + * @returns {Promise<string>} + */ ElementExportPanel.prototype.createResponseString = function () { var self = this; var types, miriamTypes; @@ -102,6 +121,13 @@ ElementExportPanel.prototype.createResponseString = function () { }); }; +/** + * + * @param {Alias} alias + * @param {Array} columns + * @param {MiriamType[]} miriamTypes + * @returns {string} + */ ElementExportPanel.prototype.createResponseRow = function (alias, columns, miriamTypes) { var stringBuilder = []; var i, value; @@ -131,6 +157,10 @@ ElementExportPanel.prototype.createResponseRow = function (alias, columns, miria return stringBuilder.join("\t"); }; +/** + * + * @returns {*[]} + */ ElementExportPanel.prototype.getAllColumns = function () { return [{ "columnName": "id", diff --git a/frontend-js/src/main/js/gui/export/GraphicsExportPanel.js b/frontend-js/src/main/js/gui/export/GraphicsExportPanel.js index 9976880791..db001d2bb2 100644 --- a/frontend-js/src/main/js/gui/export/GraphicsExportPanel.js +++ b/frontend-js/src/main/js/gui/export/GraphicsExportPanel.js @@ -9,6 +9,17 @@ var GuiConnector = require('../../GuiConnector'); var logger = require('../../logger'); var xss = require('xss'); +/** + * + * @param {Configuration} [params.configuration] + * @param {HTMLElement} params.element + * @param {Project} params.project + * @param {string} [params.helpTip] + * @param params.parent + * + * @constructor + * @extends AbstractExportPanel + */ function GraphicsExportPanel(params) { params.panelName = "graphicsExport"; AbstractExportPanel.call(this, params); @@ -17,6 +28,10 @@ function GraphicsExportPanel(params) { GraphicsExportPanel.prototype = Object.create(AbstractExportPanel.prototype); GraphicsExportPanel.prototype.constructor = GraphicsExportPanel; +/** + * + * @returns {Promise} + */ GraphicsExportPanel.prototype.init = function () { var self = this; var element = self.getElement(); @@ -31,6 +46,11 @@ GraphicsExportPanel.prototype.init = function () { }); }; +/** + * + * @returns {HTMLElement} + * @private + */ GraphicsExportPanel.prototype._createSelectProjectDiv = function () { var self = this; var typeDiv = Functions.createElement({ @@ -68,6 +88,12 @@ GraphicsExportPanel.prototype._createSelectProjectDiv = function () { return typeDiv; }; +/** + * + * @param {ImageConverter[]} formats + * @returns {HTMLElement} + * @private + */ GraphicsExportPanel.prototype._createSelectGraphicsFormatDiv = function (formats) { var typeDiv = Functions.createElement({ type: "div", @@ -102,6 +128,10 @@ GraphicsExportPanel.prototype._createSelectGraphicsFormatDiv = function (formats return typeDiv; }; +/** + * + * @returns {string} + */ GraphicsExportPanel.prototype.getSubmapId = function () { var self = this; var div = $("div[name='modelSelectDiv']", $(self.getElement()))[0]; @@ -111,6 +141,11 @@ GraphicsExportPanel.prototype.getSubmapId = function () { }); return id; }; + +/** + * + * @returns {string} + */ GraphicsExportPanel.prototype.getFormatHandler = function () { var self = this; var div = $("div[name='formatSelectDiv']", $(self.getElement()))[0]; @@ -121,6 +156,11 @@ GraphicsExportPanel.prototype.getFormatHandler = function () { return format; }; +/** + * + * @returns {HTMLElement} + * @private + */ GraphicsExportPanel.prototype._createDownloadButton = function () { var self = this; var downloadDiv = Functions.createElement({ diff --git a/frontend-js/src/main/js/gui/export/NetworkExportPanel.js b/frontend-js/src/main/js/gui/export/NetworkExportPanel.js index 1543fafae7..dd90195a70 100644 --- a/frontend-js/src/main/js/gui/export/NetworkExportPanel.js +++ b/frontend-js/src/main/js/gui/export/NetworkExportPanel.js @@ -8,7 +8,17 @@ var Promise = require("bluebird"); var logger = require('../../logger'); var GuiMessageError = require('../GuiMessageError'); - +/** + * + * @param {Configuration} [params.configuration] + * @param {HTMLElement} params.element + * @param {Project} params.project + * @param {string} [params.helpTip] + * @param params.parent + * + * @constructor + * @extends AbstractExportPanel + */ function NetworkExportPanel(params) { params.panelName = "networkExport"; AbstractExportPanel.call(this, params); @@ -17,6 +27,10 @@ function NetworkExportPanel(params) { NetworkExportPanel.prototype = Object.create(AbstractExportPanel.prototype); NetworkExportPanel.prototype.constructor = NetworkExportPanel; +/** + * + * @returns {Promise} + */ NetworkExportPanel.prototype.init = function () { var self = this; @@ -42,9 +56,12 @@ NetworkExportPanel.prototype.init = function () { }).then(function () { $(window).trigger('resize'); }); - }; +/** + * + * @returns {*[]} + */ NetworkExportPanel.prototype.getAllColumns = function () { return [{ "columnName": "elements", @@ -138,6 +155,12 @@ NetworkExportPanel.prototype.getAllColumns = function () { }]; }; +/** + * + * @param {Reaction} reaction + * @param {Object<string,boolean>} elementIds + * @returns {boolean} + */ function matchReaction(reaction, elementIds) { var count = 0; reaction.getElements().forEach(function (element) { @@ -148,6 +171,10 @@ function matchReaction(reaction, elementIds) { return count > 1; } +/** + * + * @returns {Promise<string>} + */ NetworkExportPanel.prototype.createResponseString = function () { var self = this; var types, miriamTypes; @@ -219,6 +246,14 @@ NetworkExportPanel.prototype.createResponseString = function () { }); }; +/** + * + * @param {Reaction} reaction + * @param {Object} columns + * @param {MiriamType[]} miriamTypes + * @param {Object<string,boolean>} elementIds + * @returns {string} + */ NetworkExportPanel.prototype.createResponseRow = function (reaction, columns, miriamTypes, elementIds) { var stringBuilder = []; var i, value; diff --git a/frontend-js/src/main/js/gui/leftPanel/AbstractDbPanel.js b/frontend-js/src/main/js/gui/leftPanel/AbstractDbPanel.js index b6ead02a0d..75fab272c2 100644 --- a/frontend-js/src/main/js/gui/leftPanel/AbstractDbPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/AbstractDbPanel.js @@ -33,6 +33,10 @@ function AbstractDbPanel(params) { AbstractDbPanel.prototype = Object.create(Panel.prototype); AbstractDbPanel.prototype.constructor = AbstractDbPanel; +/** + * + * @private + */ AbstractDbPanel.prototype._createEventHandlers = function () { var self = this; var searchButton = self.getControlElement(PanelControlElementType.SEARCH_BUTTON); @@ -77,6 +81,11 @@ AbstractDbPanel.prototype._createEventHandlers = function () { }; +/** + * + * @param {string} placeholder + * @private + */ AbstractDbPanel.prototype._initializeGui = function (placeholder) { var searchQueryDiv = Functions.createElement({ type: "div", @@ -170,6 +179,10 @@ AbstractDbPanel.prototype._initializeGui = function (placeholder) { }; +/** + * + * @param {AbstractDbOverlay} overlayDb + */ AbstractDbPanel.prototype.setOverlayDb = function (overlayDb) { if (overlayDb === undefined) { throw new Error("Undefined overlayDb for panel: " + this.getPanelName()); @@ -185,6 +198,9 @@ AbstractDbPanel.prototype.getOverlayDb = function () { return this._overlayDb; }; +/** + * + */ AbstractDbPanel.prototype.clearResults = function () { var navElement = this.getControlElement(PanelControlElementType.SEARCH_RESULTS_NAV_TAB); while (navElement.firstChild) { @@ -197,6 +213,10 @@ AbstractDbPanel.prototype.clearResults = function () { } }; +/** + * + * @returns {Promise} + */ AbstractDbPanel.prototype.refreshSearchResults = function () { var self = this; self.clearResults(); @@ -216,14 +236,26 @@ AbstractDbPanel.prototype.refreshSearchResults = function () { }); }; +/** + * + */ AbstractDbPanel.prototype.getAutocomplete = function () { logger.warn("Get autocomplete not implemented"); }; +/** + * + */ AbstractDbPanel.prototype.searchByQuery = function () { throw new Error("searchByQuery is not implemented"); }; +/** + * + * @param {string} query + * @param {BioEntity[]} elements + * @returns {Promise} + */ AbstractDbPanel.prototype.addResultTab = function (query, elements) { var self = this; var name = JSON.parse(query).query; @@ -288,10 +320,12 @@ AbstractDbPanel.prototype.addResultTab = function (query, elements) { }; /** + * @param element + * @param {string} icon * * @returns {Promise<HTMLTableRowElement>} */ -AbstractDbPanel.prototype.createTableElement = function () { +AbstractDbPanel.prototype.createTableElement = function (element, icon) { throw new Error("Not implemented"); }; @@ -369,6 +403,10 @@ AbstractDbPanel.prototype.createTargetRow = function (target, icon) { return Promise.resolve(result); }; +/** + * + * @param {string[]} queries + */ AbstractDbPanel.prototype.computeAutocompleteDictionary = function (queries) { var result = {}; diff --git a/frontend-js/src/main/js/gui/leftPanel/ChemicalPanel.js b/frontend-js/src/main/js/gui/leftPanel/ChemicalPanel.js index 3a72aec79e..eb5decc273 100644 --- a/frontend-js/src/main/js/gui/leftPanel/ChemicalPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/ChemicalPanel.js @@ -35,6 +35,11 @@ function ChemicalPanel(params) { ChemicalPanel.prototype = Object.create(AbstractDbPanel.prototype); ChemicalPanel.prototype.constructor = ChemicalPanel; +/** + * + * @param {Chemical} chemical + * @returns {HTMLDivElement} + */ ChemicalPanel.prototype.createPreamble = function (chemical) { var self = this; var guiUtils = self.getGuiUtils(); @@ -55,10 +60,20 @@ ChemicalPanel.prototype.createPreamble = function (chemical) { return result; }; +/** + * + * @param {Target} target + * @param {string} icon + * @returns {Promise<HTMLTableRowElement>} + */ ChemicalPanel.prototype.createTableElement = function (target, icon) { return this.createTargetRow(target, icon); }; +/** + * + * @returns {Promise} + */ ChemicalPanel.prototype.searchByQuery = function () { var self = this; var query = self.getControlElement(PanelControlElementType.SEARCH_INPUT).value; @@ -66,6 +81,10 @@ ChemicalPanel.prototype.searchByQuery = function () { return self.getOverlayDb().searchByQuery(query); }; +/** + * + * @returns {Promise} + */ ChemicalPanel.prototype.init = function () { var self = this; return self.getToolTipForAnnotation(self.getProject().getDisease()).then(function (toolTip) { @@ -77,10 +96,19 @@ ChemicalPanel.prototype.init = function () { }); }; +/** + * + * @returns {Promise} + */ ChemicalPanel.prototype.destroy = function () { return Promise.resolve(); }; +/** + * + * @param {string} query + * @returns {string[]} + */ ChemicalPanel.prototype.getAutocomplete = function (query) { if (this._searchAutocomplete === undefined) { this.refreshSearchAutocomplete(); @@ -90,6 +118,10 @@ ChemicalPanel.prototype.getAutocomplete = function (query) { return this._searchAutocomplete[query]; }; +/** + * + * @returns {Promise} + */ ChemicalPanel.prototype.refreshSearchAutocomplete = function () { var self = this; self._searchAutocomplete = []; @@ -99,6 +131,11 @@ ChemicalPanel.prototype.refreshSearchAutocomplete = function () { }); }; +/** + * + * @param {Annotation} annotation + * @returns {string} + */ ChemicalPanel.prototype.getToolTipForAnnotation = function (annotation) { var self = this; var promise = Promise.resolve('disease'); diff --git a/frontend-js/src/main/js/gui/leftPanel/DrugPanel.js b/frontend-js/src/main/js/gui/leftPanel/DrugPanel.js index d2b5c8447d..f20e2504dd 100644 --- a/frontend-js/src/main/js/gui/leftPanel/DrugPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/DrugPanel.js @@ -53,16 +53,30 @@ DrugPanel.prototype.createPreamble = function (drug) { return result; }; +/** + * + * @param {Target} target + * @param {string} icon + * @returns {Promise<HTMLTableRowElement>} + */ DrugPanel.prototype.createTableElement = function (target, icon) { return this.createTargetRow(target, icon); }; +/** + * + * @returns {Promise} + */ DrugPanel.prototype.searchByQuery = function () { var self = this; var query = self.getControlElement(PanelControlElementType.SEARCH_INPUT).value; return self.getOverlayDb().searchByQuery(query); }; +/** + * + * @returns {Promise} + */ DrugPanel.prototype.init = function () { var query = ServerConnector.getSessionData().getDrugQuery(); if (query !== undefined) { @@ -72,10 +86,19 @@ DrugPanel.prototype.init = function () { } }; +/** + * + * @returns {Promise} + */ DrugPanel.prototype.destroy = function () { return Promise.resolve(); }; +/** + * + * @param {string} query + * @returns {string[]} + */ DrugPanel.prototype.getAutocomplete = function (query) { if (this._searchAutocomplete === undefined) { this.refreshSearchAutocomplete(); @@ -85,6 +108,10 @@ DrugPanel.prototype.getAutocomplete = function (query) { return this._searchAutocomplete[query]; }; +/** + * + * @returns {Promise} + */ DrugPanel.prototype.refreshSearchAutocomplete = function () { var self = this; self._searchAutocomplete = []; diff --git a/frontend-js/src/main/js/gui/leftPanel/GenericSearchPanel.js b/frontend-js/src/main/js/gui/leftPanel/GenericSearchPanel.js index cb400d39b6..4bbc343c4f 100644 --- a/frontend-js/src/main/js/gui/leftPanel/GenericSearchPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/GenericSearchPanel.js @@ -15,6 +15,12 @@ var SearchBioEntityGroup = require('../../map/data/SearchBioEntityGroup'); var logger = require('../../logger'); var Functions = require('../../Functions'); +/** + * + * @param params + * @constructor + * @extends AbstractDbPanel + */ function GenericSearchPanel(params) { params.panelName = "search"; params.helpTip = "<p>search tab allows to search for particular elements or interactions in the map</p>" @@ -30,6 +36,9 @@ function GenericSearchPanel(params) { GenericSearchPanel.prototype = Object.create(AbstractDbPanel.prototype); GenericSearchPanel.prototype.constructor = GenericSearchPanel; +/** + * + */ GenericSearchPanel.prototype.createSearchGui = function () { var searchDiv = this.getControlElement(PanelControlElementType.SEARCH_DIV); @@ -66,6 +75,10 @@ GenericSearchPanel.prototype.createTableElement = function (element, icon) { } }; +/** + * + * @returns {HTMLDivElement} + */ GenericSearchPanel.prototype.createPreamble = function () { return document.createElement("div"); }; @@ -135,6 +148,10 @@ GenericSearchPanel.prototype.createSearchBioEntityGroupElement = function (group }; +/** + * + * @returns {Promise} + */ GenericSearchPanel.prototype.searchByQuery = function () { var self = this; var query = this.getControlElement(PanelControlElementType.SEARCH_INPUT).value; @@ -142,6 +159,11 @@ GenericSearchPanel.prototype.searchByQuery = function () { return self.getOverlayDb().searchByQuery(query, perfect, true); }; +/** + * + * @param {string} query + * @returns {string[]} + */ GenericSearchPanel.prototype.getAutocomplete = function (query) { if (this._searchAutocomplete === undefined) { this.refreshSearchAutocomplete(); @@ -151,6 +173,10 @@ GenericSearchPanel.prototype.getAutocomplete = function (query) { return this._searchAutocomplete[query]; }; +/** + * + * @returns {Promise} + */ GenericSearchPanel.prototype.refreshSearchAutocomplete = function () { var self = this; self._searchAutocomplete = []; @@ -160,6 +186,10 @@ GenericSearchPanel.prototype.refreshSearchAutocomplete = function () { }); }; +/** + * + * @returns {Promise} + */ GenericSearchPanel.prototype.init = function () { var query = ServerConnector.getSessionData().getSearchQuery(); if (query !== undefined) { diff --git a/frontend-js/src/main/js/gui/leftPanel/LeftPanel.js b/frontend-js/src/main/js/gui/leftPanel/LeftPanel.js index 0814cf115c..b5cbf2b550 100644 --- a/frontend-js/src/main/js/gui/leftPanel/LeftPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/LeftPanel.js @@ -42,6 +42,10 @@ function LeftPanel(params) { LeftPanel.prototype = Object.create(AbstractGuiElement.prototype); LeftPanel.prototype.constructor = LeftPanel; +/** + * + * @private + */ LeftPanel.prototype._createPanelGui = function () { var self = this; var panels = self.getPanelsDefinition(); @@ -84,6 +88,10 @@ LeftPanel.prototype._createPanelGui = function () { } }; +/** + * + * @returns {*[]} + */ LeftPanel.prototype.getPanelsDefinition = function () { return [{ name: "<div class='maintabdiv'><i class='fa fa-search maintab'></i><br>SEARCH</div>", @@ -104,6 +112,10 @@ LeftPanel.prototype.getPanelsDefinition = function () { }]; }; +/** + * + * @returns {Promise} + */ LeftPanel.prototype.init = function () { var self = this; @@ -132,6 +144,11 @@ LeftPanel.prototype.init = function () { return Promise.all(promises); }; +/** + * + * @param {BioEntity} element + * @returns {Promise} + */ LeftPanel.prototype.showElementDetails = function (element) { var self = this; var div = self.elementInfoDiv; @@ -237,38 +254,73 @@ LeftPanel.prototype.getElementTitle = function (bioEntity) { } }; +/** + * + */ LeftPanel.prototype.hide = function () { this.getElement().style.display = "none"; }; + +/** + * + */ LeftPanel.prototype.show = function () { this.getElement().style.display = "block"; }; +/** + * + * @param {Header} header + */ LeftPanel.prototype.setHeader = function (header) { this._header = header; }; +/** + * + * @returns {Header} + */ LeftPanel.prototype.getHeader = function () { return this._header; }; +/** + * + * @param {LoginDialog} loginDialog + */ LeftPanel.prototype.setLoginDialog = function (loginDialog) { this._loginDialog = loginDialog; }; +/** + * + * @returns {LoginDialog} + */ LeftPanel.prototype.getLoginDialog = function () { return this._loginDialog; }; +/** + * + * @param {PluginManager} pluginManager + */ LeftPanel.prototype.setPluginManager = function (pluginManager) { this._pluginManager = pluginManager; this.getHeader().setPluginManager(pluginManager); }; +/** + * + * @returns {PluginManager} + */ LeftPanel.prototype.getPluginManager = function () { return this._pluginManager; }; +/** + * + * @returns {Promise} + */ LeftPanel.prototype.destroy = function () { var self = this; var promises = []; @@ -294,10 +346,18 @@ LeftPanel.prototype.destroy = function () { return Promise.all(promises); }; +/** + * + * @param {boolean} value + */ LeftPanel.prototype.setGoogleLicenseConsentRequired = function (value) { this._googleLicenseConsentRequired = value; }; +/** + * + * @returns {boolean} + */ LeftPanel.prototype.isGoogleLicenseConsentRequired = function () { return this._googleLicenseConsentRequired; }; diff --git a/frontend-js/src/main/js/gui/leftPanel/MiRnaPanel.js b/frontend-js/src/main/js/gui/leftPanel/MiRnaPanel.js index eb678ae5a4..e78e25bfc1 100644 --- a/frontend-js/src/main/js/gui/leftPanel/MiRnaPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/MiRnaPanel.js @@ -8,6 +8,12 @@ var logger = require('../../logger'); var AbstractDbPanel = require('./AbstractDbPanel'); var PanelControlElementType = require('../PanelControlElementType'); +/** + * + * @param params + * @constructor + * @extends AbstractDbPanel + */ function MiRnaPanel(params) { params.panelName = "mirna"; params.helpTip = '<p>source: <a target="_mirtarbase" href="http://mirtarbase.mbc.nctu.edu.tw/">miRTarBase</a></p>' @@ -20,6 +26,11 @@ function MiRnaPanel(params) { MiRnaPanel.prototype = Object.create(AbstractDbPanel.prototype); MiRnaPanel.prototype.constructor = MiRnaPanel; +/** + * + * @param {MiRna} miRna + * @returns {HTMLDivElement} + */ MiRnaPanel.prototype.createPreamble = function(miRna) { var self = this; var guiUtils = self.getGuiUtils(); @@ -40,16 +51,30 @@ MiRnaPanel.prototype.createPreamble = function(miRna) { return result; }; +/** + * + * @param {Target} target + * @param {string} icon + * @returns {Promise<HTMLTableRowElement>} + */ MiRnaPanel.prototype.createTableElement = function(target, icon) { return this.createTargetRow(target, icon); }; +/** + * + * @returns {Promise} + */ MiRnaPanel.prototype.searchByQuery = function() { var self = this; var query = self.getControlElement(PanelControlElementType.SEARCH_INPUT).value; return self.getOverlayDb().searchByQuery(query); }; +/** + * + * @returns {Promise} + */ MiRnaPanel.prototype.init = function() { var query = ServerConnector.getSessionData().getMiRnaQuery(); if (query !== undefined) { @@ -59,10 +84,19 @@ MiRnaPanel.prototype.init = function() { } }; +/** + * + * @returns {Promise} + */ MiRnaPanel.prototype.destroy = function () { return Promise.resolve(); }; +/** + * + * @param {string} query + * @returns {string[]} + */ MiRnaPanel.prototype.getAutocomplete = function (query) { if (this._searchAutocomplete === undefined) { this.refreshSearchAutocomplete(); @@ -72,6 +106,10 @@ MiRnaPanel.prototype.getAutocomplete = function (query) { return this._searchAutocomplete[query]; }; +/** + * + * @returns {Promise} + */ MiRnaPanel.prototype.refreshSearchAutocomplete = function () { var self = this; self._searchAutocomplete = []; diff --git a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js index 0a178c5e30..224549a89a 100644 --- a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js @@ -167,6 +167,9 @@ OverlayPanel.prototype._createOverlayPanelGui = function () { this.setControlElement(PanelControlElementType.OVERLAY_ADD_OVERLAY_BUTTON, addOverlayButton); }; +/** + * + */ OverlayPanel.prototype.clear = function () { var table = this.getControlElement(PanelControlElementType.OVERLAY_GENERAL_OVERLAY_TABLE); while (table.firstChild) { @@ -543,7 +546,7 @@ OverlayPanel.prototype.getCustomOverlaysMessage = function () { /** * - * @returns {PromiseLike} + * @returns {Promise} */ OverlayPanel.prototype.openAddOverlayDialog = function () { var self = this; @@ -659,6 +662,10 @@ OverlayPanel.prototype.destroy = function () { } }; +/** + * + * @param {boolean} value + */ OverlayPanel.prototype.setGoogleLicenseConsentRequired = function (value) { var leftPanel = this.getParent(); if (leftPanel !== undefined) { diff --git a/frontend-js/src/main/js/gui/leftPanel/ProjectInfoPanel.js b/frontend-js/src/main/js/gui/leftPanel/ProjectInfoPanel.js index 004f351df9..de651e16a8 100644 --- a/frontend-js/src/main/js/gui/leftPanel/ProjectInfoPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/ProjectInfoPanel.js @@ -11,6 +11,18 @@ var PublicationListDialog = require('./PublicationListDialog'); var logger = require('../../logger'); var Functions = require('../../Functions'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} [params.configuration] + * @param {Project} [params.project] + * @param params.parent + * + * @constructor + * @extends Panel + */ function ProjectInfoPanel(params) { params.panelName = "info"; params.scrollable = true; @@ -33,6 +45,10 @@ function ProjectInfoPanel(params) { ProjectInfoPanel.prototype = Object.create(Panel.prototype); ProjectInfoPanel.prototype.constructor = ProjectInfoPanel; +/** + * + * @private + */ ProjectInfoPanel.prototype._createInfoPanelGui = function () { var self = this; var guiUtils = self.getGuiUtils(); @@ -184,6 +200,10 @@ ProjectInfoPanel.prototype._createInfoPanelGui = function () { }; +/** + * + * @private + */ ProjectInfoPanel.prototype._createInfoPanelLogic = function () { var self = this; @@ -198,6 +218,10 @@ ProjectInfoPanel.prototype._createInfoPanelLogic = function () { }; }; +/** + * + * @returns {Promise} + */ ProjectInfoPanel.prototype.downloadSourceFile = function () { var self = this; return ServerConnector.getProjectSourceDownloadUrl().then(function (url) { @@ -205,10 +229,18 @@ ProjectInfoPanel.prototype.downloadSourceFile = function () { }).then(null, GuiConnector.alert); }; +/** + * + * @returns {Promise} + */ ProjectInfoPanel.prototype.showPublicationListDialog = function () { return this.publicationListDialog.show(); }; +/** + * + * @returns {Promise} + */ ProjectInfoPanel.prototype.refresh = function () { var self = this; @@ -228,6 +260,10 @@ ProjectInfoPanel.prototype.refresh = function () { }); }; +/** + * + * @private + */ ProjectInfoPanel.prototype._createUserDataTab = function () { var self = this; var guiUtils = self.getGuiUtils(); @@ -335,7 +371,10 @@ ProjectInfoPanel.prototype._createUserDataTab = function () { }; - +/** + * + * @param {User} user + */ ProjectInfoPanel.prototype.showUserProfilePage = function (user) { var self = this; @@ -361,6 +400,10 @@ ProjectInfoPanel.prototype.showUserProfilePage = function (user) { } }; +/** + * + * @returns {Promise} + */ ProjectInfoPanel.prototype.init = function () { var self = this; var email, content; @@ -376,6 +419,9 @@ ProjectInfoPanel.prototype.init = function () { }); }; +/** + * + */ ProjectInfoPanel.prototype.destroy = function () { return this.publicationListDialog.destroy(); }; diff --git a/frontend-js/src/main/js/gui/leftPanel/PublicationListDialog.js b/frontend-js/src/main/js/gui/leftPanel/PublicationListDialog.js index 5f757ba484..9735174270 100644 --- a/frontend-js/src/main/js/gui/leftPanel/PublicationListDialog.js +++ b/frontend-js/src/main/js/gui/leftPanel/PublicationListDialog.js @@ -13,6 +13,17 @@ var Reaction = require('../../map/data/Reaction'); var Functions = require('../../Functions'); var logger = require('../../logger'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} [params.customMap] + * @param {Configuration} params.configuration + * @param {Project} [params.project] + * @param {ServerConnector} [params.serverConnector] + * @constructor + * @extends AbstractGuiElement + */ function PublicationListDialog(params) { AbstractGuiElement.call(this, params); var self = this; @@ -22,6 +33,9 @@ function PublicationListDialog(params) { PublicationListDialog.prototype = Object.create(AbstractGuiElement.prototype); PublicationListDialog.prototype.constructor = PublicationListDialog; +/** + * + */ PublicationListDialog.prototype.createPublicationListDialogGui = function () { var self = this; var head = Functions.createElement({ @@ -51,6 +65,13 @@ PublicationListDialog.prototype.createPublicationListDialogGui = function () { self.getElement().appendChild(tableElement); }; +/** + * + * @param data + * @param {function} callback + * @returns {Promise} + * @private + */ PublicationListDialog.prototype._dataTableAjaxCall = function (data, callback) { var self = this; return ServerConnector.getPublications({ @@ -126,6 +147,10 @@ PublicationListDialog.prototype._dataTableAjaxCall = function (data, callback) { }); }; +/** + * + * @returns {Promise} + */ PublicationListDialog.prototype.show = function () { var self = this; if (!$(self.getElement()).hasClass("ui-dialog-content")) { @@ -158,6 +183,10 @@ PublicationListDialog.prototype.show = function () { }; +/** + * + * @returns {*[]} + */ PublicationListDialog.prototype.getColumnsDefinition = function () { return [{ name: "pubmedId" @@ -180,6 +209,9 @@ PublicationListDialog.prototype.getColumnsDefinition = function () { }]; }; +/** + * + */ PublicationListDialog.prototype.destroy = function () { var self = this; var div = self.getElement(); diff --git a/frontend-js/src/main/js/gui/leftPanel/SubmapPanel.js b/frontend-js/src/main/js/gui/leftPanel/SubmapPanel.js index 2d08849eb5..d13f95c800 100644 --- a/frontend-js/src/main/js/gui/leftPanel/SubmapPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/SubmapPanel.js @@ -10,6 +10,18 @@ var PanelControlElementType = require('../PanelControlElementType'); var logger = require('../../logger'); var Functions = require('../../Functions'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} [params.configuration] + * @param {Project} [params.project] + * @param params.parent + * + * @constructor + * @extends Panel + */ function SubmapPanel(params) { params.panelName = "submap"; params.scrollable = true; @@ -24,6 +36,10 @@ function SubmapPanel(params) { SubmapPanel.prototype = Object.create(Panel.prototype); SubmapPanel.prototype.constructor = SubmapPanel; +/** + * + * @private + */ SubmapPanel.prototype._createSubmapGui = function () { var submapDiv = Functions.createElement({ type: "div", @@ -35,6 +51,11 @@ SubmapPanel.prototype._createSubmapGui = function () { }; +/** + * + * @param {MapModel} model + * @returns {HTMLTableRowElement} + */ SubmapPanel.prototype.createRow = function (model) { var self = this; var guiUtils = self.getGuiUtils(); @@ -62,6 +83,10 @@ SubmapPanel.prototype.createRow = function (model) { return result; }; +/** + * + * @returns {HTMLTableSectionElement} + */ SubmapPanel.prototype.createTableHeader = function () { var result = document.createElement("thead"); @@ -81,6 +106,9 @@ SubmapPanel.prototype.createTableHeader = function () { return result; }; +/** + * @returns {Promise} + */ SubmapPanel.prototype.init = function () { var self = this; return new Promise(function (resolve) { @@ -113,6 +141,12 @@ SubmapPanel.prototype.init = function () { }); }; +/** + * + * @param {MapModel[]} models + * @param {string} type + * @returns {HTMLElement} + */ SubmapPanel.prototype.createTable = function (models, type) { var self = this; var result = Functions.createElement({ @@ -144,6 +178,10 @@ SubmapPanel.prototype.createTable = function (models, type) { return result; }; +/** + * + * @returns {Promise} + */ SubmapPanel.prototype.destroy = function () { return Promise.resolve(); }; diff --git a/frontend-js/src/main/js/gui/topMenu/TopMenu.js b/frontend-js/src/main/js/gui/topMenu/TopMenu.js index 44016f2259..33ffa629f1 100644 --- a/frontend-js/src/main/js/gui/topMenu/TopMenu.js +++ b/frontend-js/src/main/js/gui/topMenu/TopMenu.js @@ -12,6 +12,19 @@ var PanelControlElementType = require('../PanelControlElementType'); var Functions = require('../../Functions'); var logger = require('../../logger'); +/** + * + * @param {Object} params + * @param {HTMLElement} params.element + * @param {CustomMap} params.customMap + * @param {Configuration} params.configuration + * @param {Project} [params.project] + * @param {ServerConnector} [params.serverConnector] + * + * @constructor + * + * @extends AbstractGuiElement + */ function TopMenu(params) { AbstractGuiElement.call(this, params); var self = this; @@ -22,6 +35,10 @@ function TopMenu(params) { TopMenu.prototype = Object.create(AbstractGuiElement.prototype); TopMenu.prototype.constructor = TopMenu; +/** + * + * @private + */ TopMenu.prototype._createGui = function () { var self = this; @@ -140,6 +157,10 @@ TopMenu.prototype._createGui = function () { }; +/** + * + * @returns {Promise} + */ TopMenu.prototype.init = function () { var self = this; self.getControlElement(PanelControlElementType.MENU_LEGEND_CHECKBOX).onclick = function () { @@ -206,22 +227,42 @@ TopMenu.prototype.init = function () { } }; +/** + * + * @param {Legend} legend + */ TopMenu.prototype.setLegend = function (legend) { this._legend = legend; }; +/** + * + * @returns {Legend} + */ TopMenu.prototype.getLegend = function () { return this._legend; }; +/** + * + * @param {LeftPanel} leftPanel + */ TopMenu.prototype.setLeftPanel = function (leftPanel) { this._leftPanel = leftPanel; }; +/** + * + * @returns {LeftPanel} + */ TopMenu.prototype.getLeftPanel = function () { return this._leftPanel; }; +/** + * + * @returns {Promise} + */ TopMenu.prototype.destroy = function () { var self = this; if (self._overviewDialog !== undefined) { @@ -230,6 +271,9 @@ TopMenu.prototype.destroy = function () { return Promise.resolve(); }; +/** + * + */ TopMenu.prototype.toggleLegend = function () { var self = this; var legend = self.getLegend(); diff --git a/frontend-js/src/main/js/map/CustomMap.js b/frontend-js/src/main/js/map/CustomMap.js index e68a051ec5..419f45e184 100644 --- a/frontend-js/src/main/js/map/CustomMap.js +++ b/frontend-js/src/main/js/map/CustomMap.js @@ -1270,6 +1270,9 @@ CustomMap.prototype.getSubmaps = function () { return submaps; }; +/** + * + */ CustomMap.prototype.destroy = function () { var self = this; AbstractCustomMap.prototype.destroy.call(self); diff --git a/frontend-js/src/main/js/map/CustomMapOptions.js b/frontend-js/src/main/js/map/CustomMapOptions.js index 900823b53a..b0ecfd6263 100644 --- a/frontend-js/src/main/js/map/CustomMapOptions.js +++ b/frontend-js/src/main/js/map/CustomMapOptions.js @@ -84,9 +84,18 @@ CustomMapOptions.prototype.setServerConnector = function (serverConnector) { this._serverConnector = serverConnector; }; +/** + * + * @returns {{url:string}[]} + */ CustomMapOptions.prototype.getPlugins = function () { return this._plugins; }; + +/** + * + * @param {{url:string}[]} plugins + */ CustomMapOptions.prototype.setPlugins = function (plugins) { if (plugins === undefined) { plugins = []; diff --git a/frontend-js/src/main/js/map/OverlayParser.js b/frontend-js/src/main/js/map/OverlayParser.js index b785ca26b2..3a68e073e5 100644 --- a/frontend-js/src/main/js/map/OverlayParser.js +++ b/frontend-js/src/main/js/map/OverlayParser.js @@ -4,6 +4,10 @@ var logger = require('./../logger'); var DataOverlay = require('./data/DataOverlay'); var TextDecoder = require('text-encoding').TextDecoder; +/** + * + * @constructor + */ function OverlayParser() { } diff --git a/frontend-js/src/main/js/map/Submap.js b/frontend-js/src/main/js/map/Submap.js index 59ebc50730..37979fe92a 100644 --- a/frontend-js/src/main/js/map/Submap.js +++ b/frontend-js/src/main/js/map/Submap.js @@ -134,6 +134,9 @@ Submap.prototype.getProject = function () { return this.getCustomMap().getProject(); }; +/** + * + */ Submap.prototype.destroy = function () { var self = this; AbstractCustomMap.prototype.destroy.call(self); diff --git a/frontend-js/src/main/js/map/data/Annotator.js b/frontend-js/src/main/js/map/data/Annotator.js index e5653d2b41..69a8c5c87d 100644 --- a/frontend-js/src/main/js/map/data/Annotator.js +++ b/frontend-js/src/main/js/map/data/Annotator.js @@ -6,6 +6,29 @@ var Article = require("./Article"); var logger = require('../../logger'); +/** + * @typedef {Object} AnnotatorOptions + * @property {string} className + * @property {string[]} elementClassNames + * @property {string} name + * @property {string} description + * @property {AnnotatorParameterDefinition[]} parametersDefinitions + * @property {string} url + */ + +/** + * @typedef {Object} AnnotatorParameterDefinition + * @property {string} description + * @property {string} name + * @property {string} type + */ + +/** + * + * @param {Annotator|AnnotatorOptions} javaObject + * @param {Configuration} configuration + * @constructor + */ function Annotator(javaObject, configuration) { var self = this; if (javaObject instanceof Annotator) { @@ -25,46 +48,91 @@ function Annotator(javaObject, configuration) { } } +/** + * + * @param {string} className + */ Annotator.prototype.setClassName = function (className) { this._className = className; }; +/** + * + * @returns {string} + */ Annotator.prototype.getClassName = function () { return this._className; }; +/** + * + * @param {string} name + */ Annotator.prototype.setName = function (name) { this._name = name; }; +/** + * + * @returns {string} + */ Annotator.prototype.getName = function () { return this._name; }; +/** + * + * @param {string} description + */ Annotator.prototype.setDescription = function (description) { this._description = description; }; +/** + * + * @returns {string} + */ Annotator.prototype.getDescription = function () { return this._description; }; +/** + * + * @param {string} url + */ Annotator.prototype.setUrl = function (url) { this._url = url; }; +/** + * + * @returns {string} + */ Annotator.prototype.getUrl = function () { return this._url; }; +/** + * + * @returns {AnnotatorParameterDefinition[]} + */ Annotator.prototype.getParametersDefinitions = function () { return this._parametersDefinitions; }; +/** + * + * @param {AnnotatorParameterDefinition[]} parametersDefinitions + */ Annotator.prototype.setParametersDefinitions = function (parametersDefinitions) { this._parametersDefinitions = parametersDefinitions; }; +/** + * + * @param {string[]} elementTypesClassNames + * @param {Configuration} configuration + */ Annotator.prototype.setElementTypes = function (elementTypesClassNames, configuration) { this._elementTypes = []; var typeByClassName = {}; @@ -90,6 +158,10 @@ Annotator.prototype.setElementTypes = function (elementTypesClassNames, configur } }; +/** + * + * @returns {BioEntityType[]} + */ Annotator.prototype.getElementTypes = function () { return this._elementTypes; }; diff --git a/frontend-js/src/main/js/map/data/DataOverlay.js b/frontend-js/src/main/js/map/data/DataOverlay.js index 2e8b47eacd..16692fff0d 100644 --- a/frontend-js/src/main/js/map/data/DataOverlay.js +++ b/frontend-js/src/main/js/map/data/DataOverlay.js @@ -376,10 +376,18 @@ DataOverlay.prototype.setType = function (type) { this._type = type; }; +/** + * + * @param {boolean} value + */ DataOverlay.prototype.setGoogleLicenseConsent = function(value) { this._googleLicenseConsent = value; }; +/** + * + * @returns {boolean} + */ DataOverlay.prototype.isGoogleLicenseConsent = function() { return this._googleLicenseConsent; }; diff --git a/frontend-js/src/main/js/map/data/IdentifiedElement.js b/frontend-js/src/main/js/map/data/IdentifiedElement.js index 855cdf88c3..c2bbe28b91 100644 --- a/frontend-js/src/main/js/map/data/IdentifiedElement.js +++ b/frontend-js/src/main/js/map/data/IdentifiedElement.js @@ -29,7 +29,7 @@ var logger = require('../../logger'); * objects are stored in {@link PointData}</li> * </ul> * - * @param {BioEntity|LayoutAlias|LayoutReaction|PointData|IdentifiedElementInput} object + * @param {BioEntity|LayoutAlias|LayoutReaction|PointData|IdentifiedElement|IdentifiedElementInput} object * @constructor */ function IdentifiedElement(object) { @@ -193,40 +193,83 @@ IdentifiedElement.prototype.getColor = function () { return this._visualizationdata._color; }; +/** + * + * @param {string} color + */ IdentifiedElement.prototype.setColor = function (color) { this._visualizationdata._color = color; }; +/** + * + * @returns {number} + */ IdentifiedElement.prototype.getOpacity = function () { return this._visualizationdata._opacity; }; +/** + * + * @param {number} opacity + */ IdentifiedElement.prototype.setOpacity = function (opacity) { this._visualizationdata._opacity = opacity; }; +/** + * + * @returns {number} + */ IdentifiedElement.prototype.getLineWeight = function () { return this._visualizationdata._lineWeight; }; +/** + * + * @param {number} lineWeight + */ IdentifiedElement.prototype.setLineWeight = function (lineWeight) { this._visualizationdata._lineWeight = lineWeight; }; + +/** + * + * @returns {number} + */ IdentifiedElement.prototype.getLineOpacity = function () { return this._visualizationdata._lineOpacity; }; +/** + * + * @param {number} lineOpacity + */ IdentifiedElement.prototype.setLineOpacity = function (lineOpacity) { this._visualizationdata._lineOpacity = lineOpacity; }; + +/** + * + * @returns {string} + */ IdentifiedElement.prototype.getLineColor = function () { return this._visualizationdata._lineColor; }; +/** + * + * @param {string} lineColor + */ IdentifiedElement.prototype.setLineColor = function (lineColor) { this._visualizationdata._lineColor = lineColor; }; +/** + * + * @param {IdentifiedElement} argument + * @returns {boolean} + */ IdentifiedElement.prototype.equals = function (argument) { if (argument instanceof IdentifiedElement) { return (this.getType() === argument.getType() && // diff --git a/frontend-js/src/main/js/map/data/KineticLaw.js b/frontend-js/src/main/js/map/data/KineticLaw.js index 0fd2129d88..5dbb25721f 100644 --- a/frontend-js/src/main/js/map/data/KineticLaw.js +++ b/frontend-js/src/main/js/map/data/KineticLaw.js @@ -1,5 +1,18 @@ "use strict"; +/** + * @typedef {Object} KineticLawOptions + * @property {number[]} parameterIds + * @property {number[]} functionIds + * @property {string} definition + * @property {string} mathMlPresentation + */ + +/** + * + * @param {KineticLawOptions} jsonObject + * @constructor + */ function KineticLaw(jsonObject) { var self = this; self.setParameterIds(jsonObject.parameterIds); @@ -8,30 +21,66 @@ function KineticLaw(jsonObject) { self.setMathMlPresentation(jsonObject.mathMlPresentation); } +/** + * + * @param {number[]} parameterIds + */ KineticLaw.prototype.setParameterIds = function (parameterIds) { this._parameterIds = parameterIds; }; + +/** + * + * @returns {number[]} + */ KineticLaw.prototype.getParameterIds = function () { return this._parameterIds; }; +/** + * + * @param {number[]} functionIds + */ KineticLaw.prototype.setFunctionIds = function (functionIds) { this._functionIds = functionIds; }; + +/** + * + * @returns {number[]} + */ KineticLaw.prototype.getFunctionIds = function () { return this._functionIds; }; +/** + * + * @param {string} definition + */ KineticLaw.prototype.setDefinition = function (definition) { this._definition = definition; }; + +/** + * + * @returns {string} + */ KineticLaw.prototype.getDefinition = function () { return this._definition; }; +/** + * + * @param {string} mathMlPresentation + */ KineticLaw.prototype.setMathMlPresentation = function (mathMlPresentation) { this._mathMlPresentation = mathMlPresentation; }; + +/** + * + * @returns {string} + */ KineticLaw.prototype.getMathMlPresentation = function () { return this._mathMlPresentation; }; diff --git a/frontend-js/src/main/js/map/data/LayoutAlias.js b/frontend-js/src/main/js/map/data/LayoutAlias.js index e82336b0ce..a8dc512347 100644 --- a/frontend-js/src/main/js/map/data/LayoutAlias.js +++ b/frontend-js/src/main/js/map/data/LayoutAlias.js @@ -41,54 +41,106 @@ LayoutAlias.LIGHT = "LIGHT"; LayoutAlias.GENETIC_VARIANT = "GENETIC_VARIANT"; LayoutAlias.GENERIC = "GENERIC"; +/** + * + * @returns {number} + */ LayoutAlias.prototype.getId = function () { return this.id; }; +/** + * + * @param id + */ LayoutAlias.prototype.setId = function (id) { this.id = parseInt(id); }; +/** + * + * @returns {number} + */ LayoutAlias.prototype.getModelId = function () { return this._modelId; }; +/** + * + * @param modelId + */ LayoutAlias.prototype.setModelId = function (modelId) { this._modelId = parseInt(modelId); }; +/** + * + * @returns {number} + */ LayoutAlias.prototype.getValue = function () { return this.value; }; +/** + * + * @returns {string} + */ LayoutAlias.prototype.getColor = function () { return this.color; }; +/** + * + * @returns {string} + */ LayoutAlias.prototype.getType = function () { return this._type; }; +/** + * + * @returns {GeneVariant[]} + */ LayoutAlias.prototype.getGeneVariants = function () { return this._geneVariants; }; +/** + * + * @param {number} newValue + */ LayoutAlias.prototype.setValue = function (newValue) { this.value = newValue; }; +/** + * + * @param {string} newColor + */ LayoutAlias.prototype.setColor = function (newColor) { this.color = newColor; }; +/** + * + * @param {string} newType + */ LayoutAlias.prototype.setType = function (newType) { this._type = newType; }; +/** + * + * @param {GeneVariant[]} newGeneVariants + */ LayoutAlias.prototype.setGeneVariants = function (newGeneVariants) { this._geneVariants = newGeneVariants; }; +/** + * + * @param {LayoutAlias} alias + */ LayoutAlias.prototype.update = function (alias) { if (!(alias instanceof LayoutAlias)) { throw new Error("Unknown parameter type: " + alias); @@ -101,14 +153,26 @@ LayoutAlias.prototype.update = function (alias) { this.setDescription(alias.getDescription()); }; +/** + * + * @param {GeneVariant} geneVariant + */ LayoutAlias.prototype.addGeneVariant = function (geneVariant) { this._geneVariants.push(geneVariant); }; +/** + * + * @returns {string} + */ LayoutAlias.prototype.getDescription = function () { return this._description; }; +/** + * + * @param {string} description + */ LayoutAlias.prototype.setDescription = function (description) { this._description = description; }; diff --git a/frontend-js/src/main/js/map/data/LayoutReaction.js b/frontend-js/src/main/js/map/data/LayoutReaction.js index 4c880969b5..f868ab6047 100644 --- a/frontend-js/src/main/js/map/data/LayoutReaction.js +++ b/frontend-js/src/main/js/map/data/LayoutReaction.js @@ -2,7 +2,7 @@ /** * Class representing reaction visualized in a overlay. - * + * * @param javaObject * object de-serialized from ajax query to the server side */ @@ -14,41 +14,83 @@ function LayoutReaction(javaObject) { this.setReverse(javaObject.reverse); } -LayoutReaction.prototype.getId = function() { +/** + * + * @returns {number } + */ +LayoutReaction.prototype.getId = function () { return this.id; }; -LayoutReaction.prototype.setId = function(id) { +/** + * + * @param id + */ +LayoutReaction.prototype.setId = function (id) { this.id = parseInt(id); }; -LayoutReaction.prototype.getModelId = function() { +/** + * + * @returns {number} + */ +LayoutReaction.prototype.getModelId = function () { return this._modelId; }; -LayoutReaction.prototype.setModelId = function(modelId) { +/** + * + * @param modelId + */ +LayoutReaction.prototype.setModelId = function (modelId) { this._modelId = parseInt(modelId); }; -LayoutReaction.prototype.setWidth = function(width) { +/** + * + * @param {number} width + */ +LayoutReaction.prototype.setWidth = function (width) { this.width = width; }; -LayoutReaction.prototype.setColor = function(color) { +/** + * + * @param {string} color + */ +LayoutReaction.prototype.setColor = function (color) { this.color = color; }; -LayoutReaction.prototype.setReverse= function(reverse) { +/** + * + * @param {boolean} reverse + */ +LayoutReaction.prototype.setReverse = function (reverse) { this.reverse = reverse; }; -LayoutReaction.prototype.getWidth = function() { +/** + * + * @returns {number} + */ +LayoutReaction.prototype.getWidth = function () { return this.width; }; -LayoutReaction.prototype.getColor = function() { + +/** + * + * @returns {string} + */ +LayoutReaction.prototype.getColor = function () { return this.color; }; -LayoutReaction.prototype.getReverse = function() { + +/** + * + * @returns {boolean} + */ +LayoutReaction.prototype.getReverse = function () { return this.reverse; }; diff --git a/frontend-js/src/main/js/map/data/MapModel.js b/frontend-js/src/main/js/map/data/MapModel.js index bbe8d32367..7e75d0e1d5 100644 --- a/frontend-js/src/main/js/map/data/MapModel.js +++ b/frontend-js/src/main/js/map/data/MapModel.js @@ -10,12 +10,25 @@ var PointData = require('./PointData'); var Point = require('../canvas/Point'); var Reaction = require('./Reaction'); -// This file describes javascript representation of Java Model class that -// represents content of the map. +/** + * @typedef {Object} MapModelOptions + * @property {number} idObject + * @property {string} name + * @property {number} tileSize + * @property {number} width + * @property {number} height + * @property {number} minZoom + * @property {number} maxZoom + * @property {string} submodelType + * @property {number} defaultCenterX + * @property {number} defaultCenterY + * @property {number} defaultZoomLevel + */ /** - * Default constructor. * + * @param {MapModel|MapModelOptions} configuration + * @constructor */ function MapModel(configuration) { @@ -75,6 +88,13 @@ function MapModel(configuration) { /** * Return list of all aliases that were added to the model. + * + * @param {Object} params + * @param {string} params.type + * @param {number[]} params.includedCompartmentIds + * @param {number[]} params.excludedCompartmentIds + * @param {boolean} params.complete + * @returns {Promise} */ MapModel.prototype.getAliases = function (params) { var self = this; @@ -101,7 +121,7 @@ MapModel.prototype.getAliases = function (params) { * @param {boolean} [complete] * @param {number} id * identifier of the {@link Alias} - * @returns {PromiseLike<Alias>} by identifier + * @returns {Promise<Alias>} by identifier */ MapModel.prototype.getAliasById = function (id, complete) { var self = this; @@ -119,6 +139,13 @@ MapModel.prototype.getAliasById = function (id, complete) { } }; +/** + * Returns {@link Alias} by identifier. + * +* @param {number} id + * identifier of the {@link Alias} + * @returns {Promise<Alias>} by identifier + */ MapModel.prototype.getCompleteAliasById = function (id) { var self = this; if (self._aliases[id] !== undefined && self._aliases[id].isComplete()) { @@ -143,7 +170,7 @@ MapModel.prototype.getCompleteAliasById = function (id) { * @param id * identifier of the {@link Reaction} * @param {boolean} [complete] - * @returns {Promise<Reaction>| PromiseLike<Reaction>} by identifier + * @returns {Promise<Reaction>} by identifier */ MapModel.prototype.getReactionById = function (id, complete) { var self = this; @@ -161,6 +188,12 @@ MapModel.prototype.getReactionById = function (id, complete) { } }; +/** + * TODO this function probably doesn't work because elements are of class Alias + * @param {Reaction[]} reactions + * @returns {Array} + * @private + */ MapModel.prototype._getMissingReactionsElementIds = function (reactions) { var self = this; var result = []; @@ -183,6 +216,11 @@ MapModel.prototype._getMissingReactionsElementIds = function (reactions) { return result; }; +/** + * TODO this reaction should be refactored because getMissingElements returns empty list + * @param {number} id + * @returns {Promise<Reaction>} + */ MapModel.prototype.getCompleteReactionById = function (id) { var self = this; if (self._reactions[id] instanceof Reaction && self._reactions[id].isComplete()) { @@ -218,6 +256,11 @@ MapModel.prototype.getCompleteReactionById = function (id) { } }; +/** + * + * @param {{reactionIds:number[], aliasIds:number[]}} elements + * @returns {Promise} + */ MapModel.prototype.getMissingElements = function (elements) { var self = this; @@ -395,10 +438,18 @@ MapModel.prototype._pointToId = function (point) { } }; +/** + * + * @returns {number} + */ MapModel.prototype.getId = function () { return this.id; }; +/** + * + * @param id + */ MapModel.prototype.setId = function (id) { this.id = parseInt(id); }; @@ -411,6 +462,10 @@ MapModel.prototype.getWidth = function () { return this._width; }; +/** + * + * @param {number} width + */ MapModel.prototype.setWidth = function (width) { this._width = width; }; @@ -423,14 +478,26 @@ MapModel.prototype.getHeight = function () { return this._height; }; +/** + * + * @param {number} height + */ MapModel.prototype.setHeight = function (height) { this._height = height; }; +/** + * + * @returns {string} + */ MapModel.prototype.getName = function () { return this._name; }; +/** + * + * @param {string} name + */ MapModel.prototype.setName = function (name) { this._name = name; }; @@ -443,6 +510,10 @@ MapModel.prototype.getMinZoom = function () { return this._minZoom; }; +/** + * + * @param {number} minZoom + */ MapModel.prototype.setMinZoom = function (minZoom) { this._minZoom = minZoom; }; @@ -495,6 +566,10 @@ MapModel.prototype.getDefaultCenterY = function () { return this._defaultCenterY; }; +/** + * + * @param {number} defaultCenterY + */ MapModel.prototype.setDefaultCenterY = function (defaultCenterY) { if (!isNaN(defaultCenterY)) { this._defaultCenterY = defaultCenterY; @@ -503,18 +578,34 @@ MapModel.prototype.setDefaultCenterY = function (defaultCenterY) { } }; +/** + * + * @returns {string} + */ MapModel.prototype.getSubmodelType = function () { return this._submodelType; }; +/** + * + * @param {string} submodelType + */ MapModel.prototype.setSubmodelType = function (submodelType) { this._submodelType = submodelType; }; +/** + * + * @returns {number} + */ MapModel.prototype.getMaxZoom = function () { return this._maxZoom; }; +/** + * + * @param {number} maxZoom + */ MapModel.prototype.setMaxZoom = function (maxZoom) { this._maxZoom = maxZoom; }; @@ -527,14 +618,28 @@ MapModel.prototype.getTileSize = function () { return this._tileSize; }; +/** + * TODO remove this - it's unused + * @returns {number} + */ MapModel.prototype.getPictureSize = function () { return Math.max(this.getWidth(), this.getHeight()); }; +/** + * + * @param {number} tileSize + */ MapModel.prototype.setTileSize = function (tileSize) { this._tileSize = tileSize; }; +/** + * + * @param {IdentifiedElement} ie + * @param {boolean} complete + * @returns {Promise} + */ MapModel.prototype.getByIdentifiedElement = function (ie, complete) { var self = this; if (ie.getType() === "ALIAS") { @@ -554,6 +659,12 @@ MapModel.prototype.getByIdentifiedElement = function (ie, complete) { } }; +/** + * + * @param {IdentifiedElement[]} identifiedElements + * @param {boolean} complete + * @returns {Promise} + */ MapModel.prototype.getByIdentifiedElements = function (identifiedElements, complete) { var self = this; var missingAliases = []; @@ -583,9 +694,14 @@ MapModel.prototype.getByIdentifiedElements = function (identifiedElements, compl } return Promise.all(promises); }); - }; +/** + * + * @param {IdentifiedElement} ie + * @param {boolean} complete + * @returns {boolean} + */ MapModel.prototype.isAvailable = function (ie, complete) { var element; if (ie.getType() === "ALIAS") { @@ -612,10 +728,22 @@ MapModel.prototype.isAvailable = function (ie, complete) { } }; +/** + * + * @param {Alias} element + * @param {boolean} complete + * @returns {Promise} + */ MapModel.prototype.getReactionsForElement = function (element, complete) { return this.getReactionsForElements([element], complete); }; +/** + * + * @param {Alias[]} elements + * @param {boolean} complete + * @returns {Promise} + */ MapModel.prototype.getReactionsForElements = function (elements, complete) { var self = this; var ids = []; @@ -667,6 +795,10 @@ MapModel.prototype.getReactionsForElements = function (elements, complete) { }); }; +/** + * + * @returns {Promise} + */ MapModel.prototype.getCompartments = function () { var self = this; @@ -688,16 +820,28 @@ MapModel.prototype.getCompartments = function () { }); }; +/** + * + * @param {SbmlFunction} sbmlFunction + */ MapModel.prototype.addSbmlFunction = function (sbmlFunction) { this._sbmlFunctions[sbmlFunction.getId()] = sbmlFunction; }; +/** + * + * @param {SbmlParameter} sbmlParameter + */ MapModel.prototype.addSbmlParameter = function (sbmlParameter) { this._sbmlParameters[sbmlParameter.getId()] = sbmlParameter; }; - +/** + * + * @param {number} id + * @returns {Promise} + */ MapModel.prototype.getSbmlFunctionById = function (id) { var self = this; if (self._sbmlFunctions[id] !== undefined) { @@ -710,6 +854,11 @@ MapModel.prototype.getSbmlFunctionById = function (id) { } }; +/** + * + * @param {number} id + * @returns {Promise} + */ MapModel.prototype.getSbmlParameterById = function (id) { var self = this; if (self._sbmlParameters[id] !== undefined) { diff --git a/frontend-js/src/main/js/map/data/Mesh.js b/frontend-js/src/main/js/map/data/Mesh.js index 433f5ca992..e95d14c47b 100644 --- a/frontend-js/src/main/js/map/data/Mesh.js +++ b/frontend-js/src/main/js/map/data/Mesh.js @@ -1,5 +1,19 @@ "use strict"; +/** + * @typedef {Object} MeshOptions + * @property {string} name + * @property {string[]} synonyms + * @property {string} id + * @property {string} description + */ + + +/** + * + * @param {MeshOptions} jsonObject + * @constructor + */ function Mesh(jsonObject) { var self = this; self.setSynonyms(jsonObject.synonyms); @@ -8,27 +22,66 @@ function Mesh(jsonObject) { self.setDescription(jsonObject.description); } +/** + * + * @param {string[]} synonyms + */ Mesh.prototype.setSynonyms = function (synonyms) { this._synonyms = synonyms; }; + +/** + * + * @returns {string[]} + */ Mesh.prototype.getSynonyms = function () { return this._synonyms; }; + +/** + * + * @param {string} name + */ Mesh.prototype.setName = function (name) { this._name = name; }; + +/** + * + * @returns {string} + */ Mesh.prototype.getName = function () { return this._name; }; + +/** + * + * @param {string} id + */ Mesh.prototype.setId = function (id) { this._id = id; }; + +/** + * + * @returns {string} + */ Mesh.prototype.getId = function () { return this._id; }; + +/** + * + * @param {string} description + */ Mesh.prototype.setDescription = function (description) { this._description = description; }; + +/** + * + * @returns {string} + */ Mesh.prototype.getDescription = function () { return this._description; }; diff --git a/frontend-js/src/main/js/map/data/MiRna.js b/frontend-js/src/main/js/map/data/MiRna.js index a5b7996533..65f101f982 100644 --- a/frontend-js/src/main/js/map/data/MiRna.js +++ b/frontend-js/src/main/js/map/data/MiRna.js @@ -2,6 +2,12 @@ var TargettingStructure = require("./TargettingStructure"); +/** + * + * @param javaObject + * @constructor + * @extends TargettingStructure + */ function MiRna(javaObject) { TargettingStructure.call(this, javaObject); } diff --git a/frontend-js/src/main/js/map/data/MiriamType.js b/frontend-js/src/main/js/map/data/MiriamType.js index 80772a63e0..e97e5dc37a 100644 --- a/frontend-js/src/main/js/map/data/MiriamType.js +++ b/frontend-js/src/main/js/map/data/MiriamType.js @@ -1,7 +1,21 @@ "use strict"; var ObjectWithListeners = require('../../ObjectWithListeners'); +/** + * @typedef {Object} MiriamTypeOptions + * @property {string[]} uris + * @property {string} homepage + * @property {string} commonName + * @property {string} registryIdentifier + */ + +/** + * + * @param {MiriamTypeOptions} data + * @param {string} name + * @constructor + */ function MiriamType(data, name) { // call super constructor ObjectWithListeners.call(this); @@ -17,42 +31,82 @@ function MiriamType(data, name) { MiriamType.prototype = Object.create(ObjectWithListeners.prototype); MiriamType.prototype.constructor = MiriamType; +/** + * + * @param {string[]} uris + */ MiriamType.prototype.setUris = function(uris) { this._uris = uris; }; +/** + * + * @returns {string[]} + */ MiriamType.prototype.getUris = function() { return this._uris; }; +/** + * + * @param {string} homepage + */ MiriamType.prototype.setHomepage = function(homepage) { this._homepage = homepage; }; +/** + * + * @returns {string} + */ MiriamType.prototype.getHomepage = function() { return this._homepage; }; +/** + * + * @param {string} name + */ MiriamType.prototype.setName = function(name) { this._name = name; }; +/** + * + * @returns {string} + */ MiriamType.prototype.getName = function() { return this._name; }; +/** + * + * @param {string} commonName + */ MiriamType.prototype.setCommonName = function(commonName) { this._commonName = commonName; }; +/** + * + * @returns {string} + */ MiriamType.prototype.getCommonName = function() { return this._commonName; }; +/** + * + * @param {string} registryIdentifier + */ MiriamType.prototype.setRegistryIdentifier = function(registryIdentifier) { this._registryIdentifier = registryIdentifier; }; +/** + * + * @returns {string} + */ MiriamType.prototype.getRegistryIdentifier = function() { return this._registryIdentifier; }; diff --git a/frontend-js/src/main/js/map/data/ModificationStateType.js b/frontend-js/src/main/js/map/data/ModificationStateType.js index 3343d4de42..aa8f2b9520 100644 --- a/frontend-js/src/main/js/map/data/ModificationStateType.js +++ b/frontend-js/src/main/js/map/data/ModificationStateType.js @@ -2,6 +2,19 @@ var ObjectWithListeners = require('../../ObjectWithListeners'); +/** + * @typedef {Object} ModificationStateTypeOptions + * @property {string} abbreviation + * @property {string} commonName + */ + +/** + * + * @param {ModificationStateTypeOptions} data + * @param {string} name + * @constructor + * @extends ObjectWithListeners + */ function ModificationStateType(data, name) { // call super constructor ObjectWithListeners.call(this); @@ -15,27 +28,51 @@ function ModificationStateType(data, name) { ModificationStateType.prototype = Object.create(ObjectWithListeners.prototype); ModificationStateType.prototype.constructor = ModificationStateType; -ModificationStateType.prototype.setName = function(name) { +/** + * + * @param {string} name + */ +ModificationStateType.prototype.setName = function (name) { this._name = name; }; -ModificationStateType.prototype.getName = function() { +/** + * + * @returns {string} + */ +ModificationStateType.prototype.getName = function () { return this._name; }; -ModificationStateType.prototype.setAbbreviation= function(abbreviation) { +/** + * + * @param {string} abbreviation + */ +ModificationStateType.prototype.setAbbreviation = function (abbreviation) { this._abbreviation = abbreviation; }; -ModificationStateType.prototype.getAbbreviation = function() { +/** + * + * @returns {string} + */ +ModificationStateType.prototype.getAbbreviation = function () { return this._abbreviation; }; -ModificationStateType.prototype.setCommonName = function(commonName) { +/** + * + * @param {string} commonName + */ +ModificationStateType.prototype.setCommonName = function (commonName) { this._commonName = commonName; }; -ModificationStateType.prototype.getCommonName = function() { +/** + * + * @returns {string} + */ +ModificationStateType.prototype.getCommonName = function () { return this._commonName; }; diff --git a/frontend-js/src/main/js/map/data/Modifier.js b/frontend-js/src/main/js/map/data/Modifier.js index ea94bdd8b4..32aa7c212d 100644 --- a/frontend-js/src/main/js/map/data/Modifier.js +++ b/frontend-js/src/main/js/map/data/Modifier.js @@ -1,20 +1,49 @@ "use strict"; +/** + * @typedef {Object} ModifierOptions + * @property {number} aliasId + * @property {string} stoichiometry + */ +/** + * + * @param {ModifierOptions} javaObject + * @constructor + */ function Modifier(javaObject) { this.setAlias(javaObject.aliasId); this.setStoichiometry(javaObject.stoichiometry); } +/** + * + * @returns {number} + */ Modifier.prototype.getAlias = function () { return this._alias; }; + +/** + * + * @param {number} alias + */ Modifier.prototype.setAlias = function (alias) { this._alias = alias; }; + +/** + * + * @returns {string} + */ Modifier.prototype.getStoichiometry = function () { return this._stoichiometry; }; + +/** + * + * @param {string} stoichiometry + */ Modifier.prototype.setStoichiometry = function (stoichiometry) { this._stoichiometry = stoichiometry; }; diff --git a/frontend-js/src/main/js/map/data/PointData.js b/frontend-js/src/main/js/map/data/PointData.js index 0d23a5dd3c..8e1b4db620 100644 --- a/frontend-js/src/main/js/map/data/PointData.js +++ b/frontend-js/src/main/js/map/data/PointData.js @@ -49,6 +49,10 @@ PointData.prototype.getModelId = function() { return this._modelId; }; +/** + * + * @returns {boolean} + */ PointData.prototype.isComplete = function() { return true; }; diff --git a/frontend-js/src/main/js/map/data/PrivilegeType.js b/frontend-js/src/main/js/map/data/PrivilegeType.js index be25207f9d..ddfb90ca88 100644 --- a/frontend-js/src/main/js/map/data/PrivilegeType.js +++ b/frontend-js/src/main/js/map/data/PrivilegeType.js @@ -2,6 +2,20 @@ var ObjectWithListeners = require('../../ObjectWithListeners'); +/** + * @typedef {Object} PrivilegeTypeOptions + * @property {string} commonName + * @property {string} objectType + * @property {string} valueType + */ + +/** + * + * @param {PrivilegeTypeOptions} data + * @param {string} name + * @constructor + * @extends ObjectWithListeners + */ function PrivilegeType(data, name) { // call super constructor ObjectWithListeners.call(this); @@ -21,32 +35,66 @@ PrivilegeType.MANAGE_GENOMES = 'MANAGE_GENOMES'; PrivilegeType.PROJECT_MANAGEMENT = 'PROJECT_MANAGEMENT'; PrivilegeType.USER_MANAGEMENT = 'USER_MANAGEMENT'; +/** + * + * @param {string} objectType + */ PrivilegeType.prototype.setObjectType = function (objectType) { this._objectType = objectType; }; +/** + * + * @returns {string} + */ PrivilegeType.prototype.getObjectType = function () { return this._objectType; }; + +/** + * + * @param {string} valueType + */ PrivilegeType.prototype.setValueType = function (valueType) { this._valueType = valueType; }; +/** + * + * @returns {string} + */ PrivilegeType.prototype.getValueType = function () { return this._valueType; }; + +/** + * + * @param {string} commonName + */ PrivilegeType.prototype.setCommonName = function (commonName) { this._commonName = commonName; }; +/** + * + * @returns {string} + */ PrivilegeType.prototype.getCommonName = function () { return this._commonName; }; +/** + * + * @param {string} name + */ PrivilegeType.prototype.setName = function (name) { this._name = name; }; +/** + * + * @returns {string} + */ PrivilegeType.prototype.getName = function () { return this._name; }; diff --git a/frontend-js/src/main/js/map/data/Product.js b/frontend-js/src/main/js/map/data/Product.js index d14459e576..f223368acb 100644 --- a/frontend-js/src/main/js/map/data/Product.js +++ b/frontend-js/src/main/js/map/data/Product.js @@ -1,23 +1,45 @@ "use strict"; - +/** + * + * @param {ModifierOptions} javaObject + * @constructor + */ function Product(javaObject) { this.setAlias(javaObject.aliasId); this.setStoichiometry(javaObject.stoichiometry); } +/** + * + * @returns {number} + */ Product.prototype.getAlias = function () { return this._alias; }; + +/** + * + * @param {number} alias + */ Product.prototype.setAlias = function (alias) { this._alias = alias; }; + +/** + * + * @returns {string} + */ Product.prototype.getStoichiometry = function () { return this._stoichiometry; }; + +/** + * + * @param {string} stoichiometry + */ Product.prototype.setStoichiometry = function (stoichiometry) { this._stoichiometry = stoichiometry; }; - module.exports = Product; diff --git a/frontend-js/src/main/js/map/data/Project.js b/frontend-js/src/main/js/map/data/Project.js index 0f9114d09d..82cab1d4c5 100644 --- a/frontend-js/src/main/js/map/data/Project.js +++ b/frontend-js/src/main/js/map/data/Project.js @@ -13,6 +13,15 @@ var Promise = require('bluebird'); // noinspection JSUnusedLocalSymbols var logger = require('../../logger'); +/** + * @typedef {Object} OverviewImage + * @property {number} idObject + * @property {number} width + * @property {number} height + * @property {string} filename + */ + + /** * * @param {Project|string|Object} [data] @@ -260,16 +269,34 @@ Project.prototype.addModel = function (model) { this._models.push(model); }; +/** + * + * @returns {OverviewImage[]} + */ Project.prototype.getOverviewImages = function () { return this._overviewImages; }; + +/** + * + * @param {OverviewImage[]} overviewImages + */ Project.prototype.setOverviewImages = function (overviewImages) { this._overviewImages = overviewImages; }; +/** + * + * @returns {OverviewImage} + */ Project.prototype.getTopOverviewImage = function () { return this._topOverviewImage; }; + +/** + * + * @param {OverviewImage} topOverviewImage + */ Project.prototype.setTopOverviewImage = function (topOverviewImage) { this._topOverviewImage = topOverviewImage; }; @@ -284,7 +311,7 @@ Project.prototype.getDisease = function () { /** * - * @param {Object} disease + * @param {AnnotationOptions} disease */ Project.prototype.setDisease = function (disease) { if (disease !== undefined && disease !== null) { @@ -304,7 +331,7 @@ Project.prototype.getOrganism = function () { /** * - * @param {Object} organism + * @param {AnnotationOptions} organism */ Project.prototype.setOrganism = function (organism) { if (organism !== undefined && organism !== null) { @@ -461,7 +488,7 @@ Project.prototype.getDataOverlays = function () { * * @param {number} overlayId * overlay identifier - * @returns {PromiseLike<DataOverlay>} for a given overlay identifier + * @returns {Promise<DataOverlay>} for a given overlay identifier */ Project.prototype.getDataOverlayById = function (overlayId) { var self = this; diff --git a/frontend-js/src/main/js/map/data/ProjectStatistics.js b/frontend-js/src/main/js/map/data/ProjectStatistics.js index 5230dbdad6..a1bde29512 100644 --- a/frontend-js/src/main/js/map/data/ProjectStatistics.js +++ b/frontend-js/src/main/js/map/data/ProjectStatistics.js @@ -6,6 +6,13 @@ var ObjectWithListeners = require('../../ObjectWithListeners'); var logger = require('../../logger'); +/** + * + * @param data + * @param {Configuration} configuration + * @constructor + * @extends ObjectWithListeners + */ function ProjectStatistics(data, configuration) { // call super constructor ObjectWithListeners.call(this); @@ -18,45 +25,73 @@ function ProjectStatistics(data, configuration) { ProjectStatistics.prototype = Object.create(ObjectWithListeners.prototype); ProjectStatistics.prototype.constructor = ProjectStatistics; -ProjectStatistics.prototype.setReactionAnnotations = function(reactionAnnotations, configuration) { +/** + * + * @param {Object<string, number>} reactionAnnotations + * @param {Configuration} configuration + */ +ProjectStatistics.prototype.setReactionAnnotations = function (reactionAnnotations, configuration) { var self = this; self._reactionAnnotations = []; - for ( var key in reactionAnnotations) { + for (var key in reactionAnnotations) { if (reactionAnnotations.hasOwnProperty(key)) { var miriamType = configuration.getMiriamTypeByName(key); self._reactionAnnotations.push({ - miriamType : miriamType, - count : reactionAnnotations[key] + miriamType: miriamType, + count: reactionAnnotations[key] }); } } }; -ProjectStatistics.prototype.setElementAnnotations = function(elementAnnotations, configuration) { +/** + * + * @param {Object<string, number>} elementAnnotations + * @param {Configuration} configuration + */ +ProjectStatistics.prototype.setElementAnnotations = function (elementAnnotations, configuration) { var self = this; self._elementAnnotations = []; - for ( var key in elementAnnotations) { + for (var key in elementAnnotations) { if (elementAnnotations.hasOwnProperty(key)) { var miriamType = configuration.getMiriamTypeByName(key); self._elementAnnotations.push({ - miriamType : miriamType, - count : elementAnnotations[key] + miriamType: miriamType, + count: elementAnnotations[key] }); } } }; -ProjectStatistics.prototype.getElementAnnotations = function() { +/** + * + * @returns {{miriamType:MiriamType, count:number}[]} + */ +ProjectStatistics.prototype.getElementAnnotations = function () { return this._elementAnnotations; }; -ProjectStatistics.prototype.getReactionAnnotations = function() { + +/** + * + * @returns {{miriamType:MiriamType, count:number}[]} + */ +ProjectStatistics.prototype.getReactionAnnotations = function () { return this._reactionAnnotations; }; -ProjectStatistics.prototype.setPublicationCount = function(count) { +/** + * + * @param {number} count + */ +ProjectStatistics.prototype.setPublicationCount = function (count) { this._publicationsCount = count; }; -ProjectStatistics.prototype.getPublicationCount = function() { + +/** + * + * @returns {number} + */ +ProjectStatistics.prototype.getPublicationCount = function () { return this._publicationsCount; }; diff --git a/frontend-js/src/main/js/map/data/Reactant.js b/frontend-js/src/main/js/map/data/Reactant.js index d6f65d3175..592de3d97b 100644 --- a/frontend-js/src/main/js/map/data/Reactant.js +++ b/frontend-js/src/main/js/map/data/Reactant.js @@ -3,28 +3,54 @@ var Alias = require("./Alias"); +/** + * + * @param {ModifierOptions} javaObject + * @constructor + */ function Reactant(javaObject) { this.setAlias(javaObject.aliasId); this.setStoichiometry(javaObject.stoichiometry); } +/** + * + * @returns {number} + */ Reactant.prototype.getAlias = function () { return this._alias; }; +/** + * + * @param {number} alias + */ Reactant.prototype.setAlias = function (alias) { this._alias = alias; }; -Reactant.prototype.isComplete = function (alias) { +/** + * TODO check if this method is used + * @returns {boolean} + */ +Reactant.prototype.isComplete = function () { return this.getAlias() instanceof Alias; }; + +/** + * + * @returns {string} + */ Reactant.prototype.getStoichiometry = function () { return this._stoichiometry; }; + +/** + * + * @param {string} stoichiometry + */ Reactant.prototype.setStoichiometry = function (stoichiometry) { this._stoichiometry = stoichiometry; }; - module.exports = Reactant; diff --git a/frontend-js/src/main/js/map/data/Reaction.js b/frontend-js/src/main/js/map/data/Reaction.js index 9e9efffa7d..e9f9daa203 100644 --- a/frontend-js/src/main/js/map/data/Reaction.js +++ b/frontend-js/src/main/js/map/data/Reaction.js @@ -17,6 +17,8 @@ var logger = require('../../logger'); * * @param javaObject * object de-serialized from ajax query to the server side + * @constructor + * @extends BioEntity */ function Reaction(javaObject) { BioEntity.call(this, javaObject); @@ -80,16 +82,34 @@ Reaction.prototype.getLines = function () { return result; }; +/** + * + * @returns {Object[]} + */ Reaction.prototype.getMidLines = function () { return this.midLines; }; + +/** + * + * @returns {Object[]} + */ Reaction.prototype.getStartLines = function () { return this.startLines; }; + +/** + * + * @returns {Object[]} + */ Reaction.prototype.getEndLines = function () { return this.endLines; }; +/** + * + * @param {Point| {x:number, y:number}} center + */ Reaction.prototype.setCenter = function (center) { if (center === null || center === undefined) { throw new Error("Setting undefined center: " + center); @@ -97,6 +117,10 @@ Reaction.prototype.setCenter = function (center) { this._center = new Point(center); }; +/** + * + * @param javaObject + */ Reaction.prototype.update = function (javaObject) { if (javaObject.reactionId === undefined) { return; @@ -147,6 +171,10 @@ Reaction.prototype.update = function (javaObject) { this.setIsComplete(true); }; +/** + * + * @returns {boolean} + */ Reaction.prototype.isComplete = function () { var self = this; var result = self._complete; @@ -161,70 +189,138 @@ Reaction.prototype.isComplete = function () { return result; }; +/** + * + * @returns {string} + */ Reaction.prototype.getReactionId = function () { return this._reactionId; }; +/** + * + * @param {string} reactionId + */ Reaction.prototype.setReactionId = function (reactionId) { this._reactionId = reactionId; }; +/** + * + * @returns {string} + */ Reaction.prototype.getMechanicalConfidenceScore = function () { return this._mechanicalConfidenceScore; }; +/** + * + * @param {string} mechanicalConfidenceScore + */ Reaction.prototype.setMechanicalConfidenceScore = function (mechanicalConfidenceScore) { this._mechanicalConfidenceScore = mechanicalConfidenceScore; }; +/** + * + * @returns {string} + */ Reaction.prototype.getLowerBound = function () { return this._lowerBound; }; +/** + * + * @param {string} lowerBound + */ Reaction.prototype.setLowerBound = function (lowerBound) { this._lowerBound = lowerBound; }; +/** + * + * @returns {string} + */ Reaction.prototype.getUpperBound = function () { return this._upperBound; }; +/** + * + * @param {string} upperBound + */ Reaction.prototype.setUpperBound = function (upperBound) { this._upperBound = upperBound; }; +/** + * + * @param {string} geneProteinReaction + */ Reaction.prototype.setGeneProteinReaction = function (geneProteinReaction) { this._geneProteinReaction = geneProteinReaction; }; +/** + * + * @returns {string} + */ Reaction.prototype.getGeneProteinReaction = function () { return this._geneProteinReaction; }; +/** + * + * @param {string} subsystem + */ Reaction.prototype.setSubsystem = function (subsystem) { this._subsystem = subsystem; }; +/** + * + * @returns {string} + */ Reaction.prototype.getSubsystem = function () { return this._subsystem; }; +/** + * + * @returns {Reactant[]} + */ Reaction.prototype.getReactants = function () { return this._reactants; }; +/** + * + * @param {Reactant[]} reactants + */ Reaction.prototype.setReactants = function (reactants) { this._reactants = reactants; }; +/** + * + * @param {Product[]} products + */ Reaction.prototype.setProducts = function (products) { this._products = products; }; +/** + * + * @returns {Product[]} + */ Reaction.prototype.getProducts = function () { return this._products; }; +/** + * + * @returns {Alias[]} + */ Reaction.prototype.getElements = function () { var result = [], i; for (i = 0; i < this.getReactants().length; i++) { @@ -239,17 +335,34 @@ Reaction.prototype.getElements = function () { return result; }; +/** + * + * @param {Modifier[]} modifiers + */ Reaction.prototype.setModifiers = function (modifiers) { this._modifiers = modifiers; }; +/** + * + * @returns {Modifier[]} + */ Reaction.prototype.getModifiers = function () { return this._modifiers; }; +/** + * + * @param {KineticLaw} kineticLaw + */ Reaction.prototype.setKineticLaw = function (kineticLaw) { this._kineticLaw = kineticLaw; }; + +/** + * + * @returns {KineticLaw} + */ Reaction.prototype.getKineticLaw = function () { return this._kineticLaw; }; diff --git a/frontend-js/src/main/js/map/data/ReferenceGenome.js b/frontend-js/src/main/js/map/data/ReferenceGenome.js index cc90df69f7..2b0d4d4c06 100644 --- a/frontend-js/src/main/js/map/data/ReferenceGenome.js +++ b/frontend-js/src/main/js/map/data/ReferenceGenome.js @@ -3,6 +3,23 @@ var Annotation = require('./Annotation'); var ReferenceGenomeGeneMapping = require('./ReferenceGenomeGeneMapping'); +/** + * @typedef {Object} ReferenceGenomeOptions + * @property {number} idObject + * @property {string} type + * @property {string} version + * @property {string} localUrl + * @property {string} sourceUrl + * @property {AnnotationOptions} organism + * @property {number} downloadProgress + * @property {GeneMappingOptions[]} geneMapping + */ + +/** + * + * @param {ReferenceGenomeOptions} [javaObject] + * @constructor + */ function ReferenceGenome(javaObject) { if (javaObject !== undefined && javaObject !== null) { this.setId(javaObject.idObject); diff --git a/frontend-js/src/main/js/map/data/ReferenceGenomeGeneMapping.js b/frontend-js/src/main/js/map/data/ReferenceGenomeGeneMapping.js index d8e955bf20..1d5ec11c43 100644 --- a/frontend-js/src/main/js/map/data/ReferenceGenomeGeneMapping.js +++ b/frontend-js/src/main/js/map/data/ReferenceGenomeGeneMapping.js @@ -1,5 +1,20 @@ "use strict"; + +/** + * @typedef {Object} GeneMappingOptions + * @property {number} idObject + * @property {number} downloadProgress + * @property {string} name + * @property {string} localUrl + * @property {string} sourceUrl + */ + +/** + * + * @param {GeneMappingOptions} javaObject + * @constructor + */ function ReferenceGenomeGeneMapping(javaObject) { this.setName(javaObject.name); if (javaObject.localUrl !== undefined) { diff --git a/frontend-js/src/main/js/map/data/SbmlFunction.js b/frontend-js/src/main/js/map/data/SbmlFunction.js index 077b8a2377..d9a608aeb1 100644 --- a/frontend-js/src/main/js/map/data/SbmlFunction.js +++ b/frontend-js/src/main/js/map/data/SbmlFunction.js @@ -1,5 +1,17 @@ "use strict"; +/** + * + * @param {Object} jsonObject + * @param {string} jsonObject.functionId + * @param {boolean} jsonObject.global + * @param {string} jsonObject.name + * @param {number} jsonObject.id + * @param {string[]} jsonObject.arguments + * @param {string} jsonObject.definition + * @param {string} jsonObject.mathMlPresentation + * @constructor + */ function SbmlFunction(jsonObject) { var self = this; self.setFunctionId(jsonObject.functionId); @@ -10,46 +22,100 @@ function SbmlFunction(jsonObject) { self.setMathMlPresentation(jsonObject.mathMlPresentation); } +/** + * + * @param {string} functionId + */ SbmlFunction.prototype.setFunctionId = function (functionId) { this._functionId = functionId; }; + +/** + * + * @returns {string} + */ SbmlFunction.prototype.getFunctionId = function () { return this._functionId; }; +/** + * + * @param {string} definition + */ SbmlFunction.prototype.setDefinition = function (definition) { this._definition = definition; }; + +/** + * + * @returns {string} + */ SbmlFunction.prototype.getDefinition = function () { return this._definition; }; +/** + * + * @param {string} mathMlPresentation + */ SbmlFunction.prototype.setMathMlPresentation = function (mathMlPresentation) { this._mathMlPresentation = mathMlPresentation; }; + +/** + * + * @returns {string} + */ SbmlFunction.prototype.getMathMlPresentation = function () { return this._mathMlPresentation; }; +/** + * + * @param {string} name + */ SbmlFunction.prototype.setName = function (name) { this._name = name; }; + +/** + * + * @returns {string} + */ SbmlFunction.prototype.getName = function () { return this._name; }; + +/** + * + * @param {string[]} args + */ SbmlFunction.prototype.setArguments = function (args) { this._arguments = args; }; + +/** + * + * @returns {string[]} + */ SbmlFunction.prototype.getArguments = function () { return this._arguments; }; +/** + * + * @param {number} id + */ SbmlFunction.prototype.setId = function (id) { this._id = id; }; + +/** + * + * @returns {number} + */ SbmlFunction.prototype.getId = function () { return this._id; }; - module.exports = SbmlFunction; diff --git a/frontend-js/src/main/js/map/data/SbmlParameter.js b/frontend-js/src/main/js/map/data/SbmlParameter.js index 3bf2430104..723a82f403 100644 --- a/frontend-js/src/main/js/map/data/SbmlParameter.js +++ b/frontend-js/src/main/js/map/data/SbmlParameter.js @@ -1,5 +1,16 @@ "use strict"; +/** + * + * @param {Object} jsonObject + * @param {string} jsonObject.parameterId + * @param {number} jsonObject.value + * @param {boolean} jsonObject.global + * @param {string} jsonObject.name + * @param {number} jsonObject.id + * @param {number} jsonObject.unitsId + * @constructor + */ function SbmlParameter(jsonObject) { var self = this; self.setParameterId(jsonObject.parameterId); @@ -10,44 +21,98 @@ function SbmlParameter(jsonObject) { self.setUnitsId(jsonObject.unitsId); } +/** + * + * @param {string} parameterId + */ SbmlParameter.prototype.setParameterId = function (parameterId) { this._parameterId = parameterId; }; + +/** + * + * @returns {string} + */ SbmlParameter.prototype.getParameterId = function () { return this._parameterId; }; +/** + * + * @param {number} unitsId + */ SbmlParameter.prototype.setUnitsId = function (unitsId) { this._unitsId = unitsId; }; + +/** + * + * @returns {number} + */ SbmlParameter.prototype.getUnitsId = function () { return this._unitsId; }; +/** + * + * @param {string} value + */ SbmlParameter.prototype.setValue = function (value) { this._value = value; }; + +/** + * + * @returns {string} + */ SbmlParameter.prototype.getValue = function () { return this._value; }; +/** + * + * @param {boolean} global + */ SbmlParameter.prototype.setGlobal = function (global) { this._global = global; }; + +/** + * + * @returns {boolean} + */ SbmlParameter.prototype.getGlobal = function () { return this._global; }; +/** + * + * @param {string} name + */ SbmlParameter.prototype.setName = function (name) { this._name = name; }; + +/** + * + * @returns {string} + */ SbmlParameter.prototype.getName = function () { return this._name; }; +/** + * + * @param {number} id + */ SbmlParameter.prototype.setId = function (id) { this._id = id; }; + +/** + * + * @returns {number} + */ SbmlParameter.prototype.getId = function () { return this._id; }; diff --git a/frontend-js/src/main/js/map/data/SearchBioEntityGroup.js b/frontend-js/src/main/js/map/data/SearchBioEntityGroup.js index a7ce5c1c9c..19b4cbe840 100644 --- a/frontend-js/src/main/js/map/data/SearchBioEntityGroup.js +++ b/frontend-js/src/main/js/map/data/SearchBioEntityGroup.js @@ -10,8 +10,9 @@ var logger = require('../../logger'); /** * Class representing merged search bioEntities. * - * @param bioEntity + * @param {BioEntity} bioEntity * initial bioEntity from which group is created + * @constructor */ function SearchBioEntityGroup(bioEntity) { if (!(bioEntity instanceof BioEntity)) { @@ -20,6 +21,11 @@ function SearchBioEntityGroup(bioEntity) { this._bioEntites = [bioEntity]; } +/** + * + * @param {BioEntity} newBioEntity + * @returns {boolean} + */ SearchBioEntityGroup.prototype.bioEntityMatch = function (newBioEntity) { var result = true; var self = this; @@ -33,14 +39,28 @@ SearchBioEntityGroup.prototype.bioEntityMatch = function (newBioEntity) { return result; }; +/** + * + * @param {BioEntity} newBioEntity + */ SearchBioEntityGroup.prototype.addBioEntity = function (newBioEntity) { this._bioEntites.push(newBioEntity); }; +/** + * + * @returns {BioEntity[]} + */ SearchBioEntityGroup.prototype.getBioEntities = function () { return this._bioEntites; }; +/** + * + * @param {BioEntity} bioEntity1 + * @param {BioEntity} bioEntity2 + * @returns {number} + */ SearchBioEntityGroup.prototype.bioEntityComparator = function (bioEntity1, bioEntity2) { if (bioEntity1 instanceof Alias && bioEntity2 instanceof Alias) { if (bioEntity1.getName() !== bioEntity2.getName()) { @@ -92,92 +112,196 @@ SearchBioEntityGroup.prototype.bioEntityComparator = function (bioEntity1, bioEn return -9; }; +/** + * + * @param {string} icon + */ SearchBioEntityGroup.prototype.setIcon = function (icon) { this._icon = icon; }; +/** + * + * @returns {string} + */ SearchBioEntityGroup.prototype.getIcon = function () { return this._icon; }; //aggregated data +/** + * + * @returns {string} + */ SearchBioEntityGroup.prototype.getType = function () { return this._bioEntites[0].getType(); }; +/** + * + * @returns {string} + */ SearchBioEntityGroup.prototype.getName = function () { return this._bioEntites[0].getName(); }; +/** + * + * @returns {number} + */ SearchBioEntityGroup.prototype.getModelId = function () { return this._bioEntites[0].getModelId(); }; +/** + * + * @returns {number} + */ SearchBioEntityGroup.prototype.getCompartmentId = function () { return this._bioEntites[0].getCompartmentId(); }; +/** + * + * @returns {Reactant[]} + */ SearchBioEntityGroup.prototype.getReactants = function () { return this._bioEntites[0].getReactants(); }; + +/** + * + * @returns {Product[]} + */ SearchBioEntityGroup.prototype.getProducts = function () { return this._bioEntites[0].getProducts(); }; + +/** + * + * @returns {Modifier[]} + */ SearchBioEntityGroup.prototype.getModifiers = function () { return this._bioEntites[0].getModifiers(); }; +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getFullName = function () { return this.getMergedParameterByFunction("getFullName"); }; +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getReactionId = function () { return this.getMergedParameterByFunction("getReactionId"); }; + +/** + * @returns {number} + */ SearchBioEntityGroup.prototype.getLinkedSubmodelId = function () { return this.getMergedParameterByFunction("getLinkedSubmodelId"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getSymbol = function () { return this.getMergedParameterByFunction("getSymbol"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getAbbreviation = function () { return this.getMergedParameterByFunction("getAbbreviation"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getFormula = function () { return this.getMergedParameterByFunction("getFormula"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getMechanicalConfidenceScore = function () { return this.getMergedParameterByFunction("getMechanicalConfidenceScore"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getLowerBound = function () { return this.getMergedParameterByFunction("getLowerBound"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getUpperBound = function () { return this.getMergedParameterByFunction("getUpperBound"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getGeneProteinReaction = function () { return this.getMergedParameterByFunction("getGeneProteinReaction"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getSubsystem = function () { return this.getMergedParameterByFunction("getSubsystem"); }; + +/** + * @returns {string} + */ SearchBioEntityGroup.prototype.getDescription = function () { return this.getMergedParameterByFunction("getDescription"); }; + +/** + * @returns {number} + */ SearchBioEntityGroup.prototype.getCharge = function () { return this.getMergedParameterByFunction("getCharge"); }; + +/** + * @returns {string[]} + */ SearchBioEntityGroup.prototype.getSynonyms = function () { return this.getIntersectionListByFunction("getSynonyms"); }; + +/** + * @returns {string[]} + */ SearchBioEntityGroup.prototype.getFormerSymbols = function () { return this.getIntersectionListByFunction("getFormerSymbols"); }; +/** + * @returns {Annotation[]} + */ SearchBioEntityGroup.prototype.getReferences = function () { return this.getIntersectionListByFunction("getReferences"); }; +/** + * + * @param {string} param + * @returns {Object} + */ SearchBioEntityGroup.prototype.getOther = function (param) { if (param === "modifications") { return this.getIntersectionListByFunction(function (alias) { @@ -188,6 +312,11 @@ SearchBioEntityGroup.prototype.getOther = function (param) { } }; +/** + * + * @param {string} functionName + * @returns {*} + */ SearchBioEntityGroup.prototype.getMergedParameterByFunction = function (functionName) { var bioEntities = this.getBioEntities(); var result = bioEntities[0][functionName](); @@ -200,6 +329,11 @@ SearchBioEntityGroup.prototype.getMergedParameterByFunction = function (function return result; }; +/** + * + * @param {string} functionName + * @returns {Array} + */ SearchBioEntityGroup.prototype.getIntersectionListByFunction = function (functionName) { var bioEntities = this.getBioEntities(); var result; diff --git a/frontend-js/src/main/js/map/data/Target.js b/frontend-js/src/main/js/map/data/Target.js index 08e5f71303..e4fe0010c5 100644 --- a/frontend-js/src/main/js/map/data/Target.js +++ b/frontend-js/src/main/js/map/data/Target.js @@ -7,6 +7,19 @@ var IdentifiedElement = require('./IdentifiedElement'); var logger = require('../../logger'); +/** + * @typedef {Object} TargetOptions + * @property {string} name + * @property {IdentifiedElementInput[]} targetElements + * @property {AnnotationOptions[]} targetParticipants + * @property {AnnotationOptions[]} references + */ + +/** + * + * @param {TargetOptions} javaObject + * @constructor + */ function Target(javaObject) { this.setName(javaObject.name); this.setTargetElements(javaObject.targetElements); @@ -14,7 +27,11 @@ function Target(javaObject) { this.setReferences(javaObject.references); } -Target.prototype.setTargetElements = function(targetElements) { +/** + * + * @param {IdentifiedElementInput[]} targetElements + */ +Target.prototype.setTargetElements = function (targetElements) { this._targetElements = []; for (var i = 0; i < targetElements.length; i++) { this._targetElements.push(new IdentifiedElement(targetElements[i])); @@ -22,45 +39,81 @@ Target.prototype.setTargetElements = function(targetElements) { this.setIsVisible(this._targetElements.length > 0); }; -Target.prototype.getTargetElements = function() { +/** + * + * @returns {IdentifiedElement[]} + */ +Target.prototype.getTargetElements = function () { return this._targetElements; }; -Target.prototype.setTargetParticipants = function(targetParticipants) { +/** + * + * @param {AnnotationOptions[]} targetParticipants + */ +Target.prototype.setTargetParticipants = function (targetParticipants) { this._targetParticipants = []; for (var i = 0; i < targetParticipants.length; i++) { this._targetParticipants.push(new Annotation(targetParticipants[i])); } }; -Target.prototype.getTargetParticipants = function() { +/** + * + * @returns {AnnotationOptions[]} + */ +Target.prototype.getTargetParticipants = function () { return this._targetParticipants; }; -Target.prototype.setName = function(name) { +/** + * + * @param {string} name + */ +Target.prototype.setName = function (name) { this._name = name; }; -Target.prototype.getName = function() { +/** + * + * @returns {string} + */ +Target.prototype.getName = function () { return this._name; }; -Target.prototype.setIsVisible = function(visible) { +/** + * + * @param {boolean} visible + */ +Target.prototype.setIsVisible = function (visible) { this._isVisible = visible; }; -Target.prototype.isVisible = function() { +/** + * + * @returns {boolean} + */ +Target.prototype.isVisible = function () { return this._isVisible; }; -Target.prototype.setReferences = function(references) { +/** + * + * @param {AnnotationOptions[]} references + */ +Target.prototype.setReferences = function (references) { this._references = []; for (var i = 0; i < references.length; i++) { this._references.push(new Annotation(references[i])); } }; -Target.prototype.getReferences = function() { +/** + * + * @returns {Annotation[]} + */ +Target.prototype.getReferences = function () { return this._references; }; diff --git a/frontend-js/src/main/js/map/data/TargettingStructure.js b/frontend-js/src/main/js/map/data/TargettingStructure.js index b35a23713c..6bb252a337 100644 --- a/frontend-js/src/main/js/map/data/TargettingStructure.js +++ b/frontend-js/src/main/js/map/data/TargettingStructure.js @@ -6,6 +6,14 @@ var Target = require("./Target"); var logger = require('../../logger'); +/** + * + * @param {Object} [javaObject] + * @param {string} javaObject.name + * @param {number} javaObject.id + * @param {TargetOptions[]} javaObject.targets + * @constructor + */ function TargettingStructure(javaObject) { if (javaObject !== undefined) { this.setName(javaObject.name); @@ -14,22 +22,42 @@ function TargettingStructure(javaObject) { } } +/** + * + * @param {string} name + */ TargettingStructure.prototype.setName = function(name) { this._name = name; }; +/** + * + * @returns {string} + */ TargettingStructure.prototype.getName = function() { return this._name; }; +/** + * + * @param {number} id + */ TargettingStructure.prototype.setId = function(id) { this._id = id; }; +/** + * + * @returns {number} + */ TargettingStructure.prototype.getId = function() { return this._id; }; +/** + * + * @param {TargetOptions[]} targets + */ TargettingStructure.prototype.setTargets = function(targets) { this._targets = []; for (var i = 0; i < targets.length; i++) { @@ -37,10 +65,19 @@ TargettingStructure.prototype.setTargets = function(targets) { } }; +/** + * + * @returns {Target[]} + */ TargettingStructure.prototype.getTargets = function() { return this._targets; }; +/** + * + * @param {IdentifiedElement[]} targetIdentifiedElement + * @returns {Target[]} + */ TargettingStructure.prototype.getTargetsForIdentifiedElement = function(targetIdentifiedElement) { var result = []; this.getTargets().forEach(function(target) { diff --git a/frontend-js/src/main/js/map/data/UserPreferences.js b/frontend-js/src/main/js/map/data/UserPreferences.js index 6d2fa23a5c..634c42897d 100644 --- a/frontend-js/src/main/js/map/data/UserPreferences.js +++ b/frontend-js/src/main/js/map/data/UserPreferences.js @@ -5,6 +5,11 @@ // noinspection JSUnusedLocalSymbols var logger = require('../../logger'); +/** + * + * @param [javaObject] + * @constructor + */ function UserPreferences(javaObject) { if (javaObject !== undefined) { this.setProjectUpload(javaObject["project-upload"]); @@ -23,6 +28,10 @@ function UserPreferences(javaObject) { } } +/** + * + * @param {UserPreferences} userPreferences + */ UserPreferences.prototype.update = function (userPreferences) { var updateDict = function (originalDict, newDict) { for (var key in newDict) { @@ -40,6 +49,16 @@ UserPreferences.prototype.update = function (userPreferences) { updateDict(this._guiPreferences, userPreferences.getGuiPreferences()); }; +/** + * + * @param {Object} projectUpload + * @param {boolean} projectUpload.auto-resize + * @param {boolean} projectUpload.validate-miriam + * @param {boolean} projectUpload.validate-miriam + * @param {boolean} projectUpload.cache-data + * @param {boolean} projectUpload.semantic-zooming + * @param {boolean} projectUpload.sbgn + */ UserPreferences.prototype.setProjectUpload = function (projectUpload) { this._projectUpload = { autoResize: projectUpload["auto-resize"], diff --git a/frontend-js/src/main/js/map/marker/AliasMarker.js b/frontend-js/src/main/js/map/marker/AliasMarker.js index 9418c84a78..f1f7578e91 100644 --- a/frontend-js/src/main/js/map/marker/AliasMarker.js +++ b/frontend-js/src/main/js/map/marker/AliasMarker.js @@ -52,6 +52,10 @@ AliasMarker.prototype.getCoordinates = function () { return new Point(alias.getX() + alias.getWidth() / 2, alias.getY() + alias.getHeight() / 2); }; +/** + * TODO sel._init should be called as overriden method (withouth '_') + * @returns {Promise<any>} + */ AliasMarker.prototype.init = function () { var self = this; var model = self.getCustomMap().getModel(); diff --git a/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js b/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js index aedfaaa67d..5f008db463 100644 --- a/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js @@ -9,10 +9,22 @@ var Promise = require("bluebird"); var IdentifiedElement = require('../data/IdentifiedElement'); var ObjectWithListeners = require('../../ObjectWithListeners'); -var Point= require('../canvas/Point'); +var Point = require('../canvas/Point'); var ServerConnector = require('../../ServerConnector'); +/** + * + * @param {Object} params + * @param {CustomMap} params.map + * @param {string} params.name + * @param {boolean} params.allowGeneralSearch + * @param {boolean} params.allowSearchById + * @param {string} params.iconType + * @param {number} params.iconColorStart + * @constructor + * @extends ObjectWithListeners + */ function AbstractDbOverlay(params) { // call super constructor ObjectWithListeners.call(this); @@ -55,6 +67,14 @@ AbstractDbOverlay.QueryType = { SEARCH_BY_QUERY: "SEARCH_BY_QUERY" }; +/** + * TODO parameters to this function should be changed into a dict + * @param {string} type + * @param arg0 + * @param [arg1] + * @param [arg2] + * @returns {string} + */ AbstractDbOverlay.prototype.encodeQuery = function (type, arg0, arg1, arg2) { if (type === AbstractDbOverlay.QueryType.SEARCH_BY_COORDINATES) { var modelId = arg0; @@ -88,10 +108,22 @@ AbstractDbOverlay.prototype.encodeQuery = function (type, arg0, arg1, arg2) { } }; +/** + * + * @param {string} query + * @returns {any} + */ AbstractDbOverlay.prototype.decodeQuery = function (query) { return JSON.parse(query); }; +/** + * + * @param {string} originalQuery + * @param {boolean} [perfect] + * @param {boolean} [fitBounds] + * @returns {Promise} + */ AbstractDbOverlay.prototype.searchByQuery = function (originalQuery, perfect, fitBounds) { var self = this; var query = self.encodeQuery(AbstractDbOverlay.QueryType.SEARCH_BY_QUERY, originalQuery, perfect); @@ -145,14 +177,28 @@ AbstractDbOverlay.prototype.searchByQuery = function (originalQuery, perfect, fi } ; +/** + * + * @param {string[]} queries + */ AbstractDbOverlay.prototype.setQueries = function (queries) { this._queries = queries; }; +/** + * + * @returns {string[]} + */ AbstractDbOverlay.prototype.getQueries = function () { return this._queries; }; +/** + * + * @param {TargettingStructure} targetingElement + * @param {number} colourId + * @returns {IdentifiedElement[]} + */ AbstractDbOverlay.prototype.createIdentifiedElementsForTargetingClass = function (targetingElement, colourId) { var self = this; var result = []; @@ -179,7 +225,7 @@ AbstractDbOverlay.prototype.createIdentifiedElementsForTargetingClass = function }; /** - * @returns {PromiseLike} + * @returns {Promise} */ AbstractDbOverlay.prototype.refresh = function () { throw new Error("Refreshing shouldn't be called"); @@ -194,6 +240,12 @@ AbstractDbOverlay.prototype.searchByTarget = function (element) { throw new Error("Not implemented"); }; +/** + * + * @param {string} originalQuery + * @param {boolean} fitBounds + * @returns {*} + */ AbstractDbOverlay.prototype.searchByEncodedQuery = function (originalQuery, fitBounds) { var query = this.decodeQuery(originalQuery); query.fitBounds = fitBounds; @@ -215,6 +267,10 @@ AbstractDbOverlay.prototype.searchByEncodedQuery = function (originalQuery, fitB } }; +/** + * + * @returns {Promise<any>} + */ AbstractDbOverlay.prototype.clear = function () { var self = this; return self.searchByQuery("").then(function () { @@ -224,6 +280,8 @@ AbstractDbOverlay.prototype.clear = function () { /** * Returns true if overlay allows to get general data for element. + * + * @returns {boolean} */ AbstractDbOverlay.prototype.allowGeneralSearch = function () { return this._allowGeneralSearch; @@ -231,27 +289,48 @@ AbstractDbOverlay.prototype.allowGeneralSearch = function () { /** * Returns true if overlay allows to get data for element by search id. + * @returns {boolean} */ AbstractDbOverlay.prototype.allowSearchById = function () { return this._allowSearchById; }; +/** + * + * @param {CustomMap} map + */ AbstractDbOverlay.prototype.setMap = function (map) { this._map = map; }; +/** + * + * @returns {CustomMap} + */ AbstractDbOverlay.prototype.getMap = function () { return this._map; }; +/** + * + * @param {string} name + */ AbstractDbOverlay.prototype.setName = function (name) { this.name = name; }; +/** + * + * @returns {string} + */ AbstractDbOverlay.prototype.getName = function () { return this.name; }; +/** + * + * @param {boolean} allowSearchById + */ AbstractDbOverlay.prototype.setAllowSearchById = function (allowSearchById) { // configure if the overlay can contain detailed data about elements that // should be visualized in detailed mode of the Info Window @@ -264,6 +343,10 @@ AbstractDbOverlay.prototype.setAllowSearchById = function (allowSearchById) { } }; +/** + * + * @param {boolean} allowGeneralSearch + */ AbstractDbOverlay.prototype.setAllowGeneralSearch = function (allowGeneralSearch) { if (typeof allowGeneralSearch === "boolean") { this._allowGeneralSearch = allowGeneralSearch; @@ -274,21 +357,41 @@ AbstractDbOverlay.prototype.setAllowGeneralSearch = function (allowGeneralSearch } }; +/** + * + * @param {string} iconType + */ AbstractDbOverlay.prototype.setIconType = function (iconType) { this._iconType = iconType; }; + +/** + * + * @param {number} iconStart + */ AbstractDbOverlay.prototype.setIconStart = function (iconStart) { this._iconStart = iconStart; }; AbstractDbOverlay.IconColors = ["red", "blue", "green", "purple", "yellow", "pink", "paleblue", "brown", "orange"]; +/** + * + * @param {number} colorId + * @returns {string} + */ AbstractDbOverlay.prototype.getColor = function (colorId) { var id = colorId + this._iconStart; id %= AbstractDbOverlay.IconColors.length; return AbstractDbOverlay.IconColors[id]; }; +/** + * + * @param {number} colorId + * @param {number} id + * @returns {string} + */ AbstractDbOverlay.prototype.getIcon = function (colorId, id) { var suffix = "_" + id; if (id >= 100 || id === undefined) { @@ -298,6 +401,12 @@ AbstractDbOverlay.prototype.getIcon = function (colorId, id) { return "marker/" + this._iconType + "/" + this._iconType + "_" + color + suffix + ".png"; }; +/** + * + * @param {string} query + * @param {boolean} [useFullName] + * @returns {string[]} + */ AbstractDbOverlay.prototype.splitQuery = function (query, useFullName) { var result = []; if (query.indexOf(";") >= 0) { diff --git a/frontend-js/src/main/js/map/overlay/AbstractTargettingDbOverlay.js b/frontend-js/src/main/js/map/overlay/AbstractTargettingDbOverlay.js index c357e9cabd..0c14150f97 100644 --- a/frontend-js/src/main/js/map/overlay/AbstractTargettingDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/AbstractTargettingDbOverlay.js @@ -9,6 +9,18 @@ var Promise = require("bluebird"); var IdentifiedElement = require('../data/IdentifiedElement'); var AbstractDbOverlay = require('./AbstractDbOverlay'); +/** + * + * @param {Object} params + * @param {CustomMap} params.map + * @param {string} params.name + * @param {boolean} params.allowGeneralSearch + * @param {boolean} params.allowSearchById + * @param {string} params.iconType + * @param {number} params.iconColorStart + * @constructor + * @extends AbstractDbOverlay + */ function AbstractTargettingDbOverlay(params) { // call super constructor AbstractDbOverlay.call(this, params); @@ -17,6 +29,11 @@ function AbstractTargettingDbOverlay(params) { AbstractTargettingDbOverlay.prototype = Object.create(AbstractDbOverlay.prototype); AbstractTargettingDbOverlay.prototype.constructor = AbstractTargettingDbOverlay; +/** + * + * @param {string} query + * @returns {Promise} + */ AbstractTargettingDbOverlay.prototype.getElementsByQuery = function (query) { var self = this; return new Promise(function (resolve) { @@ -58,6 +75,11 @@ AbstractTargettingDbOverlay.prototype.getElementsByQuery = function (query) { }); }; +/** + * + * @param {string} originalQuery + * @returns {Promise} + */ AbstractTargettingDbOverlay.prototype.searchBySingleQuery = function (originalQuery) { var self = this; var query = self.encodeQuery(AbstractDbOverlay.QueryType.SEARCH_BY_QUERY, originalQuery); @@ -86,6 +108,9 @@ AbstractTargettingDbOverlay.prototype.searchBySingleQuery = function (originalQu } }; +/** + * @returns {Promise} + */ AbstractTargettingDbOverlay.prototype.getIdentifiedElements = function () { var self = this; @@ -120,6 +145,11 @@ AbstractTargettingDbOverlay.prototype.searchByTarget = function (element) { return this.searchNamesByTarget(element); }; +/** + * + * @param {IdentifiedElement} element + * @returns {string[]} + */ AbstractTargettingDbOverlay.prototype.searchNamesByTarget = function (element) { var self = this; var query = self.encodeQuery(AbstractDbOverlay.QueryType.SEARCH_BY_TARGET, element); @@ -136,7 +166,12 @@ AbstractTargettingDbOverlay.prototype.searchNamesByTarget = function (element) { } }; - +/** + * + * @param {IdentifiedElement} element + * @param {boolean} general + * @returns {Promise} + */ AbstractTargettingDbOverlay.prototype.getDetailDataByIdentifiedElement = function (element, general) { var self = this; if (general) { diff --git a/frontend-js/src/main/js/map/overlay/ChemicalDbOverlay.js b/frontend-js/src/main/js/map/overlay/ChemicalDbOverlay.js index e77a989410..f55c4b3a56 100644 --- a/frontend-js/src/main/js/map/overlay/ChemicalDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/ChemicalDbOverlay.js @@ -8,6 +8,12 @@ var AbstractTargettingDbOverlay = require('./AbstractTargettingDbOverlay'); var ServerConnector = require('../../ServerConnector'); +/** + * + * @param params + * @constructor + * @extends AbstractTargettingDbOverlay + */ function ChemicalDbOverlay(params) { params.iconType= "ball"; params.iconColorStart = 1; @@ -19,10 +25,20 @@ function ChemicalDbOverlay(params) { ChemicalDbOverlay.prototype = Object.create(AbstractTargettingDbOverlay.prototype); ChemicalDbOverlay.prototype.constructor = ChemicalDbOverlay; +/** + * + * @param {IdentifiedElement} param + * @returns {Promise<string[]>} + */ ChemicalDbOverlay.prototype.getNamesByTargetFromServer = function(param) { return ServerConnector.getChemicalNamesByTarget(param); }; +/** + * + * @param {string} param.query + * @returns {Promise<Chemical[]>} + */ ChemicalDbOverlay.prototype.getElementsByQueryFromServer = function(param) { return ServerConnector.getChemicalsByQuery(param); }; diff --git a/frontend-js/src/main/js/map/overlay/CommentDbOverlay.js b/frontend-js/src/main/js/map/overlay/CommentDbOverlay.js index da24726b03..b4a629cb36 100644 --- a/frontend-js/src/main/js/map/overlay/CommentDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/CommentDbOverlay.js @@ -9,6 +9,12 @@ var ServerConnector = require('../../ServerConnector'); var logger = require('../../logger'); +/** + * + * @param params + * @constructor + * @extends AbstractDbOverlay + */ function CommentDbOverlay(params) { // call super constructor AbstractDbOverlay.call(this, params); @@ -21,32 +27,50 @@ function CommentDbOverlay(params) { CommentDbOverlay.prototype = Object.create(AbstractDbOverlay.prototype); CommentDbOverlay.prototype.constructor = CommentDbOverlay; -CommentDbOverlay.prototype.refresh = function() { +/** + * + * @returns {Promise} + */ +CommentDbOverlay.prototype.refresh = function () { var self = this; - return ServerConnector.getLightComments({}).then(function(comments) { + return ServerConnector.getLightComments({}).then(function (comments) { self._elements = comments; return self.callListeners('onRefresh'); - }).then(function() { + }).then(function () { return self._elements; }); }; -CommentDbOverlay.prototype.addComment = function(newComment) { +/** + * + * @param {Comment} newComment + * @returns {PromiseLike} + */ +CommentDbOverlay.prototype.addComment = function (newComment) { var self = this; self._elements.push(newComment); - return self.callListeners('onRefresh').then(function() { + return self.callListeners('onRefresh').then(function () { return self._elements; }); }; -CommentDbOverlay.prototype.clear = function() { +/** + * + * @returns {PromiseLike} + */ +CommentDbOverlay.prototype.clear = function () { var self = this; self._elements = []; self._detailDataByIdentifiedElement = []; return self.callListeners('onClear'); }; -CommentDbOverlay.prototype.getDetailDataByIdentifiedElement = function(element) { +/** + * + * @param {IdentifiedElement} element + * @returns {Promise} + */ +CommentDbOverlay.prototype.getDetailDataByIdentifiedElement = function (element) { var self = this; var elementKey = element.getId() + "," + element.getType() + "," + element.getModelId(); if (this._detailDataByIdentifiedElement[elementKey] !== undefined) { @@ -57,19 +81,23 @@ CommentDbOverlay.prototype.getDetailDataByIdentifiedElement = function(element) coordinates = element.getPoint().x.toFixed(2) + "," + element.getPoint().y.toFixed(2); } return ServerConnector.getComments({ - elementId : element.getId(), - elementType : element.getType(), - coordinates : coordinates - }).then(function(comments) { + elementId: element.getId(), + elementType: element.getType(), + coordinates: coordinates + }).then(function (comments) { self._detailDataByIdentifiedElement[elementKey] = comments; return comments; }); } }; -CommentDbOverlay.prototype.getIdentifiedElements = function() { +/** + * TODO this method can be simplified (instead of new Promise, Promise.resolve should be used) + * @returns {Promise} + */ +CommentDbOverlay.prototype.getIdentifiedElements = function () { var self = this; - return new Promise(function(resolve) { + return new Promise(function (resolve) { var result = []; for (var i = 0; i < self._elements.length; i++) { // we return only elements that are pinned to the map and weren't removed diff --git a/frontend-js/src/main/js/map/overlay/DbOverlayCollection.js b/frontend-js/src/main/js/map/overlay/DbOverlayCollection.js index 97eb7f90aa..5086ef0ea6 100644 --- a/frontend-js/src/main/js/map/overlay/DbOverlayCollection.js +++ b/frontend-js/src/main/js/map/overlay/DbOverlayCollection.js @@ -11,6 +11,12 @@ var DrugDbOverlay = require('./DrugDbOverlay'); var MiRnaDbOverlay = require('./MiRnaDbOverlay'); var SearchDbOverlay = require('./SearchDbOverlay'); +/** + * + * @param {CustomMap} params.map + * @constructor + * @extends ObjectWithListeners + */ function DbOverlayCollection(params) { // call super constructor ObjectWithListeners.call(this); diff --git a/frontend-js/src/main/js/map/overlay/DrugDbOverlay.js b/frontend-js/src/main/js/map/overlay/DrugDbOverlay.js index 23582176ed..91466b2d22 100644 --- a/frontend-js/src/main/js/map/overlay/DrugDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/DrugDbOverlay.js @@ -8,6 +8,12 @@ var AbstractTargettingDbOverlay = require('./AbstractTargettingDbOverlay'); var ServerConnector = require('../../ServerConnector'); +/** + * + * @param params + * @constructor + * @extends AbstractTargettingDbOverlay + */ function DrugDbOverlay(params) { params.iconType= "drug"; params.iconColorStart = 5; @@ -18,10 +24,20 @@ function DrugDbOverlay(params) { DrugDbOverlay.prototype = Object.create(AbstractTargettingDbOverlay.prototype); DrugDbOverlay.prototype.constructor = DrugDbOverlay; +/** + * + * @param {IdentifiedElement} param + * @returns {Promise<string[]>} + */ DrugDbOverlay.prototype.getNamesByTargetFromServer = function(param) { return ServerConnector.getDrugNamesByTarget(param); }; +/** + * + * @param {string} param.query + * @returns {Promise<Drug[]>} + */ DrugDbOverlay.prototype.getElementsByQueryFromServer = function(param) { return ServerConnector.getDrugsByQuery(param); }; diff --git a/frontend-js/src/main/js/map/overlay/MiRnaDbOverlay.js b/frontend-js/src/main/js/map/overlay/MiRnaDbOverlay.js index 8526cf7c80..4ffb143102 100644 --- a/frontend-js/src/main/js/map/overlay/MiRnaDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/MiRnaDbOverlay.js @@ -8,6 +8,12 @@ var AbstractTargettingDbOverlay = require('./AbstractTargettingDbOverlay'); var ServerConnector = require('../../ServerConnector'); +/** + * + * @param params + * @constructor + * @extends AbstractTargettingDbOverlay + */ function MiRnaDbOverlay(params) { params.iconType= "target"; params.iconColorStart = 2; @@ -19,10 +25,20 @@ function MiRnaDbOverlay(params) { MiRnaDbOverlay.prototype = Object.create(AbstractTargettingDbOverlay.prototype); MiRnaDbOverlay.prototype.constructor = MiRnaDbOverlay; +/** + * + * @param {IdentifiedElement} param + * @returns {Promise<string[]>} + */ MiRnaDbOverlay.prototype.getNamesByTargetFromServer = function(param) { return ServerConnector.getMiRnaNamesByTarget(param); }; +/** + * + * @param {string} param.query + * @returns {Promise<Drug[]>} + */ MiRnaDbOverlay.prototype.getElementsByQueryFromServer = function(param) { return ServerConnector.getMiRnasByQuery(param); }; diff --git a/frontend-js/src/main/js/map/overlay/SearchDbOverlay.js b/frontend-js/src/main/js/map/overlay/SearchDbOverlay.js index 4720bfcac3..f92ba6c440 100644 --- a/frontend-js/src/main/js/map/overlay/SearchDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/SearchDbOverlay.js @@ -33,6 +33,11 @@ function SearchDbOverlay(params) { SearchDbOverlay.prototype = Object.create(AbstractDbOverlay.prototype); SearchDbOverlay.prototype.constructor = SearchDbOverlay; +/** + * + * @param {string} query + * @returns {Promise} + */ SearchDbOverlay.prototype.getElementsByQuery = function (query) { var self = this; var i; @@ -86,6 +91,14 @@ SearchDbOverlay.prototype.getElementsByQuery = function (query) { }); }; +/** + * + * @param {IdentifiedElement} identifiedElement + * @param {number} zoomLevel + * @param {Point}coordinates + * @returns {Promise} + * @private + */ SearchDbOverlay.prototype._getFirstVisibleParentOrObject = function (identifiedElement, zoomLevel, coordinates) { if (identifiedElement === undefined) { return Promise.resolve(); @@ -125,6 +138,15 @@ SearchDbOverlay.prototype._getFirstVisibleParentOrObject = function (identifiedE } }); }; + +/** + * + * @param {Object} params + * @param {number} params.modelId + * @param {Point} params.coordinates + * @param {number} params.zoom + * @returns {Promise} + */ SearchDbOverlay.prototype.searchByCoordinates = function (params) { var modelId = params.modelId; var coordinates = params.coordinates; @@ -241,6 +263,12 @@ SearchDbOverlay.prototype.searchByCoordinates = function (params) { } }; +/** + * + * @param {string} originalQuery + * @param {boolean} [perfect] + * @returns {Promise} + */ SearchDbOverlay.prototype.searchBySingleQuery = function (originalQuery, perfect) { var self = this; var query = self.encodeQuery(AbstractDbOverlay.QueryType.SEARCH_BY_QUERY, originalQuery, perfect); @@ -289,7 +317,10 @@ SearchDbOverlay.prototype.searchByTarget = function (element) { }); }; - +/** + * + * @returns {Promise} + */ SearchDbOverlay.prototype.getIdentifiedElements = function () { var self = this; var queries = self.getQueries(); diff --git a/frontend-js/src/main/js/map/overlay/UserDbOverlay.js b/frontend-js/src/main/js/map/overlay/UserDbOverlay.js index eac4eea005..12e72ca113 100644 --- a/frontend-js/src/main/js/map/overlay/UserDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/UserDbOverlay.js @@ -11,6 +11,12 @@ var InvalidArgumentError = require('../../InvalidArgumentError'); var Promise = require("bluebird"); +/** + * + * @param params + * @constructor + * @extends AbstractDbOverlay + */ function UserDbOverlay(params) { params.iconType = "marker"; params.iconColorStart = 1; @@ -32,6 +38,11 @@ function UserDbOverlay(params) { UserDbOverlay.prototype = Object.create(AbstractDbOverlay.prototype); UserDbOverlay.prototype.constructor = UserDbOverlay; +/** + * + * @param {IdentifiedElement} element + * @returns {Promise} + */ UserDbOverlay.prototype.getDetailDataByIdentifiedElement = function (element) { if (element.getType() === "POINT") { return Promise.resolve(null); @@ -40,6 +51,14 @@ UserDbOverlay.prototype.getDetailDataByIdentifiedElement = function (element) { return model.getByIdentifiedElement(element, true); }; +/** + * + * @param {PluginElementParam[]} params + * @param {{ALIAS:Array, REACTION:Array, POINT:Array}} sourceArray + * @param {boolean} mustBeUndefined + * @returns {Promise} + * @private + */ UserDbOverlay.prototype._createIdentifiedElements = function (params, sourceArray, mustBeUndefined) { var self = this; var result = []; @@ -81,6 +100,11 @@ UserDbOverlay.prototype._createIdentifiedElements = function (params, sourceArra }); }; +/** + * + * @param {PluginElementParam[]|PluginElementParam} params + * @returns {Promise<any>} + */ UserDbOverlay.prototype.addMarker = function (params) { var self = this; self.disableAddRemoveElements(); @@ -106,6 +130,11 @@ UserDbOverlay.prototype.addMarker = function (params) { }); }; +/** + * + * @param {PluginElementParam[]|PluginElementParam} params + * @returns {Promise<any>} + */ UserDbOverlay.prototype.addSurface = function (params) { var self = this; self.disableAddRemoveElements(); @@ -132,6 +161,11 @@ UserDbOverlay.prototype.addSurface = function (params) { }); }; +/** + * + * @param {PluginElementParam[]|PluginElementParam} params + * @returns {Promise<any>} + */ UserDbOverlay.prototype.removeMarker = function (params) { var self = this; self.disableAddRemoveElements(); @@ -159,6 +193,11 @@ UserDbOverlay.prototype.removeMarker = function (params) { }); }; +/** + * + * @param {PluginElementParam[]|PluginElementParam} params + * @returns {Promise<any>} + */ UserDbOverlay.prototype.removeSurface = function (params) { var self = this; self.disableAddRemoveElements(); @@ -185,6 +224,9 @@ UserDbOverlay.prototype.removeSurface = function (params) { }); }; +/** + * + */ UserDbOverlay.prototype.disableAddRemoveElements = function () { if (this._addRemoveElementsDisabled) { throw new Error("wait until previous Promise for showBioEntity/hideBioEntity is resolved"); @@ -192,6 +234,10 @@ UserDbOverlay.prototype.disableAddRemoveElements = function () { this._addRemoveElementsDisabled = true; } }; + +/** + * + */ UserDbOverlay.prototype.enableAddRemoveElements = function () { if (this._addRemoveElementsDisabled) { this._addRemoveElementsDisabled = false; @@ -200,6 +246,10 @@ UserDbOverlay.prototype.enableAddRemoveElements = function () { } }; +/** + * + * @returns {Promise} + */ UserDbOverlay.prototype.getIdentifiedElements = function () { var result = []; var markerType, key, markers; @@ -232,6 +282,10 @@ UserDbOverlay.prototype.getIdentifiedElements = function () { return Promise.resolve(result); }; +/** + * + * @returns {PromiseLike} + */ UserDbOverlay.prototype.clear = function () { var self = this; self._markerIdentifiedElements = { diff --git a/frontend-js/src/main/js/map/structure/MolArt.js b/frontend-js/src/main/js/map/structure/MolArt.js index e68165aab7..3b9be31754 100644 --- a/frontend-js/src/main/js/map/structure/MolArt.js +++ b/frontend-js/src/main/js/map/structure/MolArt.js @@ -1,7 +1,12 @@ var Functions = require('../../Functions'); var SubMenu = require('../../gui/SubMenu'); - +/** + * + * @param {HTMLElement} containerParentElement + * @param {CustomMap} customMap + * @constructor + */ function MolArt(containerParentElement, customMap) { var molartDiv = Functions.createElement({ @@ -15,18 +20,34 @@ function MolArt(containerParentElement, customMap) { this._customMap = customMap; } +/** + * + * @param {HTMLElement} containerElement + */ MolArt.prototype.setContainerElement = function (containerElement) { this._containerElement = containerElement; }; +/** + * + * @returns {HTMLElement} + */ MolArt.prototype.getContainerElement = function () { return this._containerElement; }; +/** + * + * @param {ContextMenu} menu + */ function removeFromContextMenu(menu) { $(menu.getElement()).find('li:contains("MolArt")').remove(); } +/** + * + * @param {string[]} uniprotIds + */ MolArt.prototype.activateInContextMenu = function (uniprotIds) { var self = this; @@ -47,6 +68,9 @@ MolArt.prototype.activateInContextMenu = function (uniprotIds) { }; +/** + * + */ MolArt.prototype.deactivateInContextMenu = function () { var menu = this._customMap.getContextMenu(); removeFromContextMenu(menu); @@ -54,6 +78,10 @@ MolArt.prototype.deactivateInContextMenu = function () { }, true); }; +/** + * + * @private + */ MolArt.prototype._deactivate = function () { var container = this.getContainerElement(); container.style.display = 'none'; @@ -62,6 +90,11 @@ MolArt.prototype._deactivate = function () { this.molArt = undefined; }; +/** + * + * @param {string} uniprotId + * @private + */ MolArt.prototype._activate = function (uniprotId) { var self = this; diff --git a/frontend-js/src/main/js/map/surface/AliasSurface.js b/frontend-js/src/main/js/map/surface/AliasSurface.js index b80391ef41..48fb6e6117 100644 --- a/frontend-js/src/main/js/map/surface/AliasSurface.js +++ b/frontend-js/src/main/js/map/surface/AliasSurface.js @@ -178,6 +178,11 @@ AliasSurface.prototype.setBoundsForAlias = function (startX, endX) { this.getMapCanvasObjects()[0].setBounds(bounds); }; +/** + * + * @returns {Promise} + * @private + */ AliasSurface.prototype._computeColors = function () { var self = this; var overlayData = self.getOverlayData(); diff --git a/frontend-js/src/main/js/map/window/AliasInfoWindow.js b/frontend-js/src/main/js/map/window/AliasInfoWindow.js index f80f8bfc7e..7284a9b3fc 100644 --- a/frontend-js/src/main/js/map/window/AliasInfoWindow.js +++ b/frontend-js/src/main/js/map/window/AliasInfoWindow.js @@ -530,6 +530,9 @@ AliasInfoWindow.prototype.getAlias = function () { return this.alias; }; +/** + * + */ AliasInfoWindow.prototype.destroy = function () { if (this.pileup !== undefined) { this.pileup.destroy(); diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js index 1127f3d3f6..3d524d5e6d 100644 --- a/frontend-js/src/main/js/minerva.js +++ b/frontend-js/src/main/js/minerva.js @@ -32,6 +32,10 @@ var logger = require('./logger'); var customMap, leftPanel, topMenu, legend, mapContextMenu, selectionContextMenu; +/** + * + * @param {CustomMapOptions} params + */ function processUrlGetParams(params) { var project = params.getProject(); var sessionData = ServerConnector.getSessionData(project); @@ -122,6 +126,10 @@ function requestConsent(user, termsOfUseUrl) { $(dialog).dialog("open"); } +/** + * + * @returns {Promise} + */ function insertGoogleAnalyticsCode() { return ServerConnector.getConfigurationParam(ConfigurationType.GOOGLE_ANALYTICS_IDENTIFIER).then(function (identifier) { if (identifier === "" || identifier === undefined || identifier === null) { @@ -145,6 +153,10 @@ function insertGoogleAnalyticsCode() { }); } +/** + * + * @param {HTMLElement} element + */ function createDivStructure(element) { var tableDiv = functions.createElement({ type: "div", @@ -211,7 +223,10 @@ function createDivStructure(element) { element.appendChild(selectionContextMenu); } - +/** + * + * @param {CustomMapOptions} params + */ function initGlobals(params) { if (global.ServerConnector === undefined) { global.ServerConnector = ServerConnector; @@ -230,6 +245,9 @@ function initGlobals(params) { } +/** + * + */ function verifyBrowser() { var browser = functions.browser; @@ -247,6 +265,11 @@ function verifyBrowser() { } } +/** + * + * @param {CustomMapOptions} params + * @returns {Promise<Project>} + */ function getProject(params) { if (params.getProject() !== undefined) { return Promise.resolve(params.getProject()); @@ -255,6 +278,11 @@ function getProject(params) { } } +/** + * + * @param params + * @returns {*} + */ function modifyParamsForTouchTable(params) { if (params.bigLogo === undefined) { // noinspection UnnecessaryLocalVariableJS @@ -264,6 +292,11 @@ function modifyParamsForTouchTable(params) { return params; } +/** + * + * @param {CustomMap} customMap + * @param {PluginManager} pluginManager + */ function assignSplitBarHandler(customMap, pluginManager) { var splitBar = $('.minerva-plugin-split-bar'); var rightPanelDiv = $('.minerva-plugin'); @@ -284,6 +317,11 @@ function assignSplitBarHandler(customMap, pluginManager) { }); } +/** + * + * @param {CustomMapOptions|*} params + * @returns {Promise} + */ function create(params) { params = modifyParamsForTouchTable(params); if (!(params instanceof CustomMapOptions)) { @@ -440,6 +478,10 @@ function create(params) { } +/** + * + * @returns {Promise} + */ function createFooter() { var logoLink, logoText, logoImg; return ServerConnector.getConfigurationParam(ConfigurationType.LOGO_LINK).then(function (result) { @@ -472,6 +514,10 @@ function createFooter() { }) } +/** + * + * @returns {HTMLElement} + */ function createLoginDiv() { var loggedIn = false; @@ -568,7 +614,11 @@ function createLoginDiv() { return result; } - +/** + * + * @param {CustomMapOptions|*} params + * @returns {Promise} + */ function createLogin(params) { params = modifyParamsForTouchTable(params); if (!(params instanceof CustomMapOptions)) { @@ -588,6 +638,11 @@ function createLogin(params) { }) } +/** + * + * @param {CustomMapOptions|*} params + * @returns {Promise} + */ function createExport(params) { params = modifyParamsForTouchTable(params); if (!(params instanceof CustomMapOptions)) { @@ -612,6 +667,11 @@ function createExport(params) { }); } +/** + * + * @param {CustomMapOptions|*} params + * @returns {Promise} + */ function createAdmin(params) { params = modifyParamsForTouchTable(params); if (!(params instanceof CustomMapOptions)) { diff --git a/frontend-js/src/main/js/plugin/MinervaPluginProxy.js b/frontend-js/src/main/js/plugin/MinervaPluginProxy.js index 4116d900b1..594cd2fb94 100644 --- a/frontend-js/src/main/js/plugin/MinervaPluginProxy.js +++ b/frontend-js/src/main/js/plugin/MinervaPluginProxy.js @@ -12,6 +12,24 @@ var logger = require('../logger'); var Promise = require("bluebird"); +/** + * @typedef {Object} PluginElementParam + * @property {IdentifiedElement} element + * @property {string} [icon] + * @property {Object} [options] + * @property {string} options.color + * @property {number} options.opacity + * @property {string} options.lineColor + * @property {number} options.lineWeight + * @property {number} options.lineOpacity + */ + +/** + * + * @param {CustomMap} customMap + * @param {string} dbOverlayName + * @returns {AbstractDbOverlay} + */ function getOverlayByName(customMap, dbOverlayName) { var dbOverlay = customMap.getOverlayByName(dbOverlayName); if (dbOverlay === null) { @@ -28,6 +46,12 @@ function getOverlayByName(customMap, dbOverlayName) { } } +/** + * + * @param {CustomMap} customMap + * @param {IdentifiedElement[]} identifiedElements + * @returns {Promise} + */ function getFullElements(customMap, identifiedElements) { var result = []; return Promise.each( @@ -48,6 +72,12 @@ function getFullElements(customMap, identifiedElements) { }); } +/** + * + * @param {IdentifiedElement[]} elementIdentifiers + * @param {CustomMap} customMap + * @returns {Promise} + */ function getElements(elementIdentifiers, customMap) { var identifiedElements = []; @@ -83,6 +113,12 @@ function getElements(elementIdentifiers, customMap) { } +/** + * + * @param {Object} options + * @param {CustomMap} options.map + * @returns {{getBioEntityById: function(*=): Promise<any>, getAllBioEntities: function(): *, getReactionsWithElement: function(*=): *, getProjectId: function(): string, getName: function(): string, getVersion: function(): string, getDisease: getDisease, getOrganism: getOrganism, getModels: function(): *[]}} + */ function createProjectData(options) { var map = options.map; return { @@ -173,6 +209,12 @@ function createProjectData(options) { }; } +/** + * + * @param {IdentifiedElement[]} elementIdentifiers + * @param {CustomMap} customMap + * @returns {Promise} + */ function getReactionsForElements(elementIdentifiers, customMap) { var elementsByModelId = []; for (var i = 0; i < elementIdentifiers.length; i++) { @@ -202,7 +244,14 @@ function getReactionsForElements(elementIdentifiers, customMap) { }); } - +/** + * + * @param {Object} options + * @param {Object} options.params + * @param {string} [options.filteredType] + * @param {boolean} [options.isDefault] + * @returns {Array} + */ function createMarkerElements(options) { var params = options.params; var filteredType = options.filteredType; @@ -230,6 +279,14 @@ function createMarkerElements(options) { return markerElements; } +/** + * + * @param {Object} options + * @param {CustomMap} options.map + * @param {Plugin} options.plugin + * @param {string} options.pluginId + * @returns {{getVisibleDataOverlays: function(): (Promise<DataOverlay[]>|*), addListener: addListener, removeListener: removeListener, removeAllListeners: function(): Array, getHighlightedBioEntities: function(*=): *, showBioEntity: function(*=): *, hideBioEntity: function(*=): Promise<T>, setCenter: function(*): PromiseLike, getCenter: function(*): Point, getBounds: function(*): Bounds, fitBounds: function(*): void, setZoom: function(*): *, getZoom: function(*): number, openMap: function(*): PromiseLike}} + */ function createProjectMap(options) { var map = options.map; var pluginId = options.pluginId; @@ -445,6 +502,14 @@ function createProjectMap(options) { } } +/** + * + * @param {Object} options + * @param {CustomMap} options.map + * @param {Plugin} options.plugin + * @param {string} options.pluginId + * @returns {{data: {getBioEntityById: function(*=): Promise<any>, getAllBioEntities: function(): *, getReactionsWithElement: function(*=): *, getProjectId: function(): string, getName: function(): string, getVersion: function(): string, getDisease: getDisease, getOrganism: getOrganism, getModels: function(): *[]}, map: {getVisibleDataOverlays: function(): (Promise<DataOverlay[]>|*), addListener: addListener, removeListener: removeListener, removeAllListeners: function(): Array, getHighlightedBioEntities: function(*=): *, showBioEntity: function(*=): *, hideBioEntity: function(*=): Promise<T>, setCenter: function(*): PromiseLike, getCenter: function(*): Point, getBounds: function(*): Bounds, fitBounds: function(*): void, setZoom: function(*): *, getZoom: function(*): number, openMap: function(*): PromiseLike}}} + */ function createProject(options) { return { data: createProjectData(options), @@ -452,6 +517,12 @@ function createProject(options) { }; } +/** + * + * @param {Object} options + * @param {Configuration} options.configuration + * @returns {{options: ConfigurationOption[], overlayTypes: string[], imageConverters: *, modelConverters: *, elementTypes: *, reactionTypes: *, miriamTypes: MiriamType, mapTypes: *, modificationStateTypes: *, privilegeTypes: PrivilegeType[], annotators: *}} + */ function createConfiguration(options) { var configuration = new Configuration(options.configuration); return { @@ -469,6 +540,12 @@ function createConfiguration(options) { }; } +/** + * + * @param {Object} options + * @param {string} options.hash + * @returns {{setGlobalParam: function(*=, *=): *, getGlobalParam: function(*=): *, setUserParam: function(*=, *=): *, getUserParam: function(*=): *}} + */ function createPluginData(options) { return { setGlobalParam: function (key, value) { @@ -486,7 +563,18 @@ function createPluginData(options) { }; } - +/** + * + * @param {Object} options + * @param {CustomMap} options.map + * @param {Plugin} options.plugin + * @param {string} options.pluginId + * @param {string} options.hash + * @param {HTMLElement} options.element + * @param {Configuration} options.configuration + * @returns {{pluginId: string|string, element: *, project: {data: {getBioEntityById: function(*=): Promise<any>, getAllBioEntities: function(): *, getReactionsWithElement: function(*=): *, getProjectId: function(): string, getName: function(): string, getVersion: function(): string, getDisease: getDisease, getOrganism: getOrganism, getModels: function(): *[]}, map: {getVisibleDataOverlays: function(): (Promise<DataOverlay[]>|*), addListener: addListener, removeListener: removeListener, removeAllListeners: function(): Array, getHighlightedBioEntities: function(*=): *, showBioEntity: function(*=): *, hideBioEntity: function(*=): Promise<T>, setCenter: function(*): PromiseLike, getCenter: function(*): Point, getBounds: function(*): Bounds, fitBounds: function(*): void, setZoom: function(*): *, getZoom: function(*): number, openMap: function(*): PromiseLike}}, configuration: {options: ConfigurationOption[], overlayTypes: string[], imageConverters: *, modelConverters: *, elementTypes: *, reactionTypes: *, miriamTypes: MiriamType, mapTypes: *, modificationStateTypes: *, privilegeTypes: PrivilegeType[], annotators: *}, pluginData: {setGlobalParam: function(*=, *=): *, getGlobalParam: function(*=): *, setUserParam: function(*=, *=): *, getUserParam: function(*=): *}}} + * @constructor + */ function MinervaPluginProxy(options) { return { pluginId: options.pluginId, diff --git a/frontend-js/src/main/js/plugin/Plugin.js b/frontend-js/src/main/js/plugin/Plugin.js index 215a4a3cab..153e3e2d5c 100644 --- a/frontend-js/src/main/js/plugin/Plugin.js +++ b/frontend-js/src/main/js/plugin/Plugin.js @@ -34,31 +34,66 @@ function Plugin(options) { Plugin.prototype = Object.create(ObjectWithListeners.prototype); Plugin.prototype.constructor = ObjectWithListeners; +/** + * + * @param {PluginOptions} options + */ Plugin.prototype.setOptions = function (options) { this._options = options; }; +/** + * + * @returns {PluginOptions} + */ Plugin.prototype.getOptions = function () { return this._options; }; +/** + * + * @param loadedPluginData + */ Plugin.prototype.setLoadedPluginData = function (loadedPluginData) { this._loadedPluginData = loadedPluginData; }; + +/** + * + * @returns {*} + */ Plugin.prototype.getLoadedPluginData = function () { return this._loadedPluginData; }; +/** + * + * @param minervaPluginProxy + */ Plugin.prototype.setMinervaPluginProxy = function (minervaPluginProxy) { this._minervaPluginProxy = minervaPluginProxy; }; + +/** + * + * @returns {*} + */ Plugin.prototype.getMinervaPluginProxy = function () { return this._minervaPluginProxy; }; + +/** + * + * @returns {string} + */ Plugin.prototype.getPluginId = function () { return this.getMinervaPluginProxy().pluginId; }; +/** + * + * @returns {Promise} + */ Plugin.prototype.load = function () { var self = this; var options = self.getOptions(); @@ -121,6 +156,10 @@ Plugin.prototype.load = function () { }; +/** + * + * @returns {number} + */ Plugin.prototype.getMinWidth = function () { var value; var data = this.getLoadedPluginData(); @@ -134,6 +173,10 @@ Plugin.prototype.getMinWidth = function () { return value; }; +/** + * + * @returns {Promise} + */ Plugin.prototype.unload = function () { var self = this; return Promise.resolve().then(function () { @@ -149,6 +192,10 @@ Plugin.prototype.unload = function () { }); }; +/** + * + * @returns {string} + */ Plugin.prototype.getName = function () { if (this.getLoadedPluginData() === undefined) { return ""; @@ -156,6 +203,10 @@ Plugin.prototype.getName = function () { return this.getLoadedPluginData().getName(); }; +/** + * + * @returns {string} + */ Plugin.prototype.getVersion = function () { if (this.getLoadedPluginData() === undefined) { return ""; @@ -163,10 +214,18 @@ Plugin.prototype.getVersion = function () { return this.getLoadedPluginData().getVersion(); }; +/** + * + * @returns {Promise} + */ Plugin.prototype.destroy = function () { return Promise.resolve(); }; +/** + * + * @param {string} hash + */ Plugin.prototype.setHash = function (hash) { this.getMinervaPluginProxy().hash = hash; }; diff --git a/frontend-js/src/main/js/plugin/PluginManager.js b/frontend-js/src/main/js/plugin/PluginManager.js index fad5ab69e5..de602f3259 100644 --- a/frontend-js/src/main/js/plugin/PluginManager.js +++ b/frontend-js/src/main/js/plugin/PluginManager.js @@ -128,6 +128,10 @@ PluginManager.prototype.isValidUrl = function (url) { return isUrl(url); }; +/** + * + * @returns {Promise} + */ PluginManager.prototype.adjustMinWidth = function () { var self = this; var oldVal = self.getElement().style.minWidth; @@ -149,6 +153,11 @@ PluginManager.prototype.adjustMinWidth = function () { } }; +/** + * + * @param {Plugin} plugin + * @returns {Promise} + */ PluginManager.prototype.removePlugin = function (plugin) { var self = this; var found = false; @@ -167,6 +176,10 @@ PluginManager.prototype.removePlugin = function (plugin) { }); }; +/** + * + * @returns {Promise} + */ PluginManager.prototype.destroy = function () { var self = this; var promises = []; -- GitLab