Re: Dynamically update TreeTable model
Hi i too am facing this problem. When i refresh the page the tree collapses to its original state. Please guide me how to solve this Thanks Prati CrocodileShoes wrote: > > I've finally got this working by extending DefaultTreeState and overriding > the isNodeSelected to calculate the selection based upon the wicket model > containing the data. This makes more sense since the tree's state is > representative of the actual data now! > -- View this message in context: http://old.nabble.com/Dynamically-update-TreeTable-model-tp21056846p27234506.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamically update TreeTable model
I've finally got this working by extending DefaultTreeState and overriding the isNodeSelected to calculate the selection based upon the wicket model containing the data. This makes more sense since the tree's state is representative of the actual data now! -- View this message in context: http://www.nabble.com/Dynamically-update-TreeTable-model-tp21056846p23220521.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamically update TreeTable model
Thanks for the info, James. I've read through the api and the tutorial on the sun site but am not much closer to finding a solution. Perhaps if I explain the full case somebody might have some advice. I'm also considering whether a tree is the best structure. I have a wicket model that wraps up a an object that has all the information to be displayed in the tree. It's easy enough to build a tree and display this to the user from this model. My problem is updating it after a user click. When a node is selected it triggers a data update from database which updates the object the wicket model wraps and therefore means the tree is completely different. It's exactly what happens when you narrow down your searches on an online store or ebay. So it's not a case of inserting or removing a node or two because typically the only node that stays the same is the selected one. James McLaughlin-3 wrote: > > You should not recreate the TreeModel and for most cases DefaultTreeModel > is > what you want. If you are adding a node, add it with: > > http://java.sun.com/javase/6/docs/api/javax/swing/tree/DefaultTreeModel.html#insertNodeInto(javax.swing.tree.MutableTreeNode,%20javax.swing.tree.MutableTreeNode,%20int) > > which will notify all the listeners, such as the wicket tree > > On Wed, Apr 22, 2009 at 10:56 AM, CrocodileShoes > wrote: > >> >> I have the same problem but with a different tree use case. I'm >> implementing >> a facet search which needs to update the tree after a user selects a tree >> node (facet). If I recreate the tree model like you were doing it >> doesn't >> persistent the selection, obviously. >> >> I'm not experienced with Swings trees but I think I may have to implment >> my >> own TreeModel. >> >> Does anybody have the solution for this? >> >> >> jchappelle wrote: >> > >> > I have a TreeTable and I have links within it. When a user clicks a >> link >> > they are presented with a modal window with a FileUpload component in >> it. >> > When they upload a new file and click close on the modal window, the >> > TreeTable is not updated. I tried to use a LoadableDetachableModel that >> > returns a DefaultTreeModel but if I do that then every time I click to >> > expand a folder node the tree refreshes the model and the tree state >> and >> > the icon doesn't expand(i'm guessing it's because the treestate gets >> > recreated?). >> > >> > I searched but couldn't find anyone with this specific problem in the >> > forum. Can someone please help? >> > >> > I am using wicket 1.3.4. >> > >> > Thanks, >> > >> > Josh >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Dynamically-update-TreeTable-model-tp21056846p23175533.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > > -- > Jim McLaughlin > Lead Software Engineer > Stonewater Control Systems > (o) 847.864.1060 x107 > (c) 773.416.0994 > > -- View this message in context: http://www.nabble.com/Dynamically-update-TreeTable-model-tp21056846p23213059.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamically update TreeTable model
You should not recreate the TreeModel and for most cases DefaultTreeModel is what you want. If you are adding a node, add it with: http://java.sun.com/javase/6/docs/api/javax/swing/tree/DefaultTreeModel.html#insertNodeInto(javax.swing.tree.MutableTreeNode,%20javax.swing.tree.MutableTreeNode,%20int) which will notify all the listeners, such as the wicket tree On Wed, Apr 22, 2009 at 10:56 AM, CrocodileShoes wrote: > > I have the same problem but with a different tree use case. I'm > implementing > a facet search which needs to update the tree after a user selects a tree > node (facet). If I recreate the tree model like you were doing it doesn't > persistent the selection, obviously. > > I'm not experienced with Swings trees but I think I may have to implment my > own TreeModel. > > Does anybody have the solution for this? > > > jchappelle wrote: > > > > I have a TreeTable and I have links within it. When a user clicks a link > > they are presented with a modal window with a FileUpload component in it. > > When they upload a new file and click close on the modal window, the > > TreeTable is not updated. I tried to use a LoadableDetachableModel that > > returns a DefaultTreeModel but if I do that then every time I click to > > expand a folder node the tree refreshes the model and the tree state and > > the icon doesn't expand(i'm guessing it's because the treestate gets > > recreated?). > > > > I searched but couldn't find anyone with this specific problem in the > > forum. Can someone please help? > > > > I am using wicket 1.3.4. > > > > Thanks, > > > > Josh > > > > -- > View this message in context: > http://www.nabble.com/Dynamically-update-TreeTable-model-tp21056846p23175533.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Jim McLaughlin Lead Software Engineer Stonewater Control Systems (o) 847.864.1060 x107 (c) 773.416.0994
Re: Dynamically update TreeTable model
I have the same problem but with a different tree use case. I'm implementing a facet search which needs to update the tree after a user selects a tree node (facet). If I recreate the tree model like you were doing it doesn't persistent the selection, obviously. I'm not experienced with Swings trees but I think I may have to implment my own TreeModel. Does anybody have the solution for this? jchappelle wrote: > > I have a TreeTable and I have links within it. When a user clicks a link > they are presented with a modal window with a FileUpload component in it. > When they upload a new file and click close on the modal window, the > TreeTable is not updated. I tried to use a LoadableDetachableModel that > returns a DefaultTreeModel but if I do that then every time I click to > expand a folder node the tree refreshes the model and the tree state and > the icon doesn't expand(i'm guessing it's because the treestate gets > recreated?). > > I searched but couldn't find anyone with this specific problem in the > forum. Can someone please help? > > I am using wicket 1.3.4. > > Thanks, > > Josh > -- View this message in context: http://www.nabble.com/Dynamically-update-TreeTable-model-tp21056846p23175533.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org