use of com.faforever.client.chat.UrlPreviewResolver.Preview in project downlords-faf-client by FAForever.
the class AbstractChatTabController method previewUrl.
/**
* Called from JavaScript when user hovers over an URL.
*/
public void previewUrl(String urlString) {
urlPreviewResolver.resolvePreview(urlString).thenAccept(optionalPreview -> {
if (!optionalPreview.isPresent()) {
return;
}
Preview preview = optionalPreview.get();
linkPreviewTooltip = new Tooltip(preview.getDescription());
linkPreviewTooltip.setAutoHide(true);
linkPreviewTooltip.setAnchorLocation(PopupWindow.AnchorLocation.CONTENT_BOTTOM_LEFT);
linkPreviewTooltip.setGraphic(preview.getNode());
linkPreviewTooltip.setContentDisplay(ContentDisplay.TOP);
linkPreviewTooltip.show(getRoot().getTabPane(), lastMouseX + 20, lastMouseY);
});
}