1 package org.apache.beehive.controls.runtime.bean; 2 19 20 import java.util.ArrayList ; 21 import java.util.Iterator ; 22 23 27 public class EventNotifier implements java.io.Serializable 28 { 29 32 synchronized public void addListener(Object listener) 33 { 34 _listeners.add(listener); 35 } 36 37 40 synchronized public void removeListener(Object listener) 41 { 42 if (!_listeners.contains(listener)) 43 throw new IllegalStateException ("Invalid listener, not currently registered"); 44 45 _listeners.remove(listener); 46 } 47 48 51 public Iterator listenerIterator() 52 { 53 return _listeners.iterator(); 54 } 55 56 59 public int getListenerCount() 60 { 61 return _listeners.size(); 62 } 63 64 67 public void getListeners(Object [] listeners) 68 { 69 _listeners.toArray(listeners); 70 } 71 72 private ArrayList _listeners = new ArrayList (); 73 } 74 | Popular Tags |