FreeHEP API
Version current

org.freehep.record.loop.event
Class ChainableRecordListenerDecorator

java.lang.Object
  extended byorg.freehep.record.loop.event.ChainableRecordAdapter
      extended byorg.freehep.record.loop.event.ChainableRecordListenerDecorator
All Implemented Interfaces:
ChainableRecordListener, EventListener, RecordListener, RecordListenerManager

public class ChainableRecordListenerDecorator
extends org.freehep.record.loop.event.ChainableRecordAdapter

This class decorates an RecordListener object so that the methods of another RecordListener object are executed in succession to its own method, thus creating a chain of listeners.

Version:
$Id: ChainableRecordListenerDecorator.java,v 1.1 2003/05/06 23:02:05 tonyj Exp $
Author:
patton
Source Code:
ChainableRecordListenerDecorator.java

Constructor Summary
ChainableRecordListenerDecorator(RecordListener decorated)
          Create an instance of this class that decorates the specified object.
 
Method Summary
 void addRecordListener(RecordListener listener)
          Adds the specified RecordListener to this object.
 void configure(ConfigurationEvent event)
          Tells this object to configure itself in preparation for the first recordSupplied(org.freehep.record.loop.event.RecordSuppliedEvent) call.
 void finish(RecordEvent event)
          Tells this object that an SequentialRecordLoop to which is has been added has been disposed of, and this object should execute any housekeeping tasks trelated to its participation in this SequentialRecordLoop.
 RecordListener getDecoratedListener()
          Returns the RecordListener that this object decorates.
 RecordListener getRecordListener()
          Returns the RecordListener which is executed after this object. null is returned if no listener succeeds this object listener.
 void reconfigure(ConfigurationEvent event)
          Tells this object to reconfigure itself in preparation for a new set of recordSupplied(org.freehep.record.loop.event.RecordSuppliedEvent) calls.
 void recordSupplied(RecordSuppliedEvent event)
          Called every time a new record is read by the SequentialRecordLoop's SequentialRecordSource object.
 void removeRecordListener(RecordListener listener)
          Removes the specified listener from this object if it is this objects listener, otherwise it does nothing.
 void resume(RecordEvent event)
          Tells this object to prepare for a new set of recordSupplied(org.freehep.record.loop.event.RecordSuppliedEvent) calls using the its existing configuration.
 void suspend(RecordEvent event)
          Tells this object that there will be either a resume(org.freehep.record.loop.event.RecordEvent) or reconfigure(org.freehep.record.loop.event.ConfigurationEvent) before any more recordSupplied(org.freehep.record.loop.event.RecordSuppliedEvent) calls will be made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainableRecordListenerDecorator

public ChainableRecordListenerDecorator(RecordListener decorated)
Create an instance of this class that decorates the specified object.

Parameters:
decorated - the RecordListener to be decorated.
Throws:
IllegalArgumentException - if decorated is null.
Method Detail

configure

public void configure(ConfigurationEvent event)
Description copied from interface: RecordListener
Tells this object to configure itself in preparation for the first RecordListener.recordSupplied(org.freehep.record.loop.event.RecordSuppliedEvent) call.


finish

public void finish(RecordEvent event)
Description copied from interface: RecordListener
Tells this object that an SequentialRecordLoop to which is has been added has been disposed of, and this object should execute any housekeeping tasks trelated to its participation in this SequentialRecordLoop.


getDecoratedListener

public RecordListener getDecoratedListener()
Returns the RecordListener that this object decorates.

Returns:
the RecordListener that this object decorates.

recordSupplied

public void recordSupplied(RecordSuppliedEvent event)
Description copied from interface: RecordListener
Called every time a new record is read by the SequentialRecordLoop's SequentialRecordSource object.


reconfigure

public void reconfigure(ConfigurationEvent event)
Description copied from interface: RecordListener
Tells this object to reconfigure itself in preparation for a new set of RecordListener.recordSupplied(org.freehep.record.loop.event.RecordSuppliedEvent) calls.


resume

public void resume(RecordEvent event)
Tells this object to prepare for a new set of recordSupplied(org.freehep.record.loop.event.RecordSuppliedEvent) calls using the its existing configuration.

Parameters:
event - the RecordEvent for this event.
Throws:
IllegalStateException - if the listener is new and has not been handed at least on record already.

suspend

public void suspend(RecordEvent event)
Description copied from interface: RecordListener
Tells this object that there will be either a RecordListener.resume(org.freehep.record.loop.event.RecordEvent) or RecordListener.reconfigure(org.freehep.record.loop.event.ConfigurationEvent) before any more RecordListener.recordSupplied(org.freehep.record.loop.event.RecordSuppliedEvent) calls will be made.


addRecordListener

public void addRecordListener(RecordListener listener)
                       throws TooManyListenersException
Description copied from interface: RecordListenerManager
Adds the specified RecordListener to this object.

Specified by:
addRecordListener in interface RecordListenerManager
Parameters:
listener - the RecordListener to add.
Throws:
TooManyListenersException - if a listener is already present.
See Also:
RecordListenerManager.removeRecordListener(org.freehep.record.loop.event.RecordListener)

getRecordListener

public RecordListener getRecordListener()
Returns the RecordListener which is executed after this object. null is returned if no listener succeeds this object listener.

Specified by:
getRecordListener in interface RecordListenerManager
Returns:
the RecordListener which succeeds this object.

removeRecordListener

public void removeRecordListener(RecordListener listener)
Description copied from interface: RecordListenerManager
Removes the specified listener from this object if it is this objects listener, otherwise it does nothing. If removed, a finish event is sent to the listener if it has been configured so that is can clean up any resources it holds.

Specified by:
removeRecordListener in interface RecordListenerManager
Parameters:
listener - the RecordListener to remove.
See Also:
RecordListenerManager.addRecordListener(org.freehep.record.loop.event.RecordListener)

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.