Package com.luciad.view.lightspeed
Class TLspPaintProgress
java.lang.Object
com.luciad.view.lightspeed.TLspPaintProgress
Class describing the progress of paint operations in an
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.- Since:
- 2012.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final TLspPaintProgress
Convenience constant indicating completed progress.static final TLspPaintProgress
Convenience constant indicating indeterminate progress. -
Constructor Summary
ConstructorDescriptionTLspPaintProgress
(int aAmountDone, int aTotalWork, boolean aComplete) Creates a new painting progress object with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Returns the amount of work done.final double
Returns a normalized progress value (between 0 and 1).final int
Returns the total amount of work to be done.final boolean
Returns true if this paint progress indicates that progress has been completed.toString()
-
Field Details
-
INDETERMINATE
Convenience constant indicating indeterminate progress. -
COMPLETE
Convenience constant indicating completed progress.
-
-
Constructor Details
-
TLspPaintProgress
public TLspPaintProgress(int aAmountDone, int aTotalWork, boolean aComplete) Creates a new painting progress object with the given parameters.- Parameters:
aAmountDone
- the amount of work already doneaTotalWork
- the total work to be doneaComplete
- whether or not the progress is completed
-
-
Method Details
-
getAmountDone
public final int getAmountDone()Returns the amount of work done. The units of this value and ofgetTotalWork()
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. ThegetProgress()
method returns a normalized progress value based on the total work and the amount done.- Returns:
- the amount of work done
-
getTotalWork
public final int getTotalWork()Returns the total amount of work to be done. The units of this value are unspecified but must be the same as those ofgetAmountDone()
.- Returns:
- the total amount of work to be done
-
isComplete
public final boolean isComplete()Returns true if this paint progress indicates that progress has been completed.- Returns:
- whether paint progress has been completed
-
getProgress
public final double getProgress()Returns a normalized progress value (between 0 and 1). This value is defined as the ratio ofgetAmountDone()
overgetTotalWork()
.- Returns:
- the normalized progress value
-
toString
-