tooltip.detach();
}
}
public void show() {
GQuery tooltip = getTip();
String title = getTitle();
if (!enabled || title == null || title.length() == 0) {
return;
}
setContent(title);
tooltip.detach()
.removeClass(style.in(), style.top(), style.bottom(), style.left(), style.right())
.css("top", "0")
.css("left", "0")
.css("display", "block");
String container = options.getContainer();
if (container == null || "parent".equals(container)) {
tooltip.insertAfter($element);
} else if ("element".equals(container)) {
tooltip.appendTo($element);
} else {
tooltip.appendTo($(container));
}
OffsetInfo oi = OffsetInfo.from($element);
long actualWidth = tooltip.get(0).getOffsetWidth();
long actualHeight = tooltip.get(0).getOffsetHeight();
long finalTop = -1;
long finalLeft = -1;
String placementClass = null;
switch (getPlacement()) {
case BOTTOM:
finalTop = oi.top + oi.height;
finalLeft = oi.left + oi.width / 2 - actualWidth / 2;
placementClass = style.bottom();
break;
case TOP:
finalTop = oi.top - actualHeight;
finalLeft = oi.left + oi.width / 2 - actualWidth / 2;
placementClass = style.top();
break;
case LEFT:
finalTop = oi.top + oi.height / 2 - actualHeight / 2;
finalLeft = oi.left - actualWidth;
placementClass = style.left();
break;
case RIGHT:
finalTop = oi.top + oi.height / 2 - actualHeight / 2;
finalLeft = oi.left + oi.width;
placementClass = style.right();
break;
}
//TODO use GQuery.offset() method when it will be implemented
tooltip.offset((int) finalTop, (int) finalLeft);
tooltip.addClass(placementClass)
.addClass(style.in());
}