On 16 sep, 21:43, Jason Stratton <[email protected]> wrote:
> I have an application that uses a DeckPanel for the content area of my
> app. I have been inserting LazyPanels into the deck so that each panel
> only gets created when the panel is displayed. I was hoping this would
> help the app perform better.
>
> (As an aside, there has not been a performance issue yet as I'm just
> beginning the development and this is probably a case of my putting
> the cart before the horse. I had also attempted to use some code
> splitting along the same lines, but it took two attempts to show the
> lazy panel every time. Regardless...)
>
> This had been working fine for me and then I upgraded to GWT 2.1 M3 in
> order to start using the new CellTable. The Bikeshed Expenses app uses
> the UIBinder (and I had not). So I figured I would bite the bullet and
> learn how to use it as well. The Expenses app was using the various
> Layout Panels like the DockLayoutPanel, which I blindly followed. I
> ran into the issues around using the RootLayoutPanel as opposed to the
> RootPanel and setting the <!Doctype html> in my web page to conform to
> standards mode. Then I converted all of the varous panels in my app to
> the appropriate Layout Panel, where possible. There are no equivalent
> Layout Panels for the DeckPanel or LazyPanel. So I just continued
> using those.
>
> This was working out as I went through the exercise, but then I
> started running into some display issues with a couple of the
> DockLayoutPanels. Odd things like having the South widget render above
> the north widget and the center widget not rendering at all. This was
> similar behavior as I had noticed before setting the <!doctype html>.
> So I figured I needed to look at each of the parent panels in a chain
> all the way down to the RootLayoutPanel.
>
> What I discovered was that the DeckPanel worked happily with the
> DockLayoutPanel, but the LazyPanel did not. Simply removing the
> LazyPanel and adding the DockLayoutPanel to the DeckPanel resolved the
> issue. So I don't have an issue at this time, but I was curious and
> figured I would bring it up to the group.
>
> Has anyone had similar issues using the LayoutPanels as children of a
> LazyPanel? Is there an issue with my method (or madness)?

The issue is that RequiresResize panels (such as DockLayoutPanel) must
either be added to ProvidesResize panels or have their size set
explicitly: section "Using a LayoutPanel without RootLayoutPanel" in
http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#Recipes

Neither LazyPanel or DeckPanel are RequiresResize, but DeckPanel
explicitly sets its children's size. When you introduce LazyPanel
between the DeckPanel and RequiresResize child, it doesn't propagate
the size to its (lazy) child widget.

I'd suggest you file a bug so that LazyPanel implements RequiresResize
and ProvidesResize. In the mean time, you should be able to workaround
it by implementing the interfaces in your LazyPanel, with onResize
implemented as:
public void onResize() {
   Widget widget = getWidget();
   if (widget instanceof RequiresResize) {
      ((RequiresResize) widget).onResize();
   }
}
I think it should be enough.

-- 
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.

Reply via email to