From 6007037f5ba4fbadb4b420773085898b86043ad7 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Wed, 17 May 2017 16:08:14 +0200 Subject: [PATCH] all info windows create content div as a promise --- .../src/main/js/map/window/AbstractInfoWindow.js | 9 +++------ frontend-js/src/main/js/map/window/PointInfoWindow.js | 2 +- .../src/main/js/map/window/ReactionInfoWindow.js | 11 +---------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/frontend-js/src/main/js/map/window/AbstractInfoWindow.js b/frontend-js/src/main/js/map/window/AbstractInfoWindow.js index 6ef7454955..6545dbc42d 100644 --- a/frontend-js/src/main/js/map/window/AbstractInfoWindow.js +++ b/frontend-js/src/main/js/map/window/AbstractInfoWindow.js @@ -34,7 +34,7 @@ function AbstractInfoWindow(abstractMarker, map) { var onOverlayFullViewChanged = function(e) { var self = e.object; // first change the content of the element - self.update().then(function(){ + self.update().then(function() { if (e.newVal) { var element = new IdentifiedElement({ objectId : self.getElementId(), @@ -353,12 +353,9 @@ AbstractInfoWindow.prototype._updateContent = function() { var contentDiv = null; var self = this; - return new Promise(function(resolve, reject) { - self.setContent(self.createWaitingContentDiv()); + self.setContent(self.createWaitingContentDiv()); - var x = self.createContentDiv(); - resolve(x); - }).then(function(content) { + return self.createContentDiv().then(function(content) { contentDiv = content; return self.createOverlaysDiv(); }).then(function(overlaysDiv) { diff --git a/frontend-js/src/main/js/map/window/PointInfoWindow.js b/frontend-js/src/main/js/map/window/PointInfoWindow.js index bc1edd44dc..033c91d553 100644 --- a/frontend-js/src/main/js/map/window/PointInfoWindow.js +++ b/frontend-js/src/main/js/map/window/PointInfoWindow.js @@ -32,7 +32,7 @@ PointInfoWindow.prototype.createContentDiv = function() { title.innerHTML = "Point: " + this.pointData.getPoint(); result.appendChild(title); - return result; + return Promise.resolve(result); }; PointInfoWindow.prototype.getOverlaysData = function(general) { diff --git a/frontend-js/src/main/js/map/window/ReactionInfoWindow.js b/frontend-js/src/main/js/map/window/ReactionInfoWindow.js index d584384c10..13fb9e5e0a 100644 --- a/frontend-js/src/main/js/map/window/ReactionInfoWindow.js +++ b/frontend-js/src/main/js/map/window/ReactionInfoWindow.js @@ -41,16 +41,7 @@ ReactionInfoWindow.prototype.constructor = ReactionInfoWindow; * @returns {String} representing html code for content of the info window */ ReactionInfoWindow.prototype.createContentDiv = function() { - if (this._reactionData !== undefined) { - var content = document.createElement("div"); - /* - * var title = document.createElement("h3"); title.innerHTML = - * "ReactionInfoWindow is not yet implemented."; content.appendChild(title) - */ - return content; - } else { - return null; - } + return Promise.resolve(document.createElement("div")); }; /** -- GitLab