Friday, May 30, 2014

Re: DockLayoutPanel displays in body, not in div

LayoutPanels are meant to be put into other LayoutPanels. RootPanel or anything you get with RootPanel.get(<id>) isn't a LayoutPanel. So if you have a DockLayoutPanel you should put it into a RootLayoutPanel. 

RootLayoutPanel doesn't do any magic though. It just puts a LayoutPanel into the <body> using RootPanel.get().add(layoutPanel) that fills the entire space. When you now call RootLayoutPanel.get() you are getting that LayoutPanel back and thus your DockLayoutPanel would be added to the LayoutPanel. In addition RootLayoutPanel listens for window resize events and calls a special onResize() method that all LayoutPanels have and which causes them to recalculate some sizes. As this involves some overhead you should only use LayoutPanels to define your general app structure. 

In your example you should be able to see the DockLayoutPanel if your container that has the "ui" id has a fixed size and either position:absolute or position:relative applied.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment