Commit 06e58dc3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

alias window has overlay databases in tabs

parent d892a301
......@@ -922,7 +922,7 @@ CustomMap.prototype.getOverlayDataForIdentifiedElement = function (identifiedEle
generalFlag = false;
}
overlays.push(overlay);
promises.push(overlay.getDetailDataByIdentifiedElement(identifiedElement, overlay.allowSearchById()
promises.push(overlay.getDetailDataByIdentifiedElement(identifiedElement, !overlay.allowSearchById()
|| generalFlag));
}
......
......@@ -11,6 +11,7 @@ var GuiUtils = require('../../gui/leftPanel/GuiUtils');
var IdentifiedElement = require('../data/IdentifiedElement');
var ObjectWithListeners = require('../../ObjectWithListeners');
var TargettingStructure = require('../data/TargettingStructure');
var OverlayTabs = require("./OverlayTabs");
/**
* Class representing any info window in our map.
......@@ -177,7 +178,7 @@ AbstractInfoWindow.prototype.createOverlayInfoDiv = function (overlay, data) {
if (alias.getType().toUpperCase() === "RNA" ||
alias.getType().toUpperCase() === "PROTEIN" ||
alias.getType().toUpperCase() === "GENE") {
return this._createDrugInfoDiv(overlay, data);
return this._createTargetInfoDiv({overlay:overlay, data:data, name:""});
} else {
return null;
}
......@@ -185,7 +186,7 @@ AbstractInfoWindow.prototype.createOverlayInfoDiv = function (overlay, data) {
if (alias.getType().toUpperCase() === "RNA" ||
alias.getType().toUpperCase() === "PROTEIN" ||
alias.getType().toUpperCase() === "GENE") {
return this._createChemicalInfoDiv(overlay, data);
return this._createTargetInfoDiv({overlay:overlay, data:data, name:""});
} else {
return null;
}
......@@ -193,7 +194,7 @@ AbstractInfoWindow.prototype.createOverlayInfoDiv = function (overlay, data) {
if (alias.getType().toUpperCase() === "RNA" ||
alias.getType().toUpperCase() === "PROTEIN" ||
alias.getType().toUpperCase() === "GENE") {
return this._createMiRnaInfoDiv(overlay, data);
return this._createTargetInfoDiv({overlay:overlay, data:data, name:""});
} else {
return null;
}
......@@ -218,23 +219,6 @@ AbstractInfoWindow.prototype.createOverlayInfoDiv = function (overlay, data) {
}
};
/**
* Creates and returns div for drug overlay information.
*
* @param {AbstractDbOverlay} overlay
* @param {Drug[]} data
* data taken from drug overlay
* @returns {HTMLElement} div for drug overlay information
* @private
*/
AbstractInfoWindow.prototype._createDrugInfoDiv = function (overlay, data) {
return this._createTargetInfoDiv({
overlay: overlay,
data: data,
name: "Interacting drugs"
});
};
/**
* Creates and returns div for comment overlay information.
*
......@@ -411,13 +395,24 @@ AbstractInfoWindow.prototype._updateContent = function () {
AbstractInfoWindow.prototype.createDbOverlaysDiv = function () {
var self = this;
var result = document.createElement("div");
var overlayTabs = null;
return this.getDbOverlaysData(self.getOverlayFullViewArray()).then(function (overlayData) {
for (var i = 0; i < overlayData.length; i++) {
var overlay = overlayData[i].overlay;
var data = overlayData[i].data;
var overlayInfo = self.createOverlayInfoDiv(overlay, data);
if (overlayInfo !== null) {
result.appendChild(overlayInfo);
if (overlay.name === "drug" || overlay.name === "chemical" || overlay.name === "mirna") {
if (overlayTabs == null) {
var div = document.createElement("div")
result.appendChild(div);
overlayTabs = new OverlayTabs({element: div, project: self.getCustomMap().getProject()});
self.getGuiUtils().initTabContent(overlayTabs);
}
self.getGuiUtils().addTab(overlayTabs, {name: overlay.name, content: overlayInfo});
} else {
result.appendChild(overlayInfo);
}
}
}
return result;
......@@ -468,20 +463,18 @@ AbstractInfoWindow.prototype._createTargetInfoDiv = function (params) {
result.appendChild(titleElement);
if (overlay.allowGeneralSearch()) {
var checkboxDiv = document.createElement("div");
checkboxDiv.style.float = "right";
var checkbox = document.createElement("input");
checkbox.id = "checkbox-" + name + "-" + this.getElementType() + "-" + this.getElementId();
checkbox.type = "checkbox";
checkbox.checked = self.isOverlayFullView(overlay.getName());
checkbox.onclick = function () {
return self.setOverlayFullView(overlay.getName(), this.checked).then(null, GuiConnector.alert);
return self.setOverlayFullView(overlay.getName(), this.checked).catch(GuiConnector.alert);
};
checkboxDiv.appendChild(checkbox);
var description = document.createElement("div");
description.style.float = "right";
description.style.display = "inline-block";
description.innerHTML = "Show all";
checkboxDiv.appendChild(description);
result.appendChild(checkboxDiv);
......@@ -662,39 +655,6 @@ AbstractInfoWindow.prototype.getGuiUtils = function () {
return this._guiUtils;
};
/**
* Creates and returns DOM div for chemical overlay information.
*
* @param {AbstractDbOverlay} overlay
* @param {Chemical[]} data
* data taken from chemical overlay
* @returns {HTMLElement} element with a div for comment overlay information
* @private
*/
AbstractInfoWindow.prototype._createChemicalInfoDiv = function (overlay, data) {
return this._createTargetInfoDiv({
overlay: overlay,
data: data,
name: "Interacting chemicals"
});
};
/**
* Creates and returns DOM div for mi rna overlay information.
*
* @param {AbstractDbOverlay} overlay
* @param {MiRna[]} data
* data taken from mi rna overlay
* @returns {HTMLElement} DOM element with a div for comment overlay information
*/
AbstractInfoWindow.prototype._createMiRnaInfoDiv = function (overlay, data) {
return this._createTargetInfoDiv({
overlay: overlay,
data: data,
name: "Interacting Micro RNAs"
});
};
/**
*
* @param {IdentifiedElement} identifiedElement
......
"use strict";
var AbstractGuiElement = require('../../gui/AbstractGuiElement');
var xss = require('xss');
/**
*
* @param {Object} params
* @param {HTMLElement} params.element
* @param {CustomMap} [params.customMap]
* @param {Project} [params.project]
* @param {ServerConnector} [params.serverConnector]
*
* @constructor
* @extends AbstractGuiElement
*/
function OverlayTabs(params) {
AbstractGuiElement.call(this, params);
}
OverlayTabs.prototype = Object.create(AbstractGuiElement.prototype);
OverlayTabs.prototype.constructor = OverlayTabs;
module.exports = OverlayTabs;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment