class ClickableSafeHtmlCell extends SafeHtmlCell {
public void onBrowserEvent(Cell.Context context, Element parent, SafeHtml value, NativeEvent event, ValueUpdater<SafeHtml> valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
if ("click".equals(event.getType())) {
Window.alert("bla");
}
}
}
Column<Data, SafeHtml> objectNameColumn = new Column<Data, SafeHtml>(new ClickableSafeHtmlCell()) {
@Override
public SafeHtml getValue(ModuleEntry object) {
String name = (object.getName() == null ? "" : object.getName());
String description = (object.getDescription() == null ? "" : object.getDescription());
String regex = "(<([^>]+)>)";
return new SafeHtmlBuilder().appendHtmlConstant(
"<span>" + name + "</span></br />" + "<span title='" + new SafeHtmlBuilder().appendEscaped(description.replaceAll(regex, "")).toSafeHtml().asString() + "'>"
+ description.replaceAll(regex, "") + "</span>").toSafeHtml();
}
};
objectNameColumn.setFieldUpdater(new FieldUpdater<Data, SafeHtml>() {
public void update(int index, Data object, SafeHtml value) {
Window.alert(value.asString());
}
});