如何将工具提示添加到celltable中的单元格? [英] How to add tooltip to the cells in celltable?

查看:75
本文介绍了如何将工具提示添加到celltable中的单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gwt cellTable。在这个单元格表中,我有一列包含compositeCell。现在我想为该复合单元格中的所有单元格添加工具提示。任何解决此问题的方法?

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?

推荐答案

下面是一个抽象的工具提示列类,您可以扩展来代替普通的Column类: / p>

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());

  }
}

这篇关于如何将工具提示添加到celltable中的单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆