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 ...
随机推荐
- Oracle读取和修改数据块的过程 专家
http://blog.itpub.net/18841027/viewspace-1649618/
- 【转】cocos2d-x 2.0版本 自适应屏幕分辨率
http://codingnow.cn/cocos2d-x/975.html 我使用的版本是cocos2d-2.0-x-2.0.4,cocos2dx-2.0版本对多分辨率适配提供了很好的支持,使用起来 ...
- iOS9横竖屏设置的处理方法
在一般的视频类APP播放的时候都会支持横屏,这样做的好处就是便于观看.你的项目中支持横屏吗?我们一起了解一下,在iOS9中横竖屏设置的处理方法吧! 支持横竖屏配置 在iOS6以后,如果APP需要支持横 ...
- 如何去除掉inline-block元素之间的默认间距
前几天写一个页面 div{width:900px;} div li{ display:inline-block; width:300px;} <ul> <li></li& ...
- windows下mysql初始密码设置
转载自:http://blog.csdn.net/ofreelander/article/details/50802780 1.my-default.ini 改名my.ini 在解压的目录下面复制my ...
- Linux下编译安装redis,详细教程
话不多说,直接开工 准备工作: 本人测试环境:Win10 虚拟机:VM Linux:CentOS5.5 (已搭建好LNMP环境) 软件包:redis-2.6.14.tar.gz (Linux下redi ...
- PHP免费API调用,使用(CURL)
<?phpclass GetApiModel{//获取第三方API //获取身份证信息 //返回json /*{ "errNum": 0, "retMsg" ...
- angularjs学习总结一(表达式、指令、模型)
一:自执行匿名函数 (function(){ /*code*/})();自执行匿名函数:常见格式:(function() { /* code */ })();解释:包围函数(function(){}) ...
- django 学习-1
1.首先是安装django 解压包然后 python setup.py install 安装成功 2.建立一个项目 django-admin.py startproject study 3. 再到 ...
- h2database源码浅析:事务、两阶段提交
Transaction Isolation Transaction isolation is provided for all data manipulation language (DML) sta ...