What worked for me was creating a custom Button Cell class (say, StyledButtonCell for e.g.) that extends ButtonCell, and overrode the render method to my liking. In my example below, I specify a basic bootstrap button style and also use an additional icon to go with the button text.
Sample code for custom button cell class (derived from base ButtonCell class):
public class StyledButtonCell extends ButtonCell{
/**
* Construct a new StyledButtonCell that will use a {@link SimpleSafeHtmlRenderer}.
*/
public StyledButtonCell() {
super(SimpleSafeHtmlRenderer.getInstance());
}
@Override
public void render(Context context, SafeHtml data, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<button class=\"btn btn-default\" type=\"button\" tabindex=\"-1\">");
sb.appendHtmlConstant("<i class=\"fa fa-refresh\"></i>");
if (data != null) {
sb.append(data);
}
sb.appendHtmlConstant("</button>");
}
}
Sample reference to the StyledButtonCell while defining gwt table/columns:
... new Column<XYZClass, String>(new StyledButtonCell()) {
@Override
public String getValue(XYZClass object) {
return "buttonText_goes_here";
}