Last active
August 29, 2015 14:04
-
-
Save christiangoudreau/1c02d86cfcb756cb2bf6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table.addCellPreviewHandler(new CellPreviewEvent.Handler<Document>() { | |
@Override | |
public void onCellPreview(CellPreviewEvent<Document> event) { | |
if (BrowserEvents.MOUSEOVER.equals(event.getNativeEvent().getType())) { | |
overDocument = event.getValue(); | |
} | |
} | |
}); | |
table.addAttachHandler(new Handler() { | |
@Override | |
public void onAttachOrDetach(AttachEvent event) { | |
if (event.isAttached()) { | |
initTooltip(table); | |
} | |
} | |
}); | |
} | |
private void initTooltip(CellTable<Document> documents) { | |
TooltipOptions options = new TooltipOptions(); | |
options.withContent(new TooltipContentProvider() { | |
@Override | |
public String getContent(Element element) { | |
return documentTemplates.documentThumbnailTooltip(overDocument.getThumbnailUrl()).asString(); | |
} | |
}); | |
options.withPlacement(TooltipPlacement.LEFT); | |
options.withSelector(fontsResources.icons().icon_preview()); | |
options.withContainer("element"); | |
$(documents).as(Tooltip.class).tooltip(options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment