KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > structural > StructuralEvent


1 package org.oddjob.structural;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.EventObject JavaDoc;
5
6 /**
7  * This event is fire by an implementer of the Strucutral interface when its
8  * strucuture changes.
9  *
10  * @author Rob Gordon
11  */

12 public class StructuralEvent extends EventObject JavaDoc
13         implements Serializable JavaDoc {
14
15     /** The child that has been added or just removed */
16     private final Object JavaDoc child;
17     
18     /** The position the child was added or removed (starting at 0). */
19     private final int index;
20     
21     /**
22      * Constructor.
23      *
24      * @param source The source of the event. Generally the parent.
25      * @param child The child object that has been added or removed.
26      * @param index The position where it was added or removed (starting at 0).
27      */

28     public StructuralEvent(Object JavaDoc source, Object JavaDoc child, int index) {
29         
30         super(source);
31         this.child = child;
32         this.index = index;
33     }
34     
35     /**
36      * Get the child.
37      *
38      * @return The child.
39      */

40     public Object JavaDoc getChild() {
41         
42         return this.child;
43     }
44     
45     /**
46      * Get the index.
47      *
48      * @return The index.
49      */

50     public int getIndex() {
51         
52         return this.index;
53     }
54 }
55
Popular Tags