tenspo / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

GeoMaps cashed when created #470

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
I am trying to use GeoMap in a GWT aplication.
When I tray to create a new GeoMap object I get the following exception:

19:43:08.381 [ERROR] [smartkpis] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): undefined is not a 
function
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.visualization.client.visualizations.GeoMap.createJso(GeoMap.java)
    at com.google.gwt.visualization.client.visualizations.Visualization.<init>(Visualization.java:62)
    at com.google.gwt.visualization.client.visualizations.Visualization.<init>(Visualization.java:68)
    at com.google.gwt.visualization.client.visualizations.GeoMap.<init>(GeoMap.java:137)
    at org.colombiamovil.smartkpi.client.ui.Infosee.buildUi(Infosee.java:37)
    at org.colombiamovil.smartkpi.client.ui.Infosee.access$0(Infosee.java:24)
    at org.colombiamovil.smartkpi.client.ui.Infosee$1.run(Infosee.java:18)
    at com.google.gwt.ajaxloader.client.ExceptionHelper.runProtected(ExceptionHelper.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Unknown Source)
///------------------------------------------------------------------

Here is my code:

public class Infosee extends VerticalPanel {
    public Infosee() {
        this.setSize("100%", "100%");
        Maps.loadMapsApi(
                "xxxxxKEYxxxxxxxxx",
                "2", false, new Runnable() {
                    public void run() {
                        buildUi();
                    }
                });

    }

    private void buildUi() {
        GeoMap.Options options = GeoMap.Options.create();
        options.setDataMode(DataMode.REGIONS);
        options.setHeight(600);
        options.setWidth(450);
        options.setShowLegend(true);
        options.setRegion("world");

        DataTable data = createDataTable();
        while(!Maps.isLoaded())
        {
            System.out.println("loading maps ... ");
        }
        GeoMap geoMap = new GeoMap(data, options);
        this.add(geoMap);

    }

    private DataTable createDataTable() {
        // Create a simple data table
        DataTable dataTable = DataTable.create();
        dataTable.addRows(7);
        dataTable.addColumn(ColumnType.STRING, "ADDRESS", "address");
        dataTable.addColumn(ColumnType.NUMBER, "SITES", "color");
        dataTable.setValue(0, 0, "Israel");
        dataTable.setValue(0, 1, 1);
        dataTable.setValue(1, 0, "United States");
        dataTable.setValue(0, 1, 2);
        dataTable.setValue(2, 0, "CH");
        dataTable.setValue(0, 1, 3);
        return dataTable;
    }
}

I have been searching for a log time but I don´t find any solution.
Could you please help me.

Thank you.

Original issue reported on code.google.com by dabeto@gmail.com on 14 Jun 2011 at 12:45

GoogleCodeExporter commented 9 years ago
I am using GWT 2.3.0 
on windows 7.

Thank you.

Original comment by dabeto@gmail.com on 14 Jun 2011 at 12:46

GoogleCodeExporter commented 9 years ago
(Infosee.java:37) is GeoMap geoMap = new GeoMap(data, options);

Thank you again

Original comment by dabeto@gmail.com on 14 Jun 2011 at 12:48

GoogleCodeExporter commented 9 years ago

Original comment by zundel@google.com on 28 Oct 2011 at 4:17

GoogleCodeExporter commented 9 years ago
I solved a similiar problem by loading in the GeoMap.PACKAGE during the on load 
call back

Original comment by willie.k...@gmail.com on 23 Nov 2011 at 7:03