[XOM-interest] Node.getParent() swing.tree.TreeNode.getParent() collision

Grant Wood grant at nanode.org
Wed Apr 30 19:12:43 EDT 2008


Hello,

I'm trying to use a XOM Document as a TreeModel for a swing application.

To do this, I have extended Element  to implement  swing's TreeModel,  
Mutable TreeNode and TreeNode.

problem is, javax.swing.tree.TreeNode requires:

	public TreeNode getParent()

Which causes a conflict with nu.xom.Node in which getParent() is  
final.  This makes perfect sense, and i'm just sorry I hadn't realized  
this conflict sooner.

Previously, this same XML data tree was being rendered using a JList  
and an Element implementing the ListModel interface, which worked  
great, but will require an unnecessarily complicated ListCellRenderer  
to do what I'm am trying to do next.  I decided to implement the same  
interface using a JTree to simplify a few things for myself, but have  
now run into this conflict.

I've searched through the mail archive looking for anyone who has run  
into this before but haven't found anything.

What is are suggestions for using XOM with JTree or working around  
conflicts like this?

Thanks for your suggestions, I apologize if there is a example or  
thread that I missed which discusses this.


-Grant Wood


More information about the XOM-interest mailing list