Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

find org.jdom.Element in JTree

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys
In my app I have org.jdom.Element that comes from xml SAX parser,
And swing JTree ,
(the SAX parser is parsing the same XML of the JTree)

Is there any convenient way I can locate the Element in the JTree
Besides trying to recursively iterate the JTree model ?

If it was DefaultMutableTreeNode I could call currentNode.getPath()
And then get the TreeNode[] or TreePath

Thank you very much
Sharon
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jdom seems stopped development

jdom-1.0.tar.gz 09-Sep-2004

It is probably the time to consider switch API...
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just had a quick look at the documentation. I would say, you don't have to recursively iterate the tree because JDOM has a method (getDescendants) that does that for you. And you could pass it a Filter -- most likely an ElementFilter -- that would just choose the Element(s) you were looking for.
 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response ,

can I get JTree Element directly by providing TreePath object to the JTREE ?
say the tree is :


and i want to get the JTree element at : ["Cars" , "Volvo" , "s80" , "16v 2500"]
?
Thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"sharon pl",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>FYI
>>Sorry, that member's private message mailbox is currently full. Please >>try sending your private message another time.
>>� http://www.javaranch.com

Hi Bear ,
please empty your inbox
Sharon
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic