Reputation: 15251
So far I have used dom4j's DefaultTreeModel to create a Jtree out of the xml file it reads.
The problem is that the Jtree doesn't refresh everytime the xml is changed, or a node is added or removed.
So far, it appears there is much plumbing code involved because there doesn't seem to be implementation of OnXmlChanged().
What other alternatives do I have of incorporating a visual tree xml swing component that also supports event firing upon change in the underlying xml file.
Upvotes: 1
Views: 518
Reputation: 28568
You can always fire these events your self when you know that something has changed, From DefaultTreeModel, use:
protected void fireTreeNodesChanged(Object source, Object[] path, int[] childIndices, Object[] children)
protected void fireTreeNodesInserted(Object source, Object[] path, int[] childIndices, Object[] children)
protected void fireTreeNodesRemoved(Object source, Object[] path, int[] childIndices, Object[] children)
protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children)
Upvotes: 2