BTW, here's the uibinder composite "MyComposite", and the code that
uses it:
public class MyComposite extends Composite {
private static MyCompositeUiBinder uiBinder =
GWT.create(MyCompositeUiBinder.class);
interface MyCompositeUiBinder extends UiBinder<Widget, MyComposite> {
}
public MyComposite() {
initWidget(uiBinder.createAndBindUi(this));
}
}
public class MyEntryPoint implements EntryPoint {
public void onModuleLoad() {
final MyComposite myComposite = new MyComposite();
rootPanel.add(myComposite);
rootPanel.add(new Label("" + myComposite.getOffsetWidth()));
DeferredCommand.addCommand(new Command() {
@Override
public void execute() {
rootPanel.add(new Label("" + myComposite.getOffsetWidth()));
}
});
}
}
The first label shows 987 (or whatever the width of <body> is), the
second label shows 80.