diff --git a/frontend-js/src/main/js/gui/leftPanel/Panel.js b/frontend-js/src/main/js/gui/leftPanel/Panel.js index 7b5d45d2f67cd2fd90c2df5d9e961437b2f744b0..71c51b32961ba47743b1016b1ada0476e51cc490 100644 --- a/frontend-js/src/main/js/gui/leftPanel/Panel.js +++ b/frontend-js/src/main/js/gui/leftPanel/Panel.js @@ -26,29 +26,8 @@ function Panel(params) { $(self.getElement()).css("position", "relative"); if (params.helpTip !== undefined) { - var helpTipButton = Functions.createElement({ - type : "button", - style : "position: absolute; top:5px; right: 5px;width:18px", - content : '<span class="ui-icon ui-icon-help" style="margin-left: -0.5em;"/>', - }); - helpTipButton.onclick = function() { - var helpDialogDiv = Functions.createElement({ - type : "div", - content : params.helpTip, - }); - $(helpDialogDiv).dialog({ - close : function(event, ui) { - $(this).dialog('destroy').remove(); - }, - position : { - my : "left top", - at : "left bottom", - of : helpTipButton - }, - }); - $('.ui-dialog').find("a").blur(); - }; - self.getElement().appendChild(helpTipButton); + self.createHelpButton(); + self.setHelpTip(params.helpTip); } GuiConnector.addWindowResizeEvent(function() { @@ -63,6 +42,33 @@ function Panel(params) { Panel.prototype = Object.create(AbstractGuiElement.prototype); Panel.prototype.constructor = Panel; +Panel.prototype.createHelpButton = function() { + var self = this; + var helpTipButton = Functions.createElement({ + type : "button", + style : "position: absolute; top:5px; right: 5px;width:18px", + content : '<span class="ui-icon ui-icon-help" style="margin-left: -0.5em;"/>', + }); + helpTipButton.onclick = function() { + var helpDialogDiv = Functions.createElement({ + type : "div", + content : self.getHelpTip(), + }); + $(helpDialogDiv).dialog({ + close : function(event, ui) { + $(this).dialog('destroy').remove(); + }, + position : { + my : "left top", + at : "left bottom", + of : helpTipButton + }, + }); + $('.ui-dialog').find("a").blur(); + }; + self.getElement().appendChild(helpTipButton); +}; + Panel.prototype.disablePanel = function(message) { var self = this; @@ -447,6 +453,14 @@ Panel.prototype.getParent = function() { return this._parent; }; +Panel.prototype.setHelpTip = function(helpTip) { + this._helpTip = helpTip; +}; + +Panel.prototype.getHelpTip = function() { + return this._helpTip; +}; + Panel.prototype.onresize = function() { var self = this; var footerPosition = window.innerHeight;