1 |
/* EventObject.java - Represent events fired by objects. |
/* EventObject.java -- Represent events fired by objects |
2 |
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
43 |
/** |
/** |
44 |
* Represents Events fired by Objects. |
* Represents Events fired by Objects. |
45 |
* |
* |
46 |
|
* @author Eric Blake <ebb9@email.byu.edu> |
47 |
* @see EventListener |
* @see EventListener |
48 |
|
* @since 1.1 |
49 |
|
* @status updated to 1.4 |
50 |
*/ |
*/ |
51 |
public class EventObject implements Serializable |
public class EventObject implements Serializable |
52 |
{ |
{ |
53 |
|
/** |
54 |
|
* Compatible with JDK 1.1+. |
55 |
|
*/ |
56 |
private static final long serialVersionUID = 5516075349620653480L; |
private static final long serialVersionUID = 5516075349620653480L; |
57 |
|
|
58 |
|
/** |
59 |
|
* The source object; in other words, the object which this event takes |
60 |
|
* place on. |
61 |
|
*/ |
62 |
protected transient Object source; |
protected transient Object source; |
63 |
|
|
64 |
/** |
/** |
65 |
* Constructs an EventObject with the specified source. |
* Constructs an EventObject with the specified source. |
66 |
|
* |
67 |
|
* @param source the source of the event |
68 |
|
* @throws IllegalArgumentException if source is null (This is not |
69 |
|
* specified, but matches the behavior of the JDK) |
70 |
*/ |
*/ |
71 |
public EventObject(Object source) |
public EventObject(Object source) |
72 |
{ |
{ |
74 |
} |
} |
75 |
|
|
76 |
/** |
/** |
77 |
* @return The source of the Event. |
* Returns the source of the event. |
78 |
|
* |
79 |
|
* @return the event source |
80 |
*/ |
*/ |
81 |
public Object getSource() |
public Object getSource() |
82 |
{ |
{ |
84 |
} |
} |
85 |
|
|
86 |
/** |
/** |
87 |
* @return String representation of the Event. |
* Converts the event to a String. The format is not specified, but by |
88 |
* @override toString in class Object |
* observation, the JDK uses: |
89 |
|
* <code>getClass() + "[source=" + source + "]";</code>. |
90 |
|
* |
91 |
|
* @return String representation of the Event |
92 |
*/ |
*/ |
93 |
public String toString() |
public String toString() |
94 |
{ |
{ |
95 |
return this.getClass() + "[source=" + source.toString() + "]"; |
return getClass() + "[source=" + source + "]"; |
96 |
} |
} |
97 |
} |
} |