I have found the issue and am not sure how to fix it using the current
API.  After setting 100% height and width on both the DockLayoutPanel
and RootLayoutPanel the map still reported a span of 0 and did not
render correctly.  In Safari's Inspector I could see that the only
element without 100% height and width was the generated "layout
parent" element but after changing this in using the inspector it
worked.

So I think I need to be able to access the Layout.parentElem to modify
its style.

On Sep 28, 5:43 pm, jd <[email protected]> wrote:
> Hi,
>
> I am trying to use the new DockLayoutPanel with a Google map in the
> center panel which takes up what ever space remains.  The map does not
> render properly due to not being able to figure out its dimensions.  I
> have modified the sample below to demonstrate this by adding a map
> with 100% height and width.
>
> public class DockLayoutPanelExample implements EntryPoint {
>
>   public void onModuleLoad() {
>     // Attach five widgets to a DockLayoutPanel, one in each
> direction. Lay
>     // them out in 'em' units.
>
>           final MapWidget map = new MapWidget(LatLng.newInstance(50, 50), 8);
>           map.setWidth("100%");
>           map.setHeight("100%");
>
>           map.addMapMoveEndHandler(new MapMoveEndHandler()
>           {
>                 public void onMoveEnd(MapMoveEndEvent event)
>                 {
>                         Window.alert(map.getBounds().toString());
>                 }
>           });
>
>     DockLayoutPanel p = new DockLayoutPanel(Unit.EM);
>     p.addNorth(new HTML("north"), 2);
>     p.addSouth(new HTML("south"), 2);
>     p.addEast(new HTML("east"), 2);
>     p.addWest(new HTML("west"), 2);
>     p.add(map);
>
>     // Note the explicit call to layout(). This is required for the
> layout to
>     // take effect.
>     p.layout();
>
>     // Attach the LayoutPanel to the RootLayoutPanel. The latter will
> listen for
>     // resize events on the window to ensure that its children are
> informed of
>     // possible size changes.
>     RootLayoutPanel rp = RootLayoutPanel.get();
>     rp.add(p);
>
>     // The RootLayoutPanel also requires that its layout() method be
> explicitly
>     // called for the initial layout to take effect.
>     rp.layout();
>   }
>
> }
>
> I believe the map needs to be able to figure out its exact height and
> width in pixels.
>
> Can anyone suggest an approach to get around this problem?
>
> Thanks,
>
> John
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to