So I have some experience with building a tree from an RPC call.
I had a similar problem with serializing a nested HashMap. So what i
ended up doing was using the apache betwixt libabry to turn the nested
hashmap into an XML document, transferring the xml over to the client
and then parsing rebuilding the hashmap on the client side from the
xml. The entire process was extremely fast.
The problem was after having populated the HashMap on the client side
then populating the tree with this HashMap, the tree creation process
in GWT is extremely slow, and i have mentioned it to Joel at the GWT
Conference. To overcome that I created my own tree widget from a
composite, that has three widgets at each node, one label for the
"+"/"-" sign, one label for the actual text and a hidden sub-panel for
holding the children.
There was another problem, I needed to maintain the order of the nodes
in the HashMap to be the same in the client and the server, however as
you might know, the order of the HashMap elements is not guaranteed to
be preserved, there is a java.util.LinkedHashMap to solve this
problem, but it is not supported under GWT :-(
So i ended up creating my own implementation using nested ArrayLists
and then serializing that using the betwixt library to convert it to
XML, then rebuild the nested ArrayList on the client side from the
XML.
After having done all of this, the performance is great, now i need to
do more customization, like implementing partially expanded tree,
multi-select etc.
I am also looking into using some libraries like mygwt or gwt-ext.
they give most of the functionality i need and the speed of rendering
the tree with those libraries is pretty fast, i might still have to
tweak them a little bit more to do exactly what i want the tree
control to do.
Hope this helps
-Sachin
> > com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.jav-a:
> > 137)
> > at
> > org.systemsbiology.GWAP.client.PersistenceService_TypeSerializer.deserializ-e(PersistenceService_TypeSerializer.java:
> > 194)
> > at
> > com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deseria-lize(ClientSerializationStreamReader.java:
> > 94)
> > at
> > com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readO-bject(AbstractSerializationStreamReader.java:
> > 61)
> > at org.systemsbiology.GWAP.client.PersistenceService_Proxy
> > $7.onCompletionImpl(PersistenceService_Proxy.java:425)
> > at org.systemsbiology.GWAP.client.PersistenceService_Proxy
> > $7.onCompletionAndCatch(PersistenceService_Proxy.java:414)
> > at org.systemsbiology.GWAP.client.PersistenceService_Proxy
> > $7.onCompletion(PersistenceService_Proxy.java:408)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp-l.java:
> > 25)
> > at java.lang.reflect.Method.invoke(Method.java:585)
> > at
> > com.google.gwt.dev.shell.mac.MethodDispatch.invoke(MethodDispatch.java:
> > 74)
> > at org.eclipse.swt.internal.carbon.OS.ReceiveNextEvent(Native Method)
> > at org.eclipse.swt.widgets.Display.sleep(Display.java:3801)
> > at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:690)
> > at com.google.gwt.dev.GWTShell.run(GWTShell.java:550)
> > at com.google.gwt.dev.GWTShell.main(GWTShell.java:321)
> > com.google.gwt.core.client.JavaScriptException: JavaScript RangeError
> > exception: Maximum call stack size exceeded.
> > at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
> > 481)
> > at
> > com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
> > 270)
> > at
> > com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.jav-a:
> > 137)
> > at
> > org.systemsbiology.GWAP.client.PersistenceService_TypeSerializer.deserializ-e(PersistenceService_TypeSerializer.java:
> > 194)
> > at
> > com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deseria-lize(ClientSerializationStreamReader.java:
> > 94)
> > at
> > com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readO-bject(AbstractSerializationStreamReader.java:
> > 61)
> > at org.systemsbiology.GWAP.client.PersistenceService_Proxy
> > $7.onCompletionImpl(PersistenceService_Proxy.java:425)
> > at org.systemsbiology.GWAP.client.PersistenceService_Proxy
> > $7.onCompletionAndCatch(PersistenceService_Proxy.java:414)
> > at org.systemsbiology.GWAP.client.PersistenceService_Proxy
> > $7.onCompletion(PersistenceService_Proxy.java:408)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp-l.java:
> > 25)
> > at java.lang.reflect.Method.invoke(Method.java:585)
> > at
> > com.google.gwt.dev.shell.mac.MethodDispatch.invoke(MethodDispatch.java:
> > 74)
> > at org.eclipse.swt.internal.carbon.OS.ReceiveNextEvent(Native Method)
> > at org.eclipse.swt.widgets.Display.sleep(Display.java:3801)
> > at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:690)
> > at com.google.gwt.dev.GWTShell.run(GWTShell.java:550)
> > at com.google.gwt.dev.GWTShell.main(GWTShell.java:321)- Hide quoted text -
>
> - Show quoted text -