org.ceryle.util.event
Class EventManager.EventDelegateImpl

java.lang.Object
  extended by org.ceryle.util.event.EventManager.EventDelegateImpl
All Implemented Interfaces:
EventDelegate
Enclosing class:
EventManager

public final class EventManager.EventDelegateImpl
extends Object
implements EventDelegate

Inner delegating class that manages event listener addition and removal. Classes that generate events can obtain an instance of this class from the EventManager and delegate responsibility to it. Interaction with this delegating class is done via the methods of the EventDelegate API.

Since:
2.4.20
Version:
$Revision: 1.2 $ $Date: 2007-06-15 12:09:58 $
Author:
Murray Altheim

Constructor Summary
protected EventManager.EventDelegateImpl(Object client)
          Constructor for an EventDelegateImpl, provided with the client Object it will service, or the Class of client, the latter when used to preload a future incoming delegate.
 
Method Summary
 boolean addChangeListener(ChangeListener listener)
          Adds listener as a listener for events fired by the EventDelegate.
 void fireEvent(ChangeEvent event)
          Notify all listeners having a registered interest in change events of the supplied ChangeEvent.
 Set getChangeListeners()
          Return an unmodifiable Set containing the ChangeListeners of this EventDelegateImpl.
protected  Class getClientClass()
          Returns the class of the client-less delegate, null if this delegate is attached to a client Object.
 boolean isListening()
          Returns true if there are one or more listeners registered with this instance.
 boolean removeChangeListener(ChangeListener listener)
          Removes listener from the EventDelegate.
protected  void setClient(Object client)
          Set this EventDelegateImpl's client Object to client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventManager.EventDelegateImpl

protected EventManager.EventDelegateImpl(Object client)
Constructor for an EventDelegateImpl, provided with the client Object it will service, or the Class of client, the latter when used to preload a future incoming delegate.

Method Detail

setClient

protected void setClient(Object client)
Set this EventDelegateImpl's client Object to client.


getClientClass

protected Class getClientClass()
Returns the class of the client-less delegate, null if this delegate is attached to a client Object.


getChangeListeners

public Set getChangeListeners()
Return an unmodifiable Set containing the ChangeListeners of this EventDelegateImpl. If there are no attached listeners, returns an empty Set rather than null.

Returns:
an unmodifiable Set containing this delegate's ChangeListeners
Throws:
UnsupportedOperationException - if any attempt is made to modify the Set

addChangeListener

public boolean addChangeListener(ChangeListener listener)
Adds listener as a listener for events fired by the EventDelegate.

Specified by:
addChangeListener in interface EventDelegate
Parameters:
listener - the ChangeListener to be added
Returns:
true if the listener was added (i.e., it was not already in the list and was added)

removeChangeListener

public boolean removeChangeListener(ChangeListener listener)
Removes listener from the EventDelegate.

Specified by:
removeChangeListener in interface EventDelegate
Parameters:
listener - the ChangeListener to be removed
Returns:
true if the listener was removed (i.e., it was actually in the list and was removed)

isListening

public boolean isListening()
Returns true if there are one or more listeners registered with this instance.

Specified by:
isListening in interface EventDelegate

fireEvent

public void fireEvent(ChangeEvent event)
Notify all listeners having a registered interest in change events of the supplied ChangeEvent.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.