On Tuesday, September 3, 2013 11:30:27 AM UTC+2, Harish Alwala wrote:
>
>
> Thanks for reply,
> Here I am attaching 3 classes.
> MyNode.java
>  This is a bean class that holds the data to display in the tree  
>
> MyTreeView.java
>  Here we build the tree and add the nodes to the tree. First time when I 
> build the treeView with data it invokes buildTree() where I call CellTree() 
> constructor with MyViewModel as parameter, that will invoke getNodeInfo() 
> (overidden method) of MyViewModel class. This is how I could able to see 
> the data in tree view. But when I try to add a new child to the tree, I 
> call the same flow, but it doesnot invoke the getNodeInfo() of the 
> MyViewModel class. Hence I dont see the updated tree.
>

What do you mean by "I call the same flow" ?

To update your tree, the NodeInfo has to call updateRowData/updateRowCount 
on the HasData passed to it. With a DefaultNodeInfo, you'd have to call 
updateRowData/updateRowCount of your AbstractDataProvider. With a 
ListDataProvider, this is done by modifying the list returned by the 
ListDataProvider's getList(); in case you modified the underlying list (in 
your case, not possible as you copy it into a new ArrayList) then you can 
call the ListDataProvider's refresh(), but as the javadoc tells you, you 
should prefer getList().

Think about a CellTree as if it was made of nested CellLists (that's more 
or less the case), each one's data being provided by the NodeInfo. You have 
to work with your tree of NodeInfo nodes or their ListDataProvider to 
update the tree. The way I do it is I keep a Map<MyNode, 
ListDataProvider<MyNode>>, and update the tree through the MyViewModel with 
methods like add(MyNode parent, MyNode child).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to