jvx.gui
Class PuProgressBar
- java.lang.Object
-
- jv.object.PsObject
-
- jvx.gui.PuProgressBar
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Runnable, PsUpdateIf
public class PuProgressBar extends PsObject implements java.lang.Runnable
Component showing the status of a running process. The current progress is drawn in the progress bar and the actual percentage is written on it.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.
- See Also:
- Serialized Form
- Author:
- Matthias Nieser
- Version:
- 26.01.07, 1.60 revised (mn) Added PROGRESS_ constants.
20.01.07, 1.50 revised (kp) Conforming to 1.1 and API revised.
12.01.07, 1.10 revised (mn) Split into PuProgressBar and PuProgressBar_IP, Removed field m_size, Added remaining time.
07.04.06, 1.00 created (mn)
-
-
Field Summary
Fields Modifier and Type Field and Description static doublePROGRESS_ABORTEDProgress status, process aborted.static doublePROGRESS_FINISHEDProgress status, finished.static doublePROGRESS_NO_PROCESSProgress status, no working process.-
Fields inherited from class jv.object.PsObject
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 Summary
Constructors Constructor and Description PuProgressBar()Construct a new PuProgressBar without showing the remaining time.PuProgressBar(boolean bShowRemainingTime)Construct a new PuProgressBar.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidabortTimer()Abort timer.voidenableProgressStatus(boolean show)Whether the progress status is displayed.longgetElapsedTime()Get elapsed time in milliseconds, which is total running time minus pauses.doublegetProgress()Get the progress in [0, 1].java.lang.StringgetText()Get displayed text.voidinit()If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.booleanisShowingProgressStatus()Whether the progress status is displayed.booleanisShowingRemainingTime()Whether remaining time should be displayed.voidreset()Reset the progress bar.voidresumeTimer()Resume timer after suspending.voidrun()When an object implementing interfaceRunnableis used to create a thread, starting the thread causes the object'srunmethod to be called in that separately executing thread.voidsetProgress(double progress)Set actual progress status and updates the status bar.voidsetSubInterval(double start, double end)Set the interval for the next subprocess.voidsetText(java.lang.String text)Set displayed text.voidstart()Starts a new progress.voidstop()Ends a running progress.voidsuspendTimer()Suspend timer.-
Methods inherited from class jv.object.PsObject
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
-
-
-
-
Field Detail
-
PROGRESS_FINISHED
public static double PROGRESS_FINISHED
Progress status, finished.
-
PROGRESS_NO_PROCESS
public static double PROGRESS_NO_PROCESS
Progress status, no working process.
-
PROGRESS_ABORTED
public static double PROGRESS_ABORTED
Progress status, process aborted.
-
-
Constructor Detail
-
PuProgressBar
public PuProgressBar()
Construct a new PuProgressBar without showing the remaining time.
-
PuProgressBar
public PuProgressBar(boolean bShowRemainingTime)
Construct a new PuProgressBar.- Parameters:
bShowRemainingTime- Whether the remaining time should be displayed.
-
-
Method Detail
-
init
public void init()
If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.
-
start
public void start()
Starts a new progress. If another progress is still active, then the new progress will be a subprogress of the existing one. The interval of the subprogress can be set using setSubInterval().
-
stop
public void stop()
Ends a running progress. If the active progress is a subprogress, then the parent will be made active.
-
setSubInterval
public void setSubInterval(double start, double end)Set the interval for the next subprocess. The next time, start() is called, the progress bar gets initialized in this interval.
-
getElapsedTime
public long getElapsedTime()
Get elapsed time in milliseconds, which is total running time minus pauses.
-
getProgress
public double getProgress()
Get the progress in [0, 1]. A value of -1 means, that there is no working process.
-
setProgress
public void setProgress(double progress)
Set actual progress status and updates the status bar. A value of -1 means, that there is no working process.
-
getText
public java.lang.String getText()
Get displayed text.
-
setText
public void setText(java.lang.String text)
Set displayed text.
-
isShowingRemainingTime
public boolean isShowingRemainingTime()
Whether remaining time should be displayed.
-
enableProgressStatus
public void enableProgressStatus(boolean show)
Whether the progress status is displayed.
-
isShowingProgressStatus
public boolean isShowingProgressStatus()
Whether the progress status is displayed.
-
reset
public void reset()
Reset the progress bar.
-
suspendTimer
public void suspendTimer()
Suspend timer.
-
resumeTimer
public void resumeTimer()
Resume timer after suspending.
-
abortTimer
public void abortTimer()
Abort timer.
-
run
public void run()
When an object implementing interfaceRunnableis used to create a thread, starting the thread causes the object'srunmethod to be called in that separately executing thread.The general contract of the method
runis that it may take any action whatsoever.- Specified by:
runin interfacejava.lang.Runnable- See Also:
Thread.run()
-
-
"