Is there some kind of a serialize feature supported for Tree widget
where all the nodes can be written to a DOM xml file?
Thanks!
Manny
the solution for you is to write custom data provider around your non-
parsed (but just loaded) xml data as data provider for your tree.
Currently GWT Tree widget does not have such functionality but that is
how Dojo/Ext widgets are build,
If you don't want to write your own provider that way (which could be
hard because will requires battling with Tree widget/TreeItems
widgets) you can look into GWT-EXT or MyGWT libraries which already do
that I believe,
hth,
regards,
Peter
The way I am loading the Tree data is from GWT-RPC. On the server-
side, I take my xml file, convert to String representation and send
the String back to the Client. In the client, I then XMLParse(string
xmlFile) it and for each NODE of type ELEMENT_NODE, I create a
TreeItem(), make it draggable, add it to the ParentNode() etc.
I'm using the dragndrop tree as per http://code.google.com/p/gwt-dnd-tree/.
I was hoping to somehow parse the Tree() created to create the XML
file, then send it as String to Server via GWT-RPC, convert String to
XML file and continue with my processing.
I hope this clarifies the use-case.
Thanks,
Manny
On Nov 14, 12:08 am, Peter Blazejewicz <peter.blazejew...@gmail.com>
wrote:
Manny
On Nov 14, 12:22 am, Manny <mna...@gmail.com> wrote:
> Hi Peter,
> Thanks for your suggestion. I'm not sure what you mean by a custom
> data provider though? Is this a Doc I create by traversing the Tree()
> widget? Or do I write some some custom code to create the XML file in
> the client? and how do you envision the custom data provider working?
> Best practices thoughts please!
>
> The way I am loading the Tree data is from GWT-RPC. On the server-
> side, I take my xml file, convert to String representation and send
> the String back to the Client. In the client, I then XMLParse(string
> xmlFile) it and for each NODE of type ELEMENT_NODE, I create a
> TreeItem(), make it draggable, add it to the ParentNode() etc.
> I'm using the dragndrop tree as perhttp://code.google.com/p/gwt-dnd-tree/.
ops, I see I guessed wrong what you want,
I though you have model (in xml) you want to tie with Tree,
e.g. see Tree widgets in mygwt:
http://www.mygwt.net/deploy/mygwt-0.3.0/explorer/
they have model,
you can in fact simply serialize your tree by writing custom widgets I
think:
#1
when you create tree/tree item each item store its node data (value of
data, without referencing to parent, siblings because that is
reflected within tree item structe itself)
#2
when you serialize tree you iterate through items using tree/tree item
methdos and simply create valid XML node String concataned with help
of StringBuffer to avoid all that XML code (which is something you can
avoid as much as possible),
just opinion, I think people already do that in various ways so stay
tuned on others posts,
regards,
Peter
On Nov 14, 6:22 am, Manny <mna...@gmail.com> wrote:
> Hi Peter,
> Thanks for your suggestion. I'm not sure what you mean by a custom
> data provider though? Is this a Doc I create by traversing the Tree()
> widget? Or do I write some some custom code to create the XML file in
> the client? and how do you envision the custom data provider working?
> Best practices thoughts please!
>
> The way I am loading the Tree data is from GWT-RPC. On the server-
> side, I take my xml file, convert to String representation and send
> the String back to the Client. In the client, I then XMLParse(string
> xmlFile) it and for each NODE of type ELEMENT_NODE, I create a
> TreeItem(), make it draggable, add it to the ParentNode() etc.
> I'm using the dragndrop tree as perhttp://code.google.com/p/gwt-dnd-tree/.