I suggested MapWidget.checkResize() because it has solved the problem you are describing before:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/657ed9bb2e2e9011/f9dfc91e749c566b On Tue, Sep 9, 2008 at 7:21 AM, anglers <[EMAIL PROTECTED]> wrote: > > Well, it is not problem with resizing I believe... On this example > there are > gray map loading area with label within, it is resizable by client > window resize event. There are controls too on the map :) > But content of the map area is not loaded... > > SImple example: > > > package com.test.client; > > import com.google.gwt.core.client.EntryPoint; > import com.google.gwt.core.client.GWT; > import com.google.gwt.core.client.JavaScriptObject; > import com.google.gwt.core.client.GWT.UncaughtExceptionHandler; > import com.google.gwt.user.client.Command; > import com.google.gwt.user.client.DOM; > import com.google.gwt.user.client.DeferredCommand; > import com.google.gwt.user.client.Element; > import com.google.gwt.user.client.Window; > import com.google.gwt.user.client.WindowResizeListener; > > public class Index implements EntryPoint, WindowResizeListener { > > public static JavaScriptObject jso; > > public void onModuleLoad() { > try{ > > Window.addWindowResizeListener(this); > DeferredCommand.addCommand(new Command() { > public void execute() { > onWindowResized(Window.getClientWidth(), > Window.getClientHeight()); > GWT.setUncaughtExceptionHandler(new > UncaughtExceptionHandler() { > public void > onUncaughtException(Throwable e) { > Window.alert(e.toString()); > } > }); > } > }); > jso = getMap(DOM.getElementById("mapstraction")); > addControls(jso); > onWindowResized(Window.getClientWidth(), > Window.getClientHeight()); > > } catch (Exception e) { > Window.alert(e.toString()); > } > } > > public void onWindowResized(int width, int height) { > resize(jso, width, height); > } > > > protected native JavaScriptObject getMap(Element element)/*-{ > var m = new $wnd.Mapstraction(element, 'google'); > m.resizeTo(400,400); > m.setMapType(1); > return m; > }-*/; > > protected native void resize(JavaScriptObject o, int w, int h) /*- > { > o.resizeTo(w-50,h-50); > }-*/; > > protected native void addControls(JavaScriptObject o) /*-{ > o.addLargeControls(); > }-*/; > } > > > Any ideas, guys? > > Best regards, > Sergey > > On 9 сент, 13:12, "Eric Ayers" <[EMAIL PROTECTED]> wrote: > > There is a method named 'checkResize()' which might help. > > > > Notifies the map of a change of the size of its container. Call this > method > > after the size of the container DOM object has changed, so that the > map can > > adjust itself to fit the new size. > > > > Call it after you attach you map to the DOM. I don't know why it > > would be needed in your case, but its helped in similar cases in the > > past. > > > > 2008/9/9 anglers <[EMAIL PROTECTED]>: > > > > > > > > > > > > > More correctly to use some DIV element, f.e. with name 'mapstraction', > > > and > > > use such code: > > > ... > > > JavaScriptObject jso = getMap(DOM.getElementById("mapstraction")); > > > ... > > > > > protected native JavaScriptObject getMap(Element element)/*-{ > > > var m = new $wnd.Mapstraction(element, 'google'); > > > m.resizeTo(400,400); > > > return m; > > > }-*/ > > > > > But it is not solves the problem. Just gray rectangle on the screen, > > > 400x400 px. > > > Does anybody know what is the reason of such map behavior? > > > > > Best regards > > > > > On 8 сент, 19:59, anglers <[EMAIL PROTECTED]> wrote: > > >> Hi all! > > > > >> I have some problem. > > >> I`m trying to get Mapstraction functionality in my GWT application. > > > > >> In my main module I use this code: > > >> ... > > >> VerticalPanel ccc = new VerticalPanel(); > > >> ccc.setWidth("500px"); > > >> ccc.setHeight("500px"); > > >> JavaScriptObject jso = getMap( ccc.getElement()); > > >> RootPanel.get().add(ccc); > > >> ... > > > > >> And JSNI function is: > > > > >> protected native JavaScriptObject getMap(Element element)/*-{ > > >> var m = new $wnd.Mapstraction(element, 'google'); > > >> m.resizeTo(400,400); > > >> return m; > > > > >> }-*/; > > > > >> In result I have grey rectangle on the screen, "Powered by Google" and > > >> "Terms of use" labels below. > > >> Map is not loaded, just grey area > > > > >> Does anybody know what`s problem? Help me please to resolve this > > > > >> Best regards > > >> Sergey > > > > -- > > Eric Z. Ayers - GWT Team - Atlanta, GA USAhttp:// > code.google.com/webtoolkit/ > > > -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
