1 29 30 package nextapp.echo2.app.text; 31 32 import java.io.Serializable ; 33 import java.util.EventListener ; 34 35 import nextapp.echo2.app.event.DocumentEvent; 36 import nextapp.echo2.app.event.DocumentListener; 37 import nextapp.echo2.app.event.EventListenerList; 38 39 43 public abstract class AbstractDocument 44 implements Document, Serializable { 45 46 49 protected EventListenerList listenerList = new EventListenerList(); 50 51 54 public AbstractDocument() { 55 super(); 56 } 57 58 65 public void addDocumentListener(DocumentListener l) { 66 listenerList.addListener(DocumentListener.class, l); 67 } 68 69 74 public void fireDocumentUpdate(DocumentEvent e) { 75 EventListener [] listeners = listenerList.getListeners(DocumentListener.class); 76 77 for (int index = 0; index < listeners.length; ++index) { 78 ((DocumentListener) listeners[index]).documentUpdate(e); 79 } 80 } 81 82 89 public void removeDocumentListener(DocumentListener l) { 90 listenerList.removeListener(DocumentListener.class, l); 91 } 92 } 93 | Popular Tags |