Tree with add/delete/edit nodes

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Tree with add/delete/edit nodes

NYSophia
I have searched the archive and the last time someone asked about this seems to be 2006.  We are new to wicket and were impressed with the Editable tree table example. We wanted to try to create a tree display that lets the users edit the nodes of the tree by adding a button to add a child node or delete a node.     I was wondering if anyone had accomplished this or attempted by found it problematic.  
Reply | Threaded
Open this post in threaded view
|

Re: Tree with add/delete/edit nodes

jomclaughlin
Hello,
I've just done this, works like a charm. Use a DefaultTreeModel for
your tree, and when it comes time to insert / remove nodes, just use
the appropriate methods on DefaultTreeModel. If you are doing this
with an ajax tree, you will want to call updateTree(AjaxRequestTarget)
after. If you are adding to a leaf node, you will want to call
getTreeState().expandNode(node) on the parent after the call on
DefaultTreeModel and before updateTree.

best,
jim

On 6/4/07, NYSophia <[hidden email]> wrote:

>
> I have searched the archive and the last time someone asked about this seems
> to be 2006.  We are new to wicket and were impressed with the Editable tree
> table example. We wanted to try to create a tree display that lets the users
> edit the nodes of the tree by adding a button to add a child node or delete
> a node.     I was wondering if anyone had accomplished this or attempted by
> found it problematic.
> --
> View this message in context: http://www.nabble.com/Tree-with-add-delete-edit-nodes-tf3866796.html#a10954856
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wicket-user
Reply | Threaded
Open this post in threaded view
|

Re: Tree with add/delete/edit nodes

evan2nave
Hi,
This sounds great.  Would you mind posting the java code and html file (or relevant snippets) for a page that accomplishes this?  I'm still very new to wicket, and the example would be very helpful!
Thanks,
-Evan

James McLaughlin-3 wrote
Hello,
I've just done this, works like a charm. Use a DefaultTreeModel for
your tree, and when it comes time to insert / remove nodes, just use
the appropriate methods on DefaultTreeModel. If you are doing this
with an ajax tree, you will want to call updateTree(AjaxRequestTarget)...
Reply | Threaded
Open this post in threaded view
|

Re: Tree with add/delete/edit nodes

jomclaughlin
I don't really have urls or code I can share. I do have a brain dead
simple quickstart I created to determine if a bug was in my code or
wicket (mine, obviously :)). Hope this helps:

http://bones.homelinux.org/wicket/quicktree.jar

You will want to look at SimpleTreePage.java

best,
jim

On 6/4/07, evan2nave <[hidden email]> wrote:

>
> Hi,
> This sounds great.  Would you mind posting the java code and html file (or
> relevant snippets) for a page that accomplishes this?  I'm still very new to
> wicket, and the example would be very helpful!
> Thanks,
> -Evan
>
>
> James McLaughlin-3 wrote:
> >
> > Hello,
> > I've just done this, works like a charm. Use a DefaultTreeModel for
> > your tree, and when it comes time to insert / remove nodes, just use
> > the appropriate methods on DefaultTreeModel. If you are doing this
> > with an ajax tree, you will want to call updateTree(AjaxRequestTarget)...
> >
>
> --
> View this message in context: http://www.nabble.com/Tree-with-add-delete-edit-nodes-tf3866796.html#a10956115
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wicket-user
Reply | Threaded
Open this post in threaded view
|

Re: Tree with add/delete/edit nodes

NYSophia
Thank you.  That was very helpful.  I am trying to get it to add a node as a child of the currently selected node.  I will let you know how it goes.

<quote author="James McLaughlin-3">
I don't really have urls or code I can share. I do have a brain dead
simple quickstart I created to determine if a bug was in my code or
wicket (mine, obviously :)). Hope this helps:

http://bones.homelinux.org/wicket/quicktree.jar

You will want to look at SimpleTreePage.java

best,
jim

Reply | Threaded
Open this post in threaded view
|

Re: Tree with add/delete/edit nodes

jomclaughlin
Hello,
You can do this through the ITreeState
(tree.getTreeState().getSelectedNodes ()). Also, you can register with
the TreeState as an ITreeStateListener and implement the
nodeSelected(TreeNode node) method.

best,
jim

On 6/6/07, NYSophia <[hidden email]> wrote:

>
> Thank you.  That was very helpful.  I am trying to get it to add a node as a
> child of the currently selected node.  I will let you know how it goes.
>
>
> I don't really have urls or code I can share. I do have a brain dead
> simple quickstart I created to determine if a bug was in my code or
> wicket (mine, obviously :)). Hope this helps:
>
> http://bones.homelinux.org/wicket/quicktree.jar
>
> You will want to look at SimpleTreePage.java
>
> best,
> jim
>
>
> --
> View this message in context: http://www.nabble.com/Tree-with-add-delete-edit-nodes-tf3866796.html#a10982905
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wicket-user