public final class TLspPaintProgress extends Object
ILspView
.
Methods which perform painting, such as ILspPaintableLayer#paint
or ILspPainter#paintObjects
can return a paint progress object to indicate to the caller whether or not
they were able to bring the view completely up to date for the data they
were supposed to paint. They can also provide an indication of how much work
has been done and how much is still remaining. This may be useful for
displaying progress information to the end user, e.g. when data has to be
retrieved from a slow storage medium or network.
This class represents progress using two values:
amount of work already done
and
total amount of work to be done
. These values are in
unspecified units, but for convenience getProgress()
converts them
into a fraction between 0 and 1. A value of zero, by convention, indicates
that progress is indeterminate.Modifier and Type | Field and Description |
---|---|
static TLspPaintProgress |
COMPLETE
Convenience constant indicating completed progress.
|
static TLspPaintProgress |
INDETERMINATE
Convenience constant indicating indeterminate progress.
|
Constructor and Description |
---|
TLspPaintProgress(int aAmountDone,
int aTotalWork,
boolean aComplete)
Creates a new painting progress object with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
int |
getAmountDone()
Returns the amount of work done.
|
double |
getProgress()
Returns a normalized progress value (between 0 and 1).
|
int |
getTotalWork()
Returns the total amount of work to be done.
|
boolean |
isComplete()
Returns true if this paint progress indicates that progress has been
completed.
|
String |
toString() |
public static final TLspPaintProgress INDETERMINATE
public static final TLspPaintProgress COMPLETE
public TLspPaintProgress(int aAmountDone, int aTotalWork, boolean aComplete)
aAmountDone
- the amount of work already doneaTotalWork
- the total work to be doneaComplete
- whether or not the progress is completedpublic final int getAmountDone()
getTotalWork()
are unspecified and left up to the user. For
instance, the values could represent the number of domain objects being
processed or the number of requests being sent to a remote server. The
getProgress()
method returns a normalized progress value based on
the total work and the amount done.public final int getTotalWork()
getAmountDone()
.public final boolean isComplete()
public final double getProgress()
getAmountDone()
over
getTotalWork()
.