public class TLspTaskExecutorRunnable
extends java.lang.Object
implements java.lang.Runnable
Specifies the task that must be performed by a runnable. Apart from delegating to
a Runnable
object, this class also holds
additional information regarding the task to be scheduled.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_MESSAGE
Default message passed to the
invalidate
when execution of the runnable requires a view invalidation. |
static int |
DEFAULT_PRIORITY
Default priority hint of 0.
|
Constructor and Description |
---|
TLspTaskExecutorRunnable(java.lang.Object aSource,
java.lang.Runnable aRunnable,
boolean aNewPaintAvailable)
Creates a new task executor runnable with the given parameters and a
default priority hint . |
TLspTaskExecutorRunnable(java.lang.Object aSource,
java.lang.Runnable aRunnable,
int aPriority,
boolean aNewPaintAvailable)
Creates a new task executor runnable with the given parameters.
|
TLspTaskExecutorRunnable(java.lang.Object aSource,
java.lang.Runnable aRunnable,
int aPriority,
boolean aNewPaintAvailable,
long aDelay,
java.util.concurrent.TimeUnit aDelayUnit)
Creates a new task executor runnable with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
long |
getDelay()
Returns the delay before the task should be executed.
|
java.util.concurrent.TimeUnit |
getDelayUnit()
Returns the unit for the
delay . |
java.lang.String |
getMessage()
Message passed when invalidating the view when
isNewPaintAvailable() is true
after running the runnable. |
int |
getPriority()
The priority hint of the runnable.
|
java.lang.Runnable |
getRunnable()
Returns the delegate runnable.
|
java.lang.Object |
getSource()
Returns the source object that scheduled the runnable.
|
boolean |
isNewPaintAvailable()
Returns whether or not the execution of this runnable results in a change in the view.
|
void |
run() |
java.lang.String |
toString() |
public static final int DEFAULT_PRIORITY
public static final java.lang.String DEFAULT_MESSAGE
invalidate
when execution of the runnable requires a view invalidation.public TLspTaskExecutorRunnable(java.lang.Object aSource, java.lang.Runnable aRunnable, boolean aNewPaintAvailable)
default priority hint
.aSource
- The source object that scheduled the runnableaRunnable
- A delegate runnable. This runnable is not allowed to repaint the view. Instead
the aNewPaintAvailable
should be set to true.aNewPaintAvailable
- If true, hints that executing this task will result in
a change in the view in any way. If false, this task
has no impact on visualisation.public TLspTaskExecutorRunnable(java.lang.Object aSource, java.lang.Runnable aRunnable, int aPriority, boolean aNewPaintAvailable)
aSource
- The source object that scheduled the runnableaRunnable
- A delegate runnable. This runnable is not allowed to repaint the view. Instead
the aNewPaintAvailable
should be set to true.aPriority
- The priority of the runnable, where a higher value translates
to a higher priority. Note that the priority is a hint - task executor implementations
are not required to take this into account.aNewPaintAvailable
- If true, hints that executing this task will result in
a change in the view in any way. If false, this task
has no impact on visualisation.public TLspTaskExecutorRunnable(java.lang.Object aSource, java.lang.Runnable aRunnable, int aPriority, boolean aNewPaintAvailable, long aDelay, java.util.concurrent.TimeUnit aDelayUnit)
aSource
- The source object that scheduled the runnableaRunnable
- A delegate runnable. This runnable is not allowed to repaint the view. Instead
the aNewPaintAvailable
should be set to true.aPriority
- The priority of the runnable, where a higher value translates
to a higher priority. Note that the priority is a hint - task executor implementations
are not required to take this into account.aNewPaintAvailable
- If true, hints that executing this task will result in
a change in the view in any way. If false, this task
has no impact on visualisation.aDelay
- The delay before the task should be executed. Zero indicates that the
task may be executed immediately. The delay is a hint, no guarantee.aDelayUnit
- The unit of aDelay
public void run()
run
in interface java.lang.Runnable
public java.lang.Runnable getRunnable()
public boolean isNewPaintAvailable()
public int getPriority()
public java.lang.Object getSource()
public long getDelay()
getDelayUnit()
public java.util.concurrent.TimeUnit getDelayUnit()
delay
.public java.lang.String getMessage()
isNewPaintAvailable()
is true
after running the runnable. The message is used for tracing.
By default this method returns DEFAULT_MESSAGE
.
invalidate
method for tracing purposespublic java.lang.String toString()
toString
in class java.lang.Object