Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

Tracking changes in some central database by multiple objects scattered around the program

Thread view: 
jb - 03 Jun 2006 12:04 GMT
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 {
  public void addActionListner(ActionListener foo){
     //* What to put here *//
  }

  public void changePartOfDatabase{
     /*....*/
     fireActionPerformed();
  }
}

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.
Andrew McDonagh - 03 Jun 2006 12:11 GMT
> 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.
[quoted text clipped - 3 lines]
> keywords so I could google for it, if there is not please tell me how
> to write such a thing by myself.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.