KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > util > EventListenerProxy


1 /*
2  * @(#)EventListenerProxy.java 1.5 04/01/12
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;
9
10 /**
11  * An abstract wrapper class for an EventListener class which associates a set
12  * of additional parameters with the listener. Subclasses must provide the
13  * storage and accessor methods for the additional arguments or parameters.
14  *
15  * Subclasses of EventListenerProxy may be returned by getListeners() methods
16  * as a way of associating named properties with their listeners.
17  *
18  * For example, a Bean which supports named properties would have a two
19  * argument method signature for adding a PropertyChangeListener for a
20  * property:
21  *
22  * public void addPropertyChangeListener(String propertyName,
23  * PropertyChangeListener listener);
24  *
25  * If the Bean also implemented the zero argument get listener method:
26  *
27  * public PropertyChangeListener[] getPropertyChangeListeners();
28  *
29  * then the array may contain inner PropertyChangeListeners which are also
30  * PropertyChangeListenerProxy objects.
31  *
32  * If the calling method is interested in retrieving the named property then it
33  * would have to test the element to see if it is a proxy class.
34  *
35  * @since 1.4
36  */

37 public abstract class EventListenerProxy implements EventListener JavaDoc {
38     private final EventListener JavaDoc listener;
39
40     /**
41      * @param listener The listener object.
42      */

43     public EventListenerProxy(EventListener JavaDoc listener) {
44         this.listener = listener;
45     }
46
47     /**
48      * @return The listener associated with this proxy.
49      */

50     public EventListener JavaDoc getListener() {
51         return listener;
52     }
53 }
54
Popular Tags