KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > util > prefs > NodeChangeEvent


1 /*
2  * @(#)NodeChangeEvent.java 1.6 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.util.prefs;
9
10 import java.io.NotSerializableException JavaDoc;
11
12 /**
13  * An event emitted by a <tt>Preferences</tt> node to indicate that
14  * a child of that node has been added or removed.<p>
15  *
16  * Note, that although NodeChangeEvent inherits Serializable interface from
17  * java.util.EventObject, it is not intended to be Serializable. Appropriate
18  * serialization methods are implemented to throw NotSerializableException.
19  *
20  * @author Josh Bloch
21  * @version $I$, $G$
22  * @see Preferences
23  * @see NodeChangeListener
24  * @see PreferenceChangeEvent
25  * @since 1.4
26  * @serial exclude
27  */

28
29 public class NodeChangeEvent extends java.util.EventObject JavaDoc {
30     /**
31      * The node that was added or removed.
32      *
33      * @serial
34      */

35     private Preferences JavaDoc child;
36
37     /**
38      * Constructs a new <code>NodeChangeEvent</code> instance.
39      *
40      * @param parent The parent of the node that was added or removed.
41      * @param child The node that was added or removed.
42      */

43     public NodeChangeEvent(Preferences JavaDoc parent, Preferences JavaDoc child) {
44     super(parent);
45     this.child = child;
46     }
47
48     /**
49      * Returns the parent of the node that was added or removed.
50      *
51      * @return The parent Preferences node whose child was added or removed
52      */

53     public Preferences JavaDoc getParent() {
54         return (Preferences JavaDoc) getSource();
55     }
56     
57     /**
58      * Returns the node that was added or removed.
59      *
60      * @return The node that was added or removed.
61      */

62     public Preferences JavaDoc getChild() {
63         return child;
64     }
65     
66     /**
67      * Throws NotSerializableException, since NodeChangeEvent objects are not
68      * intended to be serializable.
69      */

70      private void writeObject(java.io.ObjectOutputStream JavaDoc out)
71                                                throws NotSerializableException JavaDoc {
72          throw new NotSerializableException JavaDoc("Not serializable.");
73      }
74
75     /**
76      * Throws NotSerializableException, since NodeChangeEvent objects are not
77      * intended to be serializable.
78      */

79      private void readObject(java.io.ObjectInputStream JavaDoc in)
80                                                throws NotSerializableException JavaDoc {
81          throw new NotSerializableException JavaDoc("Not serializable.");
82      }
83
84     // Defined so that this class isn't flagged as a potential problem when
85
// searches for missing serialVersionUID fields are done.
86
private static final long serialVersionUID = 8068949086596572957L;
87 }
88
89
Popular Tags