Re: Tracking changes in some central database by multiple objects scattered around the program
- From: Andrew McDonagh <news@xxxxxxxxx>
- Date: Sat, 03 Jun 2006 12:11:00 +0100
jb wrote:
Hi!
I've been writing a program that operates on small hand-made database.
And I would like other objects to track changes in this database
possibly in the swing way i.e:
class DataBase {
private List listeners =new ArrayList();
public void addActionListner(ActionListener foo){
listeners.put(foo);
}
public void changePartOfDatabase{
fireActionPerformed();
}
private void fireActionPerformed() {
for (int index = 0; index < listeners.length(); index++) {
ActionListener listener = (ActionListener)listeners.get(index);
listener.actionPerformed();
}
}
}
.
Other objects interested in tracking changes would just add new
Listener.
I suspect that there is a class from I could inherit such functions -
but I hadn't been able to find it. ;-(. If there is please drop me some
keywords so I could google for it, if there is not please tell me how
to write such a thing by myself.
- References:
- Prev by Date: Tracking changes in some central database by multiple objects scattered around the program
- Next by Date: wscompile/soap problem
- Previous by thread: Tracking changes in some central database by multiple objects scattered around the program
- Next by thread: wscompile/soap problem
- Index(es):
Relevant Pages
|