KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ca > directory > jxplorer > event > JXplorerEvent


1 package com.ca.directory.jxplorer.event;
2
3 import java.util.EventObject JavaDoc;
4
5 /**
6  * The object that implements the <code>JXplorerListener</code> interface
7  * gets this <code>JXplorerEvent</code> when the event occurs.
8  *
9  * @see JXplorerListener
10  *
11  * @author Chris Betts
12  */

13  
14 public class JXplorerEvent extends EventObject JavaDoc {
15
16     
17     /**
18      * The user selected DN being passed back in this event.
19      * @see getDN()
20      */

21      
22     private String JavaDoc DN;
23     private EventType type;
24
25
26     /**
27      * Constructs a <code>JXplorerEvent</code> object.
28      *
29      * @param source the object that originated the event
30      * @param id an integer that identifies the event
31      * @param command a string that may specify a command (possibly one
32      * of several) associated with the event
33      */

34     public JXplorerEvent(Object JavaDoc source, EventType type, String JavaDoc DN)
35     {
36         super(source);
37         this.type = type;
38         this.DN = DN;
39     }
40
41
42     /**
43      * Returns the current DN.
44      *
45      * @return the selected DN (or null if none selected)
46      */

47     public String JavaDoc getDN() {
48         return DN;
49     }
50
51
52     /**
53      * Gets the type of event.
54      *
55      * @return the type
56      */

57     public EventType getEventType()
58     {
59         return type;
60     }
61
62    
63     /**
64      * Defines the ENTERED, EXITED, and ACTIVATED event types, along
65      * with their string representations, returned by toString().
66      */

67     public static final class EventType
68     {
69         private String JavaDoc typeString;
70
71         private EventType(String JavaDoc s)
72         {
73             typeString = s;
74         }
75
76         /**
77          * Entered type.
78          */

79         public static final EventType DNSELECTED = new EventType("DNSELECTED");
80
81         /**
82          * Converts the type to a string.
83          *
84          * @return the string
85          */

86         public String JavaDoc toString()
87         {
88             return typeString;
89         }
90
91     }
92
93
94 }
Popular Tags