That makes sense. RequiresResize was created for precisely this kind of
scenario, where a widget simply can't work properly without knowing when it
has been resized. It doesn't actually cause the widget to be any *more* broken
if you fail to call onResize(), but it serves as a hint to the developer
that this is required, and will cause panels that implement ProvidesResize
to automatically call onResize() for their children that require it.

On Tue, Sep 29, 2009 at 6:49 AM, Eric Ayers <[email protected]> wrote:

>
> I'll look into implementing RequiresResize, I created an issue:
>
>  http://code.google.com/p/gwt-google-apis/issues/detail?id=308
>
> The problem with the map not refreshing properly and having to call
> checkResizeAndCenter() immediately after creating it has been around a
> long time and there is a FAQ up for it.  I hope this works. Having a
> way to automatically compensate would take some pain out of creating
> maps applications!
>
>
> On Sep 29, 12:29 am, Joel Webber <[email protected]> wrote:
> > Having MapWidget implement RequiresResize would seem to be the right
> > approach. I can see how the maps code would need to be informed when it
> is
> > resized, as it needs to create the appropriate number of tiles on each
> axis.
> > Does this sound reasonable to you, Eric?
> >
> >
> >
> > On Mon, Sep 28, 2009 at 9:18 PM, jd <[email protected]> wrote:
> >
> > > Yeah sorry I was not sure if this was more of a development topic or
> > > typical user problem.
> >
> > > I tried your suggestion of map.checkResizeAndCenter() and it works
> > > perfectly.  It also seems a better solution than my original
> > > SimplePanel place holder.
> >
> > > It seems that the Google map object initializes its size as soon as it
> > > is added to the document.  Perhaps MapWidget could also implement
> > > RequiresResize?
> >
> > > So now a working example is:
> >
> > >        public void onModuleLoad()
> > >        {
> > >                DockLayoutPanel p = new DockLayoutPanel(Unit.PX);
> > >                p.addNorth(new HTML("north"), 100);
> > >                p.addSouth(new HTML("south"), 100);
> > >                p.addEast(new HTML("east"), 100);
> > >                p.addWest(new HTML("west"), 100);
> >
> > >                MapWidget map = new MapWidget(LatLng.newInstance(-41.1,
> > > 174.8), 5);
> > >                p.add(map);
> >
> > >                p.layout();
> >
> > >                RootLayoutPanel rp = RootLayoutPanel.get();
> > >                rp.add(p);
> >
> > >                 rp.layout();
> >
> > >                map.checkResizeAndCenter();
> > >        }
> >
> > > John
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to