suppose we have the following tree:
+--home
+--section1
+--section2
+--section3
+--section4If the user selects the section4 node, you should be able to access to its parent, section2, and from section2, to the 'home' node
so if we store all the parents in a list, we should have this:
section4, section2, home
eventually, if we reverse this list, we would get the whole path to the selected node: home, section2, section4
without being able to access to the parent nodes, we could do it searching through the whole tree, but it would be slower
bye
Sean Schofield wrote:
Borja,
getPathInformation might be a possibility for you although it requires a specific node id. Its also not currently available to your JSP code.
I don't understand what you mean by accessing the parent node and then reversing the path. What is the end result you are looking for? Do you want the id of each node in the path?
I would like to understand your requirements a little bit more before I think about how we might be able to address them.
sean
On Fri, 18 Mar 2005 19:44:47 +0100, Borja Mart�n <[EMAIL PROTECTED]> wrote:
I built a section menu and would like to get the whole path of the selected section. It is quite easy if you can access the parent node and then reversing the path. I have seen the getPathInformation method, but I only returns the nodes ids...
Sean Schofield wrote:
Just curious, why do you feel that is needed? What are you planning on using it for?
sean
On Fri, 18 Mar 2005 19:21:11 +0100, Borja Mart�n <[EMAIL PROTECTED]> wrote:
hi, I would suggest the method getParent in the TreeBaseNode as the DefaultMutableTreeNode class had, in order to get the parent node of the given one
bye

