Class AbstractProgressMonitor
java.lang.Object
org.openstreetmap.josm.gui.progress.AbstractProgressMonitor
- All Implemented Interfaces:
ProgressMonitor
- Direct Known Subclasses:
ChildProgress,CLIProgressMonitor,PleaseWaitProgressMonitor,SwingRenderingProgressMonitor
This class contains the progress logic required to implement a
ProgressMonitor.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classstatic enumProgress monitor stateNested classes/interfaces inherited from interface org.openstreetmap.josm.gui.progress.ProgressMonitor
ProgressMonitor.CancelListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CancelHandlerprivate intprivate AbstractProgressMonitorprivate Stringprivate Stringprivate booleanprivate AbstractProgressMonitor.Requestprivate final Queue<AbstractProgressMonitor.Request>private Stringprivate Stringprotected AbstractProgressMonitor.Stateprivate Stringprivate intprivate intFields inherited from interface org.openstreetmap.josm.gui.progress.ProgressMonitor
ALL_TICKS, DEFAULT_TICKS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractProgressMonitor(CancelHandler cancelHandler) Create a newAbstractProgressMonitor -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd listener for user abort actionvoidappendLogMessage(String message) Default implementation is empty.private voidprivate voidvoidStarts this progress monitor.voidStarts this progress monitor.voidcancel()Abort current operation, usually called when user somehow requested an abortprotected voidcheckState(AbstractProgressMonitor.State... expectedStates) protected voidprotected voidchildSetCustomText(AbstractProgressMonitor child, String customText) protected voidchildSetIntermediate(AbstractProgressMonitor child, boolean value) protected voidchildSetProgress(AbstractProgressMonitor child, double value) protected voidchildSetTitle(AbstractProgressMonitor child, String title) createSubTaskMonitor(int ticks, boolean internal) Creates subtasks monitor.protected abstract voidprotected abstract voidprotected abstract voiddoSetCustomText(String title) protected abstract voiddoSetIntermediate(boolean value) protected abstract voiddoSetTitle(String title) voidFinish this progress monitor, close the dialog or inform the parent progress monitor that it can continue with other tasks.private AbstractProgressMonitor.RequestintgetTicks()Get the current number of work unitsintGet the total number of work unitsvoidindeterminateSubTask(String title) Subtask that will show progress running back and forthprivate voidinternalUpdateProgress(double childProgress) voidCan be used if method receives ProgressMonitor, but it's not interested progress monitoring.booleanReturns the state of user abortsvoidRemove listener for user abort actionprivate voidvoidsetCustomText(String text) Shows additional textvoidsetExtraText(String text) Show extra text after normal task title.voidsetTicks(int ticks) Set the current number of work unitsvoidsetTicksCount(int ticks) Set the total number of work unitsvoidNormal subtaskprotected abstract voidupdateProgress(double value) Update progress messagevoidworked(int ticks) Increase number of already done work units by ticksMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.gui.progress.ProgressMonitor
getProgressTaskId, getWindowParent, setProgressTaskId
-
Field Details
-
cancelHandler
-
state
-
ticksCount
-
ticks
-
childTicks
-
taskTitle
-
customText
-
extraText
-
shownTitle
-
shownCustomText
-
intermediateTask
-
requests
-
currentChild
-
requestedState
-
-
Constructor Details
-
AbstractProgressMonitor
Create a newAbstractProgressMonitor- Parameters:
cancelHandler- The handler that gets notified when the process is canceled.
-
-
Method Details
-
doBeginTask
-
doFinishTask
-
doSetIntermediate
-
doSetTitle
-
doSetCustomText
-
checkState
-
beginTask
Description copied from interface:ProgressMonitorStarts this progress monitor. Must be called exactly once Ticks count is set to default value- Specified by:
beginTaskin interfaceProgressMonitor- Parameters:
title- title text of the task
-
beginTask
Description copied from interface:ProgressMonitorStarts this progress monitor. Must be called exactly once- Specified by:
beginTaskin interfaceProgressMonitor- Parameters:
title- title text of the taskticks- number of work units (seeProgressMonitor.setTicksCount(int ticks))
-
finishTask
Description copied from interface:ProgressMonitorFinish this progress monitor, close the dialog or inform the parent progress monitor that it can continue with other tasks. Must be called at least once (if called multiply times then further calls are ignored)- Specified by:
finishTaskin interfaceProgressMonitor
-
invalidate
Description copied from interface:ProgressMonitorCan be used if method receives ProgressMonitor, but it's not interested progress monitoring. Basically replacesProgressMonitor.beginTask(String)andProgressMonitor.finishTask()This method can be also used in finally section if method expects that some exceptions might prevent it from passing progressMonitor away. IfProgressMonitor.beginTask(String)was already called then this method does nothing.- Specified by:
invalidatein interfaceProgressMonitor
-
subTask
Description copied from interface:ProgressMonitorNormal subtask- Specified by:
subTaskin interfaceProgressMonitor- Parameters:
title- Can benull, in that case task title is not changed
-
indeterminateSubTask
Description copied from interface:ProgressMonitorSubtask that will show progress running back and forth- Specified by:
indeterminateSubTaskin interfaceProgressMonitor- Parameters:
title- Can benull, in that case task title is not changed
-
setCustomText
Description copied from interface:ProgressMonitorShows additional text- Specified by:
setCustomTextin interfaceProgressMonitor- Parameters:
text- custom text
-
setExtraText
Description copied from interface:ProgressMonitorShow extra text after normal task title. Hack for ProgressInputStream to show number of kB already downloaded- Specified by:
setExtraTextin interfaceProgressMonitor- Parameters:
text- extra text
-
appendLogMessage
Default implementation is empty. Override in subclasses to display the log messages.- Specified by:
appendLogMessagein interfaceProgressMonitor- Parameters:
message- the log message. Ignored if null or white space only.
-
resetState
-
cancel
Description copied from interface:ProgressMonitorAbort current operation, usually called when user somehow requested an abort- Specified by:
cancelin interfaceProgressMonitor
-
isCanceled
Description copied from interface:ProgressMonitorReturns the state of user aborts- Specified by:
isCanceledin interfaceProgressMonitor- Returns:
trueif user aborted operation
-
addCancelListener
Description copied from interface:ProgressMonitorAdd listener for user abort action- Specified by:
addCancelListenerin interfaceProgressMonitor- Parameters:
listener- the listener for cancel operation
-
removeCancelListener
Description copied from interface:ProgressMonitorRemove listener for user abort action- Specified by:
removeCancelListenerin interfaceProgressMonitor- Parameters:
listener- the listener for cancel operation
-
updateProgress
Update progress message- Parameters:
value- The percentage of completion (this and child progress)
-
setTicks
Description copied from interface:ProgressMonitorSet the current number of work units- Specified by:
setTicksin interfaceProgressMonitor- Parameters:
ticks- Number of work units already done
-
setTicksCount
Description copied from interface:ProgressMonitorSet the total number of work units- Specified by:
setTicksCountin interfaceProgressMonitor- Parameters:
ticks- Number of total work units
-
worked
Description copied from interface:ProgressMonitorIncrease number of already done work units by ticks- Specified by:
workedin interfaceProgressMonitor- Parameters:
ticks- number of ticks to add
-
internalUpdateProgress
-
getTicks
Description copied from interface:ProgressMonitorGet the current number of work units- Specified by:
getTicksin interfaceProgressMonitor- Returns:
- Number of work units already done
-
getTicksCount
Description copied from interface:ProgressMonitorGet the total number of work units- Specified by:
getTicksCountin interfaceProgressMonitor- Returns:
- Number of total work units
-
createSubTaskMonitor
Description copied from interface:ProgressMonitorCreates subtasks monitor.- Specified by:
createSubTaskMonitorin interfaceProgressMonitor- Parameters:
ticks- Number of work units that should be done when subtask finishesinternal- If true then subtask can't modify task title/custom text- Returns:
- subtasks monitor
-
applyChildRequest
-
applyThisRequest
-
childFinished
-
getRequest
-
childSetProgress
-
childSetTitle
-
childSetCustomText
-
childSetIntermediate
-