Search in sources :

Example 1 with Preview

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);
    });
}
Also used : Tooltip(javafx.scene.control.Tooltip) Preview(com.faforever.client.chat.UrlPreviewResolver.Preview)

Aggregations

Preview (com.faforever.client.chat.UrlPreviewResolver.Preview)1 Tooltip (javafx.scene.control.Tooltip)1