org.netbeans.modules.editor.lib/3 3.23.0 19

org.netbeans.editor
Class WeakEventListenerList

java.lang.Object
  extended by javax.swing.event.EventListenerList
      extended by org.netbeans.editor.WeakEventListenerList
All Implemented Interfaces:
Serializable

public class WeakEventListenerList
extends EventListenerList

Class that can hold the list of event listeners in a "weak" manner. The advantage is that the listener doesn't need to be explicitly removed. Because of the use of the WeakReference it gets forgotten automatically if it was garbage collected. There must be at least one non-weak reference to the listener (otherwise it would become garbage-collected). One of the ways is to store the listener in some instance variable in the class that adds the listener. Please note that the methods getListenerCount() and getListenerCount(Class t) give the count that doesn't reflect whether some listeners were garbage collected.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.event.EventListenerList
listenerList
 
Constructor Summary
WeakEventListenerList()
           
 
Method Summary
 void add(Class t, EventListener l)
          Adds the listener as a listener of the specified type.
 Object[] getListenerList()
           
 EventListener[] getListeners(Class t)
           
 void remove(Class t, EventListener l)
          Removes the listener as a listener of the specified type.
 String toString()
           
 
Methods inherited from class javax.swing.event.EventListenerList
getListenerCount, getListenerCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeakEventListenerList

public WeakEventListenerList()
Method Detail

getListenerList

public Object[] getListenerList()
Overrides:
getListenerList in class EventListenerList

getListeners

public EventListener[] getListeners(Class t)
Overrides:
getListeners in class EventListenerList

add

public void add(Class t,
                EventListener l)
Adds the listener as a listener of the specified type.

Overrides:
add in class EventListenerList
Parameters:
t - the type of the listener to be added
l - the listener to be added

remove

public void remove(Class t,
                   EventListener l)
Removes the listener as a listener of the specified type.

Overrides:
remove in class EventListenerList
Parameters:
t - the type of the listener to be removed
l - the listener to be removed

toString

public String toString()
Overrides:
toString in class EventListenerList

org.netbeans.modules.editor.lib/3 3.23.0 19

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.