Commit 536bbc80 authored by David Hoksza's avatar David Hoksza
Browse files

Protestant -> MolStar

parent dd9bc16f
Pipeline #4319 failed with stage
in 43 seconds
......@@ -36,7 +36,7 @@
"log4js-memory-appender": "1.0.5",
"mkdirp": "^0.5.1",
"mocha": "^3.5.3",
"protestant": "git://github.com/davidhoksza/protestant.git",
"MolStar": "git://github.com/davidhoksza/MolStar.git",
"uglifyjs": "^2.4.10"
},
"dependencies": {
......
......@@ -640,7 +640,7 @@ table.dataTable tbody td.no_padding, table.dataTable thead th.no_padding {
color: darkgrey;
}
.minerva-protestant-container {
.minerva-molstar-container {
position: absolute;
left:0;
top: 0;
......@@ -655,7 +655,7 @@ table.dataTable tbody td.no_padding, table.dataTable thead th.no_padding {
display: none;
}
.minerva-protestant-close-button {
.minerva-molstar-close-button {
position: absolute;
left: 3px;
top: 3px;
......@@ -670,7 +670,7 @@ table.dataTable tbody td.no_padding, table.dataTable thead th.no_padding {
z-index: 101
}
.minerva-protestant-close-button:hover{
.minerva-molstar-close-button:hover{
background:rgba(0, 0, 0, 0.4);
}
......
......@@ -11,7 +11,7 @@ function MapContextMenu(params) {
var self = this;
self._createMapContextMenuGui();
self.setProtestant(params.protestant);
self.setMolStar(params.molStar);
}
MapContextMenu.prototype = Object.create(ContextMenu.prototype);
......@@ -38,12 +38,12 @@ MapContextMenu.prototype.init = function() {
});
};
MapContextMenu.prototype.setProtestant = function(protestant){
this._protestant = protestant;
MapContextMenu.prototype.setMolStar = function(molStar){
this._molStar = molStar;
}
MapContextMenu.prototype.getProtestant = function(){
return this._protestant;
MapContextMenu.prototype.getMolStar = function(){
return this._molStar;
}
module.exports = MapContextMenu;
......@@ -377,7 +377,7 @@ AbstractCustomMap.prototype.registerMapClickEvents = function () {
customMap.setActiveSubmapId(self.getId());
var coordinates = self.fromLatLngToPoint(mouseEvent.latLng)
customMap.setActiveSubmapClickCoordinates(coordinates);
activateProtestantLink(coordinates, self);
activateMolStarLink(coordinates, self);
});
// prepare for image export
......@@ -413,7 +413,7 @@ AbstractCustomMap.prototype.registerMapClickEvents = function () {
});
};
function activateProtestantLink(coordinates, map){
function activateMolStarLink(coordinates, map){
ServerConnector.getClosestElementsByCoordinates({
modelId: map.getId(),
......@@ -440,10 +440,10 @@ function activateProtestantLink(coordinates, map){
uniprotIds.push(ref.getResource());
}
}
if (uniprotIds.length > 0) map.getContextMenu().getProtestant().activateInContextMenu(uniprotIds);
else map.getContextMenu().getProtestant().deactivateInContextMenu();
if (uniprotIds.length > 0) map.getContextMenu().getMolStar().activateInContextMenu(uniprotIds);
else map.getContextMenu().getMolStar().deactivateInContextMenu();
}, function(){
map.getContextMenu().getProtestant().deactivateInContextMenu();
map.getContextMenu().getMolStar().deactivateInContextMenu();
});
}
......
var Functions = require('../../Functions');
var SubMenu = require('../../gui/SubMenu');
var ProtestantPlugin = require('protestant');
var MolStarPlugin = require('MolStar');
function Protestant(containerParentElement, customMap) {
function MolStar(containerParentElement, customMap) {
var protestantDiv = Functions.createElement({
var molstarDiv = Functions.createElement({
type: "div",
id: "minervaProtestantContainer",
className: "minerva-protestant-container"
id: "minervaMolStarContainer",
className: "minerva-molstar-container"
});
containerParentElement.appendChild(protestantDiv);
containerParentElement.appendChild(molstarDiv);
this.setContainerElement(protestantDiv);
this.setContainerElement(molstarDiv);
this._customMap = customMap;
}
Protestant.prototype.setContainerElement = function (containerElement) {
MolStar.prototype.setContainerElement = function (containerElement) {
this._containerElement = containerElement;
};
Protestant.prototype.getContainerElement = function () {
MolStar.prototype.getContainerElement = function () {
return this._containerElement;
};
function removeFromContextMenu(menu){
$(menu.getElement()).find('li:contains("PROTESTANT")').remove();
$(menu.getElement()).find('li:contains("MolStar")').remove();
}
Protestant.prototype.activateInContextMenu = function(uniprotIds) {
MolStar.prototype.activateInContextMenu = function(uniprotIds) {
var self = this;
var menu = this._customMap.getContextMenu();
......@@ -36,7 +36,7 @@ Protestant.prototype.activateInContextMenu = function(uniprotIds) {
var submenu = new SubMenu({
element: Functions.createElement({type: "li"}),
name: "Open PROTESTANT",
name: "Open MolStar",
customMap: self._customMap
});
for (var i=0; i < uniprotIds.length; i++) {
......@@ -49,39 +49,39 @@ Protestant.prototype.activateInContextMenu = function(uniprotIds) {
};
Protestant.prototype.deactivateInContextMenu = function() {
MolStar.prototype.deactivateInContextMenu = function() {
var menu = this._customMap.getContextMenu();
removeFromContextMenu(menu);
menu.addOption("Open PROTESTANT (no UniProt ID available)", function(){}, true);
menu.addOption("Open MolStar (no UniProt ID available)", function(){}, true);
};
Protestant.prototype._deactivate = function () {
MolStar.prototype._deactivate = function () {
var container = this.getContainerElement();
container.style.display = 'none';
$(container).empty();
this.protestant.destroy();
this.protestant = undefined;
this.molStar.destroy();
this.molStar = undefined;
};
Protestant.prototype._activate = function (uniprotId) {
MolStar.prototype._activate = function (uniprotId) {
var self = this;
var container = this.getContainerElement();
if (!container) return;
var protestantCloseButton = Functions.createElement({
var molStarCloseButton = Functions.createElement({
type: "div",
className: "minerva-protestant-close-button",
className: "minerva-molstar-close-button",
content: 'x'
});
protestantCloseButton.addEventListener('click', function(){
molStarCloseButton.addEventListener('click', function(){
self._deactivate();
return false;
});
container.appendChild(protestantCloseButton);
container.appendChild(molStarCloseButton);
this.protestant = new ProtestantPlugin({
this.molStar = new MolStarPlugin({
uniprotId: uniprotId,
containerId: container.id
});
......@@ -89,4 +89,4 @@ Protestant.prototype._activate = function (uniprotId) {
};
module.exports = Protestant;
module.exports = MolStar;
......@@ -22,7 +22,7 @@ var SelectionContextMenu = require('./gui/SelectionContextMenu');
var GuiConnector = require('./GuiConnector');
var OriginalServerConnector = require('./ServerConnector');
var Protestant = require('./map/structure/Protestant');
var MolStar = require('./map/structure/MolStar');
var Promise = require("bluebird");
......@@ -302,7 +302,7 @@ function create(params) {
mapContextMenu = new MapContextMenu({
element: functions.getElementByName(element, "contextMenu"),
customMap: customMap,
protestant: new Protestant(element, customMap)
molStar: new MolStar(element, customMap)
});
customMap.setContextMenu(mapContextMenu);
......
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