Hello,
I have made an applet which creates a tree from a hashmap. I then use the awt dnd api to add drag and drop functionality to my tree. The user can drag drop stuff around and change the hierarchy structure. I am maintaining a list of the nodes that changed and use this for updating the DB. I want to add undo functionality to my drag drop operations. I tried to store the defaulttreemodel before every drag drop operation in a list and try to reload the last model at undo. This however does not work. I can also not think of a way to get the corresponding node in the tree based on the node i have saved in my list of changes. Can someone please me out?
example ..
<pre>
before change
Root
|_n1
| |_n2
| |_n3
|_n4
after change 1
Root
|_n1
| |_n2
|
|_n4
|_n3
change list -> (node n3, parent n4)
after change 2
Root
|_n1
|
|
|_n4
|_n3
|_n2
change list -> (node n3, parent n4),(node n2, parent n4)
when i undo once , I want to get the tree back to
Root
|_n1
| |_n2
|
|_n4
|_n3
</pre>
And so on ....
Thank you.
Regards,
Jenal
SCJP 1.4