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. 垃圾回收算法手册:自动内存管理的艺术 BOOK

    垃圾回收算法手册:自动内存管理的艺术 2016-03-18 华章计算机 内容简介 PROSPECTUS 本书是自动内存管理领域的里程碑作品,汇集了这个领域里经过50多年的研究沉积下来的最佳实践,包含当 ...

  2. windows远程关机重启

    windows远程关机 http://lsscto.blog.51cto.com/779396/245681 shutdown http://baike.baidu.com/view/596875.h ...

  3. What Influences Method Call Performance in Java?--reference

    reference from:https://www.voxxed.com/blog/2015/02/too-fast-too-megamorphic-what-influences-method-c ...

  4. Http抓包工具Charlse使用教程

    [原文]http://blog.csdn.net/wildfireli/article/details/19829479 Charles是目前最强大的http调试工具,在界面和功能上远强于Fiddle ...

  5. aggregation 详解2(metrics aggregations)

    概述 权值聚合类型从需要聚合的文档中取一个值(value)来计算文档的相应权值(比如该值在这些文档中的max.sum等). 用于计算的值(value)可以是文档的字段(field),也可以是脚本(sc ...

  6. [转]ORACLE 异常错误处理

    本文转自:http://www.cnblogs.com/soundcode/archive/2012/01/10/2318385.html 本篇主要内容如下: 5.1 异常处理概念 5.1.1 预定义 ...

  7. 【转】android adb命令

      1. 显示系统中全部Android平台: android list targets 2. 显示系统中全部AVD(模拟器): android list avd 3. 创建AVD(模拟器): andr ...

  8. php中的作用域

    在php中分为局部变量.全局变量和静态变量: 局部变量就是在函数体内声明的变量,例子: <?php  //作用域  $a=5;  function show($b){   $a=$b;//相当于 ...

  9. java.util.concurrent 多线程框架

    http://daoger.iteye.com/blog/142485 JDK5中的一个亮点就是将Doug Lea的并发库引入到Java标准库中.Doug Lea确实是一个牛人,能教书,能出书,能编码 ...

  10. UDP通信 Java

    public class UdpServerTest { /** * @param args * @throws SocketException */ public static void main( ...