From 6a786a46e04a6e4adf0c904c5708e7b29b7ef425 Mon Sep 17 00:00:00 2001 From: Ezequiel Bergamaschi Date: Sat, 12 Apr 2014 16:24:15 -0300 Subject: [PATCH] KeyboardShortcutTooltip reimplemented --- .../widget/KeyboardShortcutTooltip.js | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/mindplot/src/main/javascript/widget/KeyboardShortcutTooltip.js b/mindplot/src/main/javascript/widget/KeyboardShortcutTooltip.js index 02b2069c..4852cb70 100644 --- a/mindplot/src/main/javascript/widget/KeyboardShortcutTooltip.js +++ b/mindplot/src/main/javascript/widget/KeyboardShortcutTooltip.js @@ -24,49 +24,49 @@ mindplot.widget.KeyboardShortcutTooltip = new Class({ $assert(text, "text can not be null"); this._text = text; - console.error("mindplot.widget.KeyboardShortcutTooltip must be implemented ..."); -// var children = buttonElem.children(); -// var tipElemId = buttonElem.id + "Tip"; -// var tipDiv = new Element('div', {id:tipElemId}); -// children[0].inject(tipDiv); -// tipDiv.inject(buttonElem); -// -// this.parent(tipDiv, { -// // Content can also be a function of the target element! -// content: this._buildContent.pass(buttonElem, this), -// html: true, -// position: 'bottom', -// arrowOffset : 10, -// center: true, -// arrowSize: 3, -// offset : {x:0,y:-2}, -// className: 'keyboardShortcutTip', -// preventHideOnOver : false, -// motionOnShow:false, -// motionOnHide:false, -// fx: { 'duration': '100' } -// }); -// -// tipDiv.addEvent('click', function(e) { -// tipDiv.fireEvent('mouseleave', e); -// }); + var children = buttonElem.children().first(); + var tipElemId = buttonElem.id + "Tip"; + var tipDiv = $('
').attr('id', tipElemId); + tipDiv.append(children); + buttonElem.append(tipDiv); + + this.parent(tipDiv, { + //Content can also be a function of the target element! + content: this._buildContent.pass(buttonElem, this), + html: true, + position: 'bottom', + arrowOffset : 10, + center: true, + arrowSize: 3, + offset : {x:0,y:-2}, + className: 'keyboardShortcutTip', + preventHideOnOver : false, + //FIXME: this options are not useful anymore + motionOnShow:false, + motionOnHide:false, + fx: { 'duration': '100' } + }); + + tipDiv.on('click', function(e) { + tipDiv.trigger('mouseleave', e); + }); }, _buildContent : function() { - var result = new Element('div'); - result.setStyles({ + var result = $('
'); + result.css({ padding:'3px 0px', width:'100%' }); - var textContainer = new Element('div', {text:this._text}); - textContainer.setStyles({ + var textContainer = $('
').text(this._text); + textContainer.css({ width: '100%', textAlign: 'center', 'font-weight':'bold' }); - textContainer.inject(result); + result.append(textContainer); return result; } }); \ No newline at end of file