FreeHEP API
Version v1.2.2

org.freehep.record.loop.event
Class ChainableRecordListenerDecorator

java.lang.Object
  |
  +--org.freehep.record.loop.event.ChainableRecordAdapter
        |
        +--org.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

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.

Specified by:
configure in interface RecordListener
Overrides:
configure in class org.freehep.record.loop.event.ChainableRecordAdapter
Parameters:
event - a ConfigurationEvent describing the configuration to use.

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.

Specified by:
finish in interface RecordListener
Overrides:
finish in class org.freehep.record.loop.event.ChainableRecordAdapter
Parameters:
event - the RecordEvent for this event.

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.

Specified by:
recordSupplied in interface RecordListener
Overrides:
recordSupplied in class org.freehep.record.loop.event.ChainableRecordAdapter
Parameters:
event - a RecordSuppliedEvent describing the data supplied.

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.

Specified by:
reconfigure in interface RecordListener
Overrides:
reconfigure in class org.freehep.record.loop.event.ChainableRecordAdapter
Parameters:
event - a ConfigurationEvent describing the new configuration to use.

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.

Specified by:
resume in interface RecordListener
Overrides:
resume in class org.freehep.record.loop.event.ChainableRecordAdapter
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.

Specified by:
suspend in interface RecordListener
Overrides:
suspend in class org.freehep.record.loop.event.ChainableRecordAdapter
Parameters:
event - the RecordEvent for this event.

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 v1.2.2

Copyright © 2000-2003 FreeHEP, All Rights Reserved.