On Thu, Jan 5, 2012 at 2:20 PM, Thad <thad.humphries@gmail.com> wrote:
-- Here's a follow-up question: When using UiBuilder, how do I implement
a panel's onResize() method? I think the answer is to assign the
panels' ui:field's in FiltersViewImpl.ui.xml and call their onResize()
in my FiltersViewImpl.java. Am I correct?
I think unless you are writing your own Panel that implements RequiresResize/ProvidesResize, you shouldn't need to. Existing LayoutPanels such as LayoutPanel, SimpleLayoutPanel, etc, already propagate onResize() events to any children that need them. (any children that implement RequiresResize)
Also, you shouldn't be using/worrying about onResize() in the majority of cases, unless you are measuring available space to you for some reason. In an ideal setup, all your panels are positioned and sized using the constraints system (top/bottom, etc)
If you are, one kinda, 'gotcha' with onResize() is that its not actually called when the Panel/Widgets are layed out initially, only when they are resized. If you want to do some measuring of pixels/space when your panel is initially layed out, you should use a deferred command ( Scheduler.get().scheduleDeferred(...) ) to call your top level LayoutPanel's onResize() method. This allows the browsers layout to finish before you measure anything, and should propagate onResize() events to all the children widgets (and possibly their children)
(AFAIK this is how it works anyway!)
Also, just FYI, think you got this anyway but in your initial question, if your Menu bar height is static, you can set everything in the UiBinder template, rather than calling setWidgetXXX, ie;
<g:layer top="0" bottom="100px" >
<my:MenuPanel/>
</g:layer>
<g:layer top="100px" bottom="0" >
<g:ScrollBar>
<my:Content/>
</g:ScrollBar>
</g:layer>
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