private static class AbstractButtonCell extends AbstractCell<String> {
@Override
public void render(com.google.gwt.cell.client.Cell.Context context,
final String value, SafeHtmlBuilder sb) {
if (value == null) {
return;
}
VerticalPanel buttonPanel = new VerticalPanel();
Button addLinkButton = new Button("Click " + value);
addLinkButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Window.alert("You clicked " + value);
}
});
buttonPanel.add(addLinkButton);
sb.appendHtmlConstant(buttonPanel.toString());
}
}
My column that's using the AbstractCell above:
AbstractButtonCell buttonCell = new AbstractButtonCell();
Column<SimilarApplication, String> buttonColumn =
new Column<SimilarApplication, String> (buttonCell) {
@Override
public String getValue(SimilarApplication object) {
return object.getName();
}
};
_cellTable.addColumn(buttonColumn, "A Button");
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/FHDa0IaRZUkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment