I need a Column in which it was possible to put a Widget. I have this:
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.safehtml.shared.Safe
I have a post on adding a widget to a cell. Have a look and see if it helps you out.
http://mpickell.com/blog/2013/01/28/widgets-in-gwt-cell-tables/
Like Colin says, changes on the widget won't be used unless the HTML of the widget is pushed again to the page. I have some notes in the comments of this post on some ways you might handle events as well. Read the comments to see how to use the class I have in the post.
And also like Colin says here, be careful and make sure you understand what you're doing and how the widget is never actually attached to its HTML in the page.
By the way.. You mention you want a button. Why not use the GWT ButtonCell?
See here for a number of examples of AbstractCell implementations.
To answer your question regarding a GWT button:
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.ui.Widget;
public class WidgetGridCell extends AbstractCell<Widget> {
Widget widget;
public WidgetGridCell(Widget widget) {
this.widget = widget;
}
@Override
public void render(Context paramContext,
Widget param, SafeHtmlBuilder pb) {
Button aButton = new Button();
// add text to the button, etc...
pb.append(SafeHtmlUtils.fromTrustedString(aButton.toString()));
}
}
It's largely not feasible (and not advisable) to try and render an entire widget within a cell element but it sounds as though you are really trying to render a button from within the cell.
AbstractCell is an implementation of the Cell interface which allows you to define the HTML to render within the cell. If you need a button which can respond to events you'll need to define your custom cell to handle browser events (such as the click event). Google does a good job in their documentation on custom cells explaining how you can go about doing that.
See this link: http://www.gwtproject.org/doc/latest/DevGuideUiCustomCells.html