org.PingOO.DLAI.lib.PWidget.event
Class PEventListenerList

java.lang.Object
  |
  +--org.PingOO.DLAI.lib.PWidget.event.PEventListenerList

public final class PEventListenerList
extends java.lang.Object

Manages a shared list of PListeners.
Inspired by javax.swing.evet.EventListenerList.java, but it does not extend it for performance reasons.
The included PListenersList is also shared by all PComponents.

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)
See Also:
EventListenerList

Field Summary
private static PListener[] listenerList
          The list of PListeners.
 
Constructor Summary
PEventListenerList()
          Creates a new PEventListenerList.
 
Method Summary
 void add(PListener listener)
          Adds the specified listener to the list.
 int getListenerCount()
          Returns the total number of listeners for this listenerlist.
 PListener[] getListenerList()
          This passes back the event listener list as an array of PListener.
 void remove(PListener listener)
          Removes the specified listener from the list.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

listenerList

private static PListener[] listenerList
The list of PListeners.
Constructor Detail

PEventListenerList

public PEventListenerList()
Creates a new PEventListenerList.
Method Detail

getListenerList

public PListener[] getListenerList()
This passes back the event listener list as an array of PListener.
Note that for performance reasons, this implementation passes back the actual data structure in which the listner data is stored internally!
This method is guaranteed to pass back a non-null array, so that no null-checking is required in fire methods.
A zero-length array of Object should be returned if there are currently no listeners.

WARNING!!! Absolutely NO modification of the data contained in this array should be made.
if any such manipulation is necessary, it should be done on a copy of the array returned rather than the array itself.

Returns:
The PListener array.

getListenerCount

public final int getListenerCount()
Returns the total number of listeners for this listenerlist.
Returns:
The total number of listeners for this listenerlist.

add

public final void add(PListener listener)
Adds the specified listener to the list.
Parameters:
listener - The listener to be added.

remove

public final void remove(PListener listener)
Removes the specified listener from the list.
Parameters:
listener - The listener to be removed.