Hi Stephen, I feel this is just one of those challenging areas in
GWT. There's no "event" in GWT that tells you DOM has finished layout
activities, but there is a point where you expect this to be the case
in the normal lifecycle of a widget.
In the Widget lifecycle there are four key points you can override
that in a way act as "events":
* onAttach() - called when a widget is attached to the browser's
document.
* onLoad() - called immediately after a widget becomes attached to
the browser's document.
* onUnload() - called immediately before a widget will be detached
from the browser's document.
* onDetach() - called when a widget is detached from the browser's
document
The one of interest here is onLoad(), where it's fairly safe to assume
that everything DOM attribute wise is sorted out by then. I've still
found it wise to give the browser some time by wrapping any dimension
stuff in a DeferredCommand within the onLoad() method; I'm not 100%
convinced it is necessary, but I like to live on the safe side in an
effect library I'm building (
http://code.google.com/p/gwt-fx/).
I have to admit, I'm not aware of a onResize() method to override in
Widget or Composite class, so can't really comment on how that would
work (out of interest, where is it in standard GWT?).
DeferredCommand itself is a little bit of a trick, although it says
"allows you to execute code after all currently pending event handlers
have completed" it's really based on timers rather than hooking into
the browser event queue and checking all is done before firing your
command - that said, it works.
Hope that gives you a bit more info.
//Adam