Hi Nick,
I would use an other data structure.
class Item {
int nodeId;
int parentId;
String name;
// .. more Data
}
class TreeData extends ArrayList<Item> implements IsSerialisable {}
or
class TreeData implements IsSerialisable {
public ArrayList<Item> items;
}
And you should asure that a parent appear before its children.
If you like you may remove nodeId and substitue it by the index.
Stefan Bachert
http://gwtworld.de
On Jul 2, 8:39 am, Nick <[email protected]> wrote:
> I'm trying to populate a TreeView by making an RPC call to my server.
> It makes sense (to me) to represent the data using some sort of nested
> Collection. I've been unsuccessful after trying 2 approaches:
>
> class MyMap extends TreeMap<String, MyMap> implements IsSerialisable
> {}
>
> and
>
> class MyTree implements IsSerialisable {
> String branchName;
> String level;
> String ArrayList<MyTree> branches;
>
> }
>
> When the server-side tree is populated (with several branches and
> levels), the RPC data looks something like the sample below. I would
> have expected to see a lot more Strings and nested maps/arraylists.
> (I'm using GWT 2.1.0.M1)
>
> //
> OK[0,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,3,3,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,3,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,3,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,3,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,3,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,3,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,3,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,3,3,3,3,3,3,0,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,9,2,0,1,
> ["MyTree/3187669128","java.util.ArrayList/3821976829","DEBUG"],0,5]
--
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.