How to add tooltip to the cells in celltable?
gwt, java
Solution
Here's an abstract tooltip column class that you can extend in place of the normal Column class:
public abstract class MyToolTipColumn<T, C> extends Column<T, C> {
interface Templates extends SafeHtmlTemplates {
@Template("<div title=\"{0}\">")
SafeHtml startToolTip(String toolTipText);
@Template("</div>")
SafeHtml endToolTip();
}
private static final Templates TEMPLATES = GWT.create(Templates.class);
private final String toolTipText;
public MyToolTipColumn(final Cell<C> cell, final String toolTipText) {
super(cell);
this.toolTipText = toolTipText;
}
@Override
public void render(final Context context, final T object, final SafeHtmlBuilder sb) {
sb.append(TEMPLATES.startToolTip(toolTipText));
super.render(context, object, sb);
sb.append(TEMPLATES.endToolTip());
}
}
Problem
I am using gwt cellTable. In this cell table i have one column containing compositeCell. Now i want to add a tooltip for all cells in that composite cell. Any work around for this?