博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
gwt 创建 超链接cell (HyperTextCell)
阅读量:7238 次
发布时间:2019-06-29

本文共 1475 字,大约阅读时间需要 4 分钟。

package com.cnblogs.hooligen.client;import com.google.gwt.cell.client.AbstractCell;import com.google.gwt.cell.client.ValueUpdater;import com.google.gwt.core.client.GWT;import com.google.gwt.dom.client.Element;import com.google.gwt.dom.client.NativeEvent;import com.google.gwt.safehtml.client.SafeHtmlTemplates;import com.google.gwt.safehtml.shared.SafeHtml;import com.google.gwt.safehtml.shared.SafeHtmlBuilder;public class HyperTextCell extends AbstractCell
{  interface HyperTextTemplate extends SafeHtmlTemplates {    @Template("
{1}")    SafeHtml hyperText(String styleClass, String value);  }  private static HyperTextTemplate template;  public HyperTextCell() {    this("click");  }  public HyperTextCell(String... consumedEvents) {    super(consumedEvents);    if(template == null) {      template = GWT.create(HyperTextTemplate.class);    }  }  @Override  public void onBrowserEvent(Context context, Element parent, String[] value,    NativeEvent event, ValueUpdater
valueUpdater) {    super.onBrowserEvent(context, parent, value, event, valueUpdater);    if("click".equals(event.getType())) {      if (valueUpdater != null) {        valueUpdater.update(value);      }    }  }  @Override  public void render(Context context, String[] value, SafeHtmlBuilder sb) {    if (value != null && value.length == 2) {      sb.append(template.hyperText(value[0], value[1]));    }  }}

 

转载于:https://www.cnblogs.com/hooligen/p/3309147.html

你可能感兴趣的文章
移动端图表插件jChart.js的修改
查看>>
MVC Controller return 格式
查看>>
Eclipse快捷键 10个最有用的快捷键
查看>>
JQuery实现密码有短暂的显示过程和实现 input hint效果
查看>>
Kooboo中如何切换数据库(注意:如果切换数据库,需要Kooboo中没有一个website 否则会报错数据库中没有表之类的)...
查看>>
OWIN规范中最让人费解的地方
查看>>
页面视图中的按钮操作指向
查看>>
Android UI开发第三十篇——使用Fragment构建灵活的桌面
查看>>
自然语言处理哪家强?【36kr】
查看>>
[HTML/CSS]display:none和visibility:hidden的区别
查看>>
浅谈MS-SQL锁机制
查看>>
Makefile编写 一 *****
查看>>
关于SetCapture() 和 ReleaseCapture()的使用方法
查看>>
Asp.net MVC Comet推送
查看>>
QDir, QFileInfo 和 QDirIterator 区别
查看>>
Zend Studio使用
查看>>
院士的幻想与国产操作系统泡沫
查看>>
为什么 string.find()返回值是-1
查看>>
结构型模式之Adapter模式
查看>>
Silverlight Popup Bubble
查看>>