Hi John, I missed the information about the meaning of TreeViewModel#isLeaf(). I ran into problem with it yesterday.
Thanks Rodrigue On Thu, Nov 4, 2010 at 3:27 PM, John LaBanca <[email protected]> wrote: > You have two options, but first its important to point out that "leaf" is > not the same as "empty". If you have a folder that may or may not have > children, TreeViewModel#isLeaf() should return false, meaning that the node > is not a leaf. When the user opens thenode, one of the following can > happen. > > - You return a DataProvider with some data, in which case the children > are rendered > - You return a DataProvider without data, in which case the node > "opens", but a message is displayed that the node is empty > - You return a null NodeInfo, in which case the node is treated as a > leaf > > In the second option, you can still push data (such as the first child) to > the node, and it will render them. For example, if you return an empty > ListDataProvider, then add items to the underlying list, the nodes will show > up. If you use the other two options, you need to rerender the parent nodes > so that the Tree will call TreeViewModel#isLeaf() again. > > There is no correct answer; its just a matter of user interaction. You can > consider a folder to be a leaf, in which case it cannot be opened (no open > icon). Or, you can consider a folder to be a non-leaf even if it is empty. > Note that at the moment, the "no data" message is fixed, but we can > probably make that a Cell so you could add a button such as "Create New > Folder". > > Thanks, > John LaBanca > [email protected] > > > > On Thu, Nov 4, 2010 at 3:51 AM, Ståle Undheim <[email protected]> wrote: > >> I am using the new GWT 2.1 CellTree to display a list of folders. From >> the UI I support adding child folders to a folder in the tree. The >> problem is, I don't know how to fire events or update the tree so that >> if I add a child to a leaf node, it's converted to a non-leaf node. >> >> Do I need to refresh the data on the parent of the node that got a >> child added? >> >> -- >> 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]<google-web-toolkit%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/google-web-toolkit?hl=en. >> >> > -- > 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]<google-web-toolkit%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > -- 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.
