Hi,
Why does this not work? "Header top" appears, but nothing else. The
divs inside the dock layout have zero height. HeaderPanel calls
onResize for it's 'content' element. Is that not enough to work with
LayoutPanels? If I remove the HeaderPanel, the DockLayoutPanel works
as expected. I want to use HeaderPanel, because I want a top div that
is sized naturally by the browser.
Calling onResize() is not sufficent, no, its really only used for being notified that the size has changed, not for setting the size. A LayoutPanel needs to be either added to another LayoutPanel, such as RootLayoutPanel, or be given a size explicitly. Unfortunately HeaderPanel is not a LayoutPanel (though it does need to be put inside one itself) so I'm not sure the best way to do this....
Just looking at how RootLayoutPanel does its business, in its onLoad() method, it has:
@Override
protected void onLoad() {
getLayout().onAttach();
getLayout().fillParent();
}
So maybe extending LayoutPanel and doing something similar would do the job, but really I don't know if this is a good idea or not! Your other options would be to use a static sized header, or use a DockLayoutPanel with a 'north' section that re-sizes itself when ever the content height changes (you can use the 'scrollHeight' property of the container element to measure how much height you need) but that's obviously a pretty ugly way to do it.
I'd be interested to hear if getLayout().fillParent() does in fact work for this, or if anyone else uses it successfully. I think you'd have to call your custom LayoutPanel's onResize() method yourself, whenever the headers content/size changes.. so that any child widgets that need onResize() get notified of less/more space available. So, not much different than re-sizing your header manually.. :(
Probably best to use a static height header if you want to save some time!
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment