01: package org.acm.seguin.pmd.swingui.event;
02:
03: import org.acm.seguin.pmd.swingui.RulesTreeNode;
04:
05: import java.util.EventObject;
06: import java.util.Iterator;
07: import java.util.List;
08:
09: /**
10: *
11: * @author Donald A. Leckie
12: * @since December 13, 2002
13: * @version $Revision: 1.1 $, $Date: 2003/07/29 20:51:59 $
14: */
15: public class RulesEditingEvent extends EventObject {
16:
17: private RulesTreeNode m_dataNode;
18:
19: /**
20: *******************************************************************************
21: *
22: * @param source
23: * @param dataNode
24: */
25: private RulesEditingEvent(Object source, RulesTreeNode dataNode) {
26: super (source);
27:
28: m_dataNode = dataNode;
29: }
30:
31: /**
32: *******************************************************************************
33: *
34: * @return
35: */
36: public RulesTreeNode getDataNode() {
37: return m_dataNode;
38: }
39:
40: /**
41: *******************************************************************************
42: *
43: * @param source
44: */
45: public static final void notifySaveData(Object source,
46: RulesTreeNode dataNode) {
47: if ((source != null) && (dataNode != null)) {
48: RulesEditingEvent event = new RulesEditingEvent(source,
49: dataNode);
50: List listenerList = ListenerList
51: .getListeners(RulesEditingEventListener.class);
52: Iterator listeners = listenerList.iterator();
53:
54: while (listeners.hasNext()) {
55: RulesEditingEventListener listener;
56:
57: listener = (RulesEditingEventListener) listeners.next();
58: listener.saveData(event);
59: }
60: }
61: }
62:
63: /**
64: *******************************************************************************
65: *
66: * @param source
67: * @param dataNode
68: */
69: public static void notifyLoadData(Object source,
70: RulesTreeNode dataNode) {
71: if ((source != null) && (dataNode != null)) {
72: RulesEditingEvent event = new RulesEditingEvent(source,
73: dataNode);
74: List listenerList = ListenerList
75: .getListeners(RulesEditingEventListener.class);
76: Iterator listeners = listenerList.iterator();
77:
78: while (listeners.hasNext()) {
79: RulesEditingEventListener listener;
80:
81: listener = (RulesEditingEventListener) listeners.next();
82: listener.loadData(event);
83: }
84: }
85: }
86: }
|