public class PuProgressBar extends PsObject implements java.lang.Runnable
The process, whose progress should be shown by this progress bar, should run in a separate thread, since otherwise, the progress bar receives no repaint messages until the process has finished.
If bShowRemainingTime is enabled, the remaining time till 100% is written below the progress bar. The timer will be started, when the first progress is set and stopped if 100% is reached (or the progress bar is being reset). Note, that in this mode, an own thread is generated, which updates the progress bar every second.
Modifier and Type | Field and Description |
---|---|
static double |
PROGRESS_ABORTED
Progress status, process aborted.
|
static double |
PROGRESS_FINISHED
Progress status, finished.
|
static double |
PROGRESS_NO_PROCESS
Progress status, no working process.
|
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
Constructor and Description |
---|
PuProgressBar()
Construct a new PuProgressBar without showing the remaining time.
|
PuProgressBar(boolean bShowRemainingTime)
Construct a new PuProgressBar.
|
Modifier and Type | Method and Description |
---|---|
void |
abortTimer()
Abort timer.
|
void |
enableProgressStatus(boolean show)
Whether the progress status is displayed.
|
long |
getElapsedTime()
Get elapsed time in milliseconds, which is total running time minus pauses.
|
double |
getProgress()
Get the progress in [0, 1].
|
java.lang.String |
getText()
Get displayed text.
|
void |
init()
If instance has missing name then assign default name 'Object_NUMBER' where
number is the total number of already created instances.
|
boolean |
isShowingProgressStatus()
Whether the progress status is displayed.
|
boolean |
isShowingRemainingTime()
Whether remaining time should be displayed.
|
void |
reset()
Reset the progress bar.
|
void |
resumeTimer()
Resume timer after suspending.
|
void |
run()
When an object implementing interface
Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread. |
void |
setProgress(double progress)
Set actual progress status and updates the status bar.
|
void |
setSubInterval(double start,
double end)
Set the interval for the next subprocess.
|
void |
setText(java.lang.String text)
Set displayed text.
|
void |
start()
Starts a new progress.
|
void |
stop()
Ends a running progress.
|
void |
suspendTimer()
Suspend timer.
|
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, update, updatePanels
public static double PROGRESS_FINISHED
public static double PROGRESS_NO_PROCESS
public static double PROGRESS_ABORTED
public PuProgressBar()
public PuProgressBar(boolean bShowRemainingTime)
bShowRemainingTime
- Whether the remaining time should be displayed.public void init()
public void start()
public void stop()
public void setSubInterval(double start, double end)
public long getElapsedTime()
public double getProgress()
public void setProgress(double progress)
public java.lang.String getText()
public void setText(java.lang.String text)
public boolean isShowingRemainingTime()
public void enableProgressStatus(boolean show)
public boolean isShowingProgressStatus()
public void reset()
public void suspendTimer()
public void resumeTimer()
public void abortTimer()
public void run()
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
The general contract of the method run
is that it may
take any action whatsoever.
run
in interface java.lang.Runnable
Thread.run()
"