gwt 创建 超链接cell (HyperTextCell)
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)的更多相关文章
- 如何在TextView类中创建超链接 Linkify
Linkify是一个辅助类,通过RegEx样式匹配,自动地在TextView类(和继承的类)中创建超链接.符合特定的RegEx样式的文本会被转变成可点击的超链接,这些超链接隐式的调用startActi ...
- ios用storyboard快速创建静态cell
在实际开发中经常会遇到下面这样的页面,通常我们用静态cell来做可以快速创建,提高效率 下面讲一下用storyboard创建方法,将一个tableViewController控制器拖入storyboa ...
- iOS UICollectionView(转一) XIB+纯代码创建:cell,头脚视图 cell间距
之前用CollectionViewController只是皮毛,一些iOS从入门到精通的书上也是泛泛而谈.这几天好好的搞了搞苹果的开发文档上CollectionViewController的内容,亲身 ...
- 新浪微博客户端(22)-创建微博Cell
DJStatusCell.h #import <UIKit/UIKit.h> @class DJStatusCellFrame; @interface DJStatusCell : UIT ...
- poi操作Word创建超链接
项目引入poi: <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</ ...
- Winform中创建超链接,点击跳转网页
代码如下: System.Diagnostics.Process ie = new System.Diagnostics.Process();ie.StartInfo.FileName = " ...
- a标签创建超链接,利用a标签创建锚点
#Html今日学习内容 <!DOCTYPE html> <html> <head lang="en"> <meta charset ...
- swift 之 纯代码创建 cell
初学swift 但是网上只有很多swift用xib创建的cell,就算是有也不是我想要的.今天自己弄了一个不用xib纯代码写的,来上代码 博客地址: https://github.com/liguol ...
- 使用xib创建cell时 bug
UITableView (<UITableView: 0x15799a800; frame = (0 4797; 375 733); clipsToBounds = YES; tag = 305 ...
随机推荐
- 王帅:深入PHP内核
[问底]王帅:深入PHP内核(三)——内核利器哈希表与哈希碰撞攻击 [问底]王帅:深入PHP内核(二)——SAPI探究 [问底]王帅:深入PHP内核(一)——弱类型变量原理探究
- 文件I/O之/dev/fd
较新的系统都提供名为/dev/fd的目录,其目录项是名为0.1.2等的文件.打开文件/dev/fd/n等效于复制描述符n(假定描述符n是打开的). 在下列函数调用中: fd = open( " ...
- JPA OpenJPA 简单例子
JPA 全称,Java Persistence API,Java持久化API JPA是一套持久化标准,相当于JDBC标准,针对于此标准的实现目前有OpenJAP,TOPLINK,Hibernate等. ...
- View绘制详解,从LayoutInflater谈起
自定义View算是Android开发中的重中之重了,很多小伙伴可能或多或少都玩过自定义View,对View的绘制流程也有一定的理解.那么现在我想通过几篇博客来详细介绍View的绘制流程,以便使我们更加 ...
- (inline)内联函数在IOS开发中的使用
今天在阅读YYKit源码(https://github.com/ibireme/YYKit.git)时发现在YYKitMacro.h组件中大量使用的内联函数,例如此文件中的一个函数 static in ...
- 下拉列表(web),用jQuery实现
<!DOCTYPE html><html><head> <meta http-equiv="Content-Type" conten ...
- java validator的原理与使用
http://developer.51cto.com/art/201104/253257_1.htm ava EE 6核心特征:Bean Validation特性概述(2) 2011-04-02 14 ...
- Linux学习之路:shell变量(一)
一.变量的显示与设置 1.变量的显示运用echo命令 +$符号: 上图例子显示的是系统变量,咱们可以自己设置变量 2.设置变量运用“=”符号 设置了变量NIU 值为“niunai” 变量设置规则: ( ...
- pat 1006 Sign In and Sign Out (25)
At the beginning of every day, the first person who signs in the computer room will unlock the door, ...
- PHP中长连接的实现
最近遇到PHP程序在执行大量数据的时候提示超时,于是用到了set_time_limit()函数来设置PHP页面的最大运行时间. 设置允许脚本运行的秒数.如果这是默认的,该脚本返回一个致命的错误.默认限 ...