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<String[]> {   interface HyperTextTemplate extends SafeHtmlTemplates {
    @Template("<a style=\"{0}\">{1}</a>")
    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<String[]> 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]));
    }
  } }

gwt 创建 超链接cell (HyperTextCell)的更多相关文章

  1. 如何在TextView类中创建超链接 Linkify

    Linkify是一个辅助类,通过RegEx样式匹配,自动地在TextView类(和继承的类)中创建超链接.符合特定的RegEx样式的文本会被转变成可点击的超链接,这些超链接隐式的调用startActi ...

  2. ios用storyboard快速创建静态cell

    在实际开发中经常会遇到下面这样的页面,通常我们用静态cell来做可以快速创建,提高效率 下面讲一下用storyboard创建方法,将一个tableViewController控制器拖入storyboa ...

  3. iOS UICollectionView(转一) XIB+纯代码创建:cell,头脚视图 cell间距

    之前用CollectionViewController只是皮毛,一些iOS从入门到精通的书上也是泛泛而谈.这几天好好的搞了搞苹果的开发文档上CollectionViewController的内容,亲身 ...

  4. 新浪微博客户端(22)-创建微博Cell

    DJStatusCell.h #import <UIKit/UIKit.h> @class DJStatusCellFrame; @interface DJStatusCell : UIT ...

  5. poi操作Word创建超链接

    项目引入poi: <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</ ...

  6. Winform中创建超链接,点击跳转网页

    代码如下: System.Diagnostics.Process ie = new System.Diagnostics.Process();ie.StartInfo.FileName = " ...

  7. a标签创建超链接,利用a标签创建锚点

    #Html今日学习内容 <!DOCTYPE html> <html> <head lang="en">     <meta charset ...

  8. swift 之 纯代码创建 cell

    初学swift 但是网上只有很多swift用xib创建的cell,就算是有也不是我想要的.今天自己弄了一个不用xib纯代码写的,来上代码 博客地址: https://github.com/liguol ...

  9. 使用xib创建cell时 bug

    UITableView (<UITableView: 0x15799a800; frame = (0 4797; 375 733); clipsToBounds = YES; tag = 305 ...

随机推荐

  1. wordpress迁移

    从一个地方搬到另一个窝,我必定会带着我的Wordpress,这就涉及到博客的迁移了.首先申明,该文非原创,放在这里主要是为了方便自己日后再次需要转移博客时,能很快锁定文章目标. 这篇文章主要介绍怎样将 ...

  2. Java_生产者消费者模式

    /* * To change this license header, choose License Headers in Project Properties. * To change this t ...

  3. MySQL提供的错误日志中的错误级别一共有3个分别为:

    ERROR_LEVEL-->错误级别 WARNING_LEVEL-->警告级别 INFORMATION_LEVEL-->信息级别

  4. 解决codeforces访问慢的问题

    转载至:http://blog.csdn.net/wmx16835/article/details/38639451 前阵子打Codeforces(以下简称CF),每次比赛的时候都要等待网页刷新.不是 ...

  5. 在mac中怎么显示隐藏文件夹

    缺省情况下,在 Mac 下是不显示隐藏文件的,Finder 也未提供设置是否显示隐藏文件的选项,不像 Windows 下,有一个“文件夹选项“设置界面里可以控制,但这并不表示 Mac 下无法显示隐藏文 ...

  6. EL表达式---关系运算符

    近来公司做html5页面的数据展现,发现集中使用了El表达式,而对于EL表达式,发现自己对于关系运算符的运用还存在很多不足,特此 查阅以前的书籍资料和从网上看一些大牛的笔记,总结如下: 首先El关系运 ...

  7. ajax调用服务的基本格式

    <个人积累,转载请注明出处> 格式如下: $.ajax({ type: "post", //访问WebService使用Post方式请求 url: "http ...

  8. Linux系统各发行版镜像下载

    Linux系统各发行版镜像下载(2014年10月更新),如果直接下载不了,请使用迅雷下载.并且注意,我的下载地址,在 迅雷 里才起作用. 包括Ubuntu,Fedora,SUSE,Red Hat En ...

  9. C#字符串拼接怎么转义背景图片

    C#字符串拼接怎么转义背景图片   StringBuilder sb = new StringBuilder(); sb.Append("<div style=\"backg ...

  10. iOS崩溃日志分析

    Incident Identifier: 55864905-937C-4172-B435-2ACA13D3070ECrashReporter Key: b85cab13431711060a5fab55 ...