I'm working with Mayumi on this bug and I'm pretty sure there is a
problem somewhere in GWT. In our case, it happens with deeply nested
layout panels. To reproduce the bug, we removeFromParent() a panel in
the middle of the hierarchy and later re-add() it. At that point, the
children of the re-added panel have wrong width/height and their width/
height does not update when resizing the browser window. (Again, only
in IE7.)
I have fixed the problem by calling forceLayout() recursively on the
nested layout panels. I do this by calling the following method on the
reattached panel right after we add() it:
private void forceLayoutRecursive(Widget widget) {
HasWidgets parent = null;
if (widget instanceof LayoutPanel) {
((LayoutPanel) widget).forceLayout( );
parent = (HasWidgets) widget;
}
if (widget instanceof DockLayoutPanel) {
((DockLayoutPanel) widget).forceLayout( );
parent = (HasWidgets) widget;
}
if (parent != null) {
Iterator<Widget> iter = parent.iterator( );
while (iter.hasNext( )) {
Widget child = iter.next( );
forceLayoutRecursive(child);
}
}
}
If I had more time I would work on a simple test case that reproduces
the problem and file an issue... :)
Philippe
On Dec 3, 12:01 pm, mayumi <[email protected]> wrote:
> A senior developer that I work with found the solution.
> We used forceLayout() on LayoutPanel which will
> layout the children immediately.
>
> Thanks for the reply.
>
> Mayumi
>
> On Dec 3, 12:20 pm, Magnus <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi Mayumi,
>
> > I am happy that there is someone else struggling with this problem.
>
> > Well, within onResize I just call resizeLater:
>
> > public void onResize()
> > {
> > super.onResize();
> > resizeLater();
> > }
>
> > Ans resizeLater just schedules this action to be performed later:
>
> > private void resizeLater ()
> > {
> > Scheduler.get().scheduleDeferred
> > (
> > new ScheduledCommand()
> > {
> > public void execute()
> > {
> > myResize ();
> > }
> > }
> > );
> > }
>
> > And in myResize I do the resize actions themselves. When this method
> > is called, the new sizes are available through getOffset[Width|
> > Height].
>
> > But this is not a solution for me, since I have to deal with this
> > stuff in every subclass.
>
> > HTH (but I hope that someone helps me .-))
> > Magnus
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.