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.
>
--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
I do not use UiBinder, but I have come across this problem as well, and have found a solution that works for me.
The problem is that HeaderPanel only sets the size of the contentContainer, it does nothing with the contentContainer’s child widget (HeaderPanel#getContentWidget()). Aiden’s suggestion of using ResizeLayoutPanel as the content widget will not work for the same reason (I tried :P). So, my fix is to always wrap the content widget in a SimpleLayoutPanel that fills the contentContainer:
public class HeaderLayoutPanel extends HeaderPanel implements ProvidesResize{
@Override
public void setContentWidget(Widget w){
SimpleLayoutPanel panel = new SimpleLayoutPanel();
panel.setSize("100%", "100%");
panel.setWidget(w);
super.setContentWidget(panel);
}
}
setSize("100%", "100%") works because the contentContainer’s dimensions are always set in px. Also, remember that this needs to be added to a LayoutPanel for it to fill all available space.
I called this class ‘HeaderLayoutPanel’ and had it implement the ProvidesResize marker interface because I feel that the SimpleLayoutPanel wrapper makes this a ‘true’ LayoutPanel, since it does fulfill the onResize() contract for the content widget.
forceLayout():
if (header != null && header instanceof RequiresResize) { //added
((RequiresResize) header).onResize();
}
if (footer != null && footer instanceof RequiresResize) { //added
((RequiresResize) footer).onResize();
}
But generally we end up wanting to know about the resize to modify elements that are inside of the child widget either to reposition or resize them.
But generally we end up wanting to know about the resize to modify elements that are inside of the child widget either to reposition or resize them.Hmm, just a guess, but if you have this desire then you probably use the wrong widget or your CSS can be done better in header and footer.