* use the default documentation from implemented interface.
*/
public void addListener(Class eventType, Object object, Method method) {
-
- if (listenerList == null) {
- listenerList = Collections.synchronizedSet(new LinkedHashSet());
- }
-
synchronized (listenerList) {
+ if (listenerList == null) {
+ listenerList = Collections.synchronizedSet(new LinkedHashSet());
+ }
listenerList.add(new ListenerMethod(eventType, object, method));
}
}
* here, we use the default documentation from implemented interface.
*/
public void addListener(Class eventType, Object object, String methodName) {
-
- if (listenerList == null) {
- listenerList = Collections.synchronizedSet(new LinkedHashSet());
- }
-
synchronized (listenerList) {
+ if (listenerList == null) {
+ listenerList = Collections.synchronizedSet(new LinkedHashSet());
+ }
listenerList.add(new ListenerMethod(eventType, object, methodName));
}
}
* interface.
*/
public void removeListener(Class eventType, Object target) {
- if (listenerList != null) {
- synchronized (listenerList) {
+ synchronized (listenerList) {
+ if (listenerList != null) {
final Iterator i = listenerList.iterator();
while (i.hasNext()) {
try {
* implemented interface.
*/
public void removeListener(Class eventType, Object target, Method method) {
-
- if (listenerList != null) {
- synchronized (listenerList) {
+ synchronized (listenerList) {
+ if (listenerList != null) {
final Iterator i = listenerList.iterator();
while (i.hasNext()) {
try {
throw new IllegalArgumentException();
}
- // Remove the listeners
- if (listenerList != null) {
- synchronized (listenerList) {
+ synchronized (listenerList) {
+ // Remove the listeners
+ if (listenerList != null) {
final Iterator i = listenerList.iterator();
while (i.hasNext()) {
try {
}
}
}
+
}
/**
* the Event to be sent to all listeners.
*/
public void fireEvent(EventObject event) {
- // It is not necessary to send any events if there are no listeners
- if (listenerList != null) {
- // Send the event to all listeners. The listeners themselves
- // will filter out unwanted events.
- synchronized (listenerList) {
+ synchronized (listenerList) {
+ // It is not necessary to send any events if there are no listeners
+ if (listenerList != null) {
+ // Send the event to all listeners. The listeners themselves
+ // will filter out unwanted events.
+
final Iterator i = listenerList.iterator();
while (i.hasNext()) {
((ListenerMethod) i.next()).receiveEvent(event);