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.
Hope that helps!
--
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/groups/opt_out.
No comments:
Post a Comment