Questions about GWT Layout mechanism

26 views
Skip to first unread message

linhua

unread,
Feb 9, 2012, 2:40:21 AM2/9/12
to Google Web Toolkit
1. If I resize a DockLayoutPanel, then which method in DockLayoutPanel
will be called to redo layout?

2. Here is my case:
MyOwnScrollPanel contains DockLayoutPanel (in center) contains another
DockLayoutPanel. (We call it panel2)

I override the onResize() method in MyOwnScrollPanel, it sets its
child DockLayoutPanel's height and width.

But the panel2's height and width is still the 0. If I remove
MyOwnScrollPanel, then everything is OK.

What should I do to make it work?

Ümit Seren

unread,
Feb 10, 2012, 9:54:58 AM2/10/12
to google-we...@googlegroups.com
The LayoutPanels will propogate the resize event by using the ProvidesResize and RequiresResize interfaces. 
So as long as this chain is unbroken it should work without you having to do anything. 
So if you want to place your own widget between two LayoutPanels then you have to implement both interfaces. 

However your case seems to be a little bit different. I am not sure if just setting the first DockLayoutPanels width and height will cause the onResize function to be called (you can debug to check). 
You should call forceLayout() on your first DockLayoutPanel after you set its dimensions. This will layout its child (including the embedded DockLayoutPanel). 

You might also have to implement the ReqizesResize interface in your MyOwnScrollPanel and add it to RootLayoutPanel if you want the LayoutPanels to adjust when the browser window changes.




Reply all
Reply to author
Forward
0 new messages