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
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