View Javadoc
1 /* 2 * EventSource.java 3 * 4 * Created on March 15, 2003, 12:53 AM 5 */ 6 7 package org.mrd.event; 8 9 import java.util.*; 10 /*** 11 * 12 * @author administrator 13 */ 14 public class ModelEventSource { 15 16 protected ArrayList listeners; 17 18 /*** Creates a new instance of EventSource */ 19 public ModelEventSource() { 20 listeners = new ArrayList(); 21 } 22 23 public void addListener(ModelEventListener l) { 24 listeners.add(l); 25 } 26 27 protected void fireModelEvent(EventObject event) { 28 synchronized (listeners) { 29 for (int i = 0; i < listeners.size(); i++) { 30 ModelEventListener l = (ModelEventListener)listeners.get(i); 31 l.fireModelEvent(event); 32 } 33 } 34 } 35 36 }

This page was automatically generated by Maven