Class DisplayCoalescentEDTRunnablePool

java.lang.Object
org.micromanager.ndviewer.internal.gui.DisplayCoalescentEDTRunnablePool

public class DisplayCoalescentEDTRunnablePool
extends Object
Provide versions of SwingUtilities.invokeLater that coalesce with other outstanding invocations.
Author:
Mark A. Tsuchida
  • Method Details

    • create

      public static DisplayCoalescentEDTRunnablePool create()
    • invokeLaterWithCoalescence

      public void invokeLaterWithCoalescence​(CoalescentRunnable runnable)
      Invoke the given runnable on the EDT, coalescing multiple invocations on the event queue. This is a mechanism to coalesce refresh-like tasks, in the manner of Swing's RepaintManager, without having to replace the system global event queue via EventQueue.push. The given runnable is scheduled to run on the EDT, just as with SwingUtilities.invokeLater, but when invoked, all outstanding runnables with the same "coalescence class" (see CoalescentRunnable.getCoalescenceClass) will be coalesced and the result will be run.
      Parameters:
      runnable - the coalescent runnable to invoke on the EDT
    • invokeAsLateAsPossibleWithCoalescence

      public void invokeAsLateAsPossibleWithCoalescence​(CoalescentRunnable runnable)
      Like invokeLaterWithCoalescence, but defers invocation until the last scheduled task on the event queue is processed. Note that if you keep calling this method at a higher rate than the EDT is processing events, the runnable will not be executed until the EDT becomes otherwise idle.
      Parameters:
      runnable - the coalescent runnable to invoke on the EDT