1 15 package hivemind.test.services; 16 17 import java.beans.PropertyChangeEvent ; 18 import java.beans.PropertyChangeListener ; 19 import java.beans.PropertyChangeSupport ; 20 21 26 public class EventProducer 27 { 28 private PropertyChangeSupport _support = new PropertyChangeSupport (this); 29 private int _count = 0; 30 31 public void addPropertyChangeListener(PropertyChangeListener listener) 32 { 33 _support.addPropertyChangeListener(listener); 34 35 _count++; 36 } 37 38 public void removePropertyChangeListener(PropertyChangeListener listener) 39 { 40 _support.removePropertyChangeListener(listener); 41 42 _count--; 43 } 44 45 public void fire(PropertyChangeEvent event) 46 { 47 _support.firePropertyChange(event); 48 } 49 50 public int getListenerCount() 51 { 52 return _count; 53 } 54 55 public String toString() 56 { 57 return "EventProducer"; 58 } 59 } 60 | Popular Tags |