Hi

I would like to add visualization support via the Google Visualization
API (1.1) to an existing GWT (2.1.1) and smartGWT (2.4) application.

I followed the approach described in this post ->
http://forums.smartclient.com/showpost.php?p=37754&postcount=2 and the
Visualization Getting Started guide->
http://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted.

And, then found this post ->
http://groups.google.com/group/google-visualization-api/browse_thread/thread/ff89e49ecf52fd4/69b7bfd3d4042526?lnk=gst&q=smartGWT#69b7bfd3d4042526
in the Google Visualization API discussion group.

For example:

->

  public void loadVisualizationApi() {

    Log.debug("loadVisualizationApi()");

    // Create a callback to be called when the visualization API
    // has been loaded.
    Runnable onLoadCallback = new Runnable() {
      public void run() {

        Log.debug("onLoadCallback()");

        // Create a pie chart visualization.
        pie = new PieChart(createTable(), createOptions());
        pie.setWidth("80%");

        Canvas canvas = new Canvas();
        canvas.setID("sys_pie_canvas");
        canvas.setWidth100();
        canvas.setHeight("50%");
        canvas.addChild(pie);

        panel.addMember(canvas, 0);

        Log.debug("panel.addMember(canvas, 0)");
      }
    };

    // Load the visualization api, passing the onLoadCallback
    // to be called when loading is complete.
    VisualizationUtils.loadVisualizationApi("1.1", onLoadCallback,
        PieChart.PACKAGE);
  }

  // The code for createTable() and createOptions()) is as per
  // the post mentioned above.

->

However, this results in the following error:
java.lang.AssertionError: A widget that has an existing parent widget
may not be added to the detach list at
com.google.gwt.user.client.ui.RootPanel.detachOnWi
ndowClose(RootPanel.java:136) when using GWT (2.1.1), smartGWT LGPL
(2.5 nightly build) and Google Visualization API (1.1).

Note: I also tested the code using smartGWT (2.4) and received the
following error: (NativeMethodAccessorImpl.java:-2) 2011-05-09
10:26:21,613 [FATAL] Uncaught JavaScript exception [Script error.]
in , line 0

If I comment out the call to "panel.addMember(pie)" and replace it
with "RootPanel.get().add(pie)" no exception is thrown and the "chart"
is rendered correctly (you can see it momentarily if you re-size the
browser window) but as a child of the root panel. Which means it is
hidden by the application's other nested layout containers (e.g.
North, West, East and South).

I would like to be able to place the "chart" in a nested layout
container if possible?

The stack trace:

->

16:13:50.134 [ERROR] [serendipity] (ExceptionHelper.java:38)
2011-05-08 16:13:50,134 [FATAL] Uncaught Exception:

java.lang.AssertionError: A widget that has an existing parent widget
may not be added to the detach list
    at
com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose(RootPanel.java:
136)
    at com.google.gwt.user.client.ui.RootPanel.get(RootPanel.java:211)
    at
com.smartgwt.client.widgets.WidgetCanvas.onDraw(WidgetCanvas.java:39)
    at com.smartgwt.client.widgets.BaseWidget.rendered(BaseWidget.java:
242)
    at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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:
157)
    at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
    at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
    at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
126)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
289)
    at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
107)
    at
com.smartgwt.client.widgets.layout.Layout.addMemberPostCreate(Layout.java)
    at com.smartgwt.client.widgets.layout.Layout.addMember(Layout.java:
1089)
    at com.smartgwt.client.widgets.layout.Layout.addMember(Layout.java:
1076)
    at au.com.uptick.serendipity.client.sales.view.DashboardsView
$1.run(DashboardsView.java:76)
    at
com.google.gwt.ajaxloader.client.ExceptionHelper.runProtected(ExceptionHelper.java:
36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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:
157)
    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(Thread.java:619)

->

Cheers
Rob

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" 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-visualization-api?hl=en.

Reply via email to