public class CallSoon extends Object
Runnable shortly in the Swing thread
with optional coalescing of multiple calls and an optional delay until the runnable is invoked.
Runnables are added using add(Runnable), add(Runnable, long, boolean) or add(Runnable, long, boolean, com.biomatters.geneious.publicapi.utilities.CallSoon.EnabledProvider)
and pending runnables can be cancelled using cancel(Runnable).| Modifier and Type | Class and Description |
|---|---|
static interface |
CallSoon.EnabledProvider
Provides a method for specifying whether something is enabled
|
| Constructor and Description |
|---|
CallSoon() |
| Modifier and Type | Method and Description |
|---|---|
static void |
add(Runnable runnable)
Invokes this runnable soon (like using
SwingUtilities.invokeLater(Runnable)) in the event dispatch thread. |
static void |
add(Runnable runnable,
long delayInMilliseconds,
boolean overrideExisting)
Invokes this runnable soon (like using
SwingUtilities.invokeLater(Runnable)) in the event dispatch thread. |
static void |
add(Runnable runnable,
long delayInMilliseconds,
boolean overrideExisting,
CallSoon.EnabledProvider enabledProvider)
Invoke this runnable soon in the Event dispatch thread.
|
static boolean |
cancel(Runnable runnable)
Cancels a pending runnable (added via one of the
methods if it has not yet been invoked |
public static void add(Runnable runnable)
SwingUtilities.invokeLater(Runnable)) in the event dispatch thread.
If multiple calls are made to this method before the runnable is invoked, these are coalesced into a single call.runnable - the runnable call soon.public static void add(Runnable runnable, long delayInMilliseconds, boolean overrideExisting)
SwingUtilities.invokeLater(Runnable)) in the event dispatch thread.
If multiple calls are made to this method before the runnable is invoked, these are coalesced into a single call.runnable - the runnable call soon.delayInMilliseconds - the number of milliseconds to wait. May be 0 to invoke as soon as possible.overrideExisting - If true, then any already queued instance of this runnable is removed before scheduling it again at the new time.public static void add(Runnable runnable, long delayInMilliseconds, boolean overrideExisting, CallSoon.EnabledProvider enabledProvider)
runnable - the runnable to rundelayInMilliseconds - the number of milliseconds to wait. May be 0 to invoke as soon as possible.overrideExisting - If true, then any already queued instance of this runnable is removed before scheduling it again at the new time.enabledProvider - if this isn't null, then once the time has elapsed, the runnable will not be run until enabledProvider.isEnabled returns true,