com.tensegrity.generic.util
Class Debug.OnlyDoLastTriggered

java.lang.Object
  extended bycom.tensegrity.generic.util.Debug.OnlyDoLastTriggered
Enclosing class:
Debug

public abstract static class Debug.OnlyDoLastTriggered
extends java.lang.Object

This class uses the SwingUtilities.invokeLater(java.lang.Runnable) method to ensure that a piece of code is only run once after all events have been processed.

To use it, you have to create a subclass with an implementation of doIt(Object, Throwable) which receives two parameters containing all necessary information about the original situation the method was triggered.

Then you can use trigger(Object) to trigger the code, which will be called only once (for your last call to trigger).

Author:
BurkhardWick

Constructor Summary
Debug.OnlyDoLastTriggered()
           
 
Method Summary
protected abstract  void doIt(java.lang.Object param, java.lang.Throwable originalStack)
          The code that should be processed after it has been triggered.
 void trigger(java.lang.Object param)
          This method is called to trigger a call to the method doIt(Object, Throwable), which will be called by the last entry of the event queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Debug.OnlyDoLastTriggered

public Debug.OnlyDoLastTriggered()
Method Detail

trigger

public final void trigger(java.lang.Object param)
This method is called to trigger a call to the method doIt(Object, Throwable), which will be called by the last entry of the event queue.

Parameters:
param - This parameter is application defined and will be passed to the implementation of doIt(Object, Throwable)

doIt

protected abstract void doIt(java.lang.Object param,
                             java.lang.Throwable originalStack)
The code that should be processed after it has been triggered.

Parameters:
param - The parameter that has been passed to the method trigger(Object)
originalStack - A Throwable representing the stack at the time the call has been triggered, because at the time this method is called the stack will only include the event queue.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.