How to build a ListModel for JList out of XML-Data (JAXP/DOM)??

T

Tobi Krausl

Hi!

I wrote an application which uses a class based upon JAXP/DOM to
manage some kind of status-information which is updated frequently.
I've named this class XMLTool. It contains methods to
insert/update/delete nodes in a DOM-Tree:

class XMLTool {
//Construct and handle DOM-Tree
public static boolean insertItem(...)
public static boolean updateItem(...)
public static boolean deleteItem(...)
....
}

Now I want that class to be the data-model for a JList used in my
gui-component. This means that the content displayed by a JList is
automatically updated when data in the DOM-Tree changes.

1. How can I handle that?
Do I just have to subclass AbstractListModel or is there anything else
to do?

2. How to organize the class-structure?
Should the XMLTool-class itself act as a ListModel like

class XMLTool extends AbstractListModel {
.....
implement XML-processing-logic as well as ListModel-logic?
.....
}

or should there be some kind of wrapper-class? If there should be a
wrapper, how should the class-structure look like?


Thank you,
Tobi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top