01: package org.acm.seguin.pmd.swingui.event;
02:
03: import java.util.EventObject;
04: import java.util.Iterator;
05: import java.util.List;
06:
07: public class TextAnalysisResultsEvent extends EventObject {
08: private String m_text;
09:
10: /**
11: *****************************************************************************
12: *
13: * @param source
14: */
15: private TextAnalysisResultsEvent(Object source) {
16: super (source);
17: }
18:
19: /**
20: *****************************************************************************
21: *
22: * @param source
23: * @param text
24: */
25: private TextAnalysisResultsEvent(Object source, String text) {
26: super (source);
27:
28: m_text = text;
29: }
30:
31: /**
32: *****************************************************************************
33: *
34: * @return
35: */
36: public String getText() {
37: return m_text;
38: }
39:
40: /**
41: *****************************************************************************
42: *
43: * @param source
44: */
45: public static final void notifyRequestText(Object source) {
46: TextAnalysisResultsEvent event = new TextAnalysisResultsEvent(
47: source);
48: List listenerList = ListenerList
49: .getListeners(TextAnalysisResultsEventListener.class);
50: Iterator listeners = listenerList.iterator();
51:
52: while (listeners.hasNext()) {
53: TextAnalysisResultsEventListener listener;
54:
55: listener = (TextAnalysisResultsEventListener) listeners
56: .next();
57: listener.requestTextAnalysisResults(event);
58: }
59: }
60:
61: /**
62: *****************************************************************************
63: *
64: * @param source
65: */
66: public static final void notifyReturnedText(Object source,
67: String htmlText) {
68: TextAnalysisResultsEvent event = new TextAnalysisResultsEvent(
69: source, htmlText);
70: List listenerList = ListenerList
71: .getListeners(TextAnalysisResultsEventListener.class);
72: Iterator listeners = listenerList.iterator();
73:
74: while (listeners.hasNext()) {
75: TextAnalysisResultsEventListener listener;
76:
77: listener = (TextAnalysisResultsEventListener) listeners
78: .next();
79: listener.returnedTextAnalysisResults(event);
80: }
81: }
82: }
|