Package org.openstreetmap.josm.gui
Class SplashScreen.SplashProgressMonitor
- java.lang.Object
-
- org.openstreetmap.josm.gui.SplashScreen.Task
-
- org.openstreetmap.josm.gui.SplashScreen.SplashProgressMonitor
-
- All Implemented Interfaces:
ProgressMonitor
- Enclosing class:
- SplashScreen
public static class SplashScreen.SplashProgressMonitor extends SplashScreen.Task implements ProgressMonitor
AProgressMonitor
which stores the (sub)tasks in a tree.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.progress.ProgressMonitor
ProgressMonitor.CancelListener
-
-
Field Summary
Fields Modifier and Type Field Description private SplashScreen.SplashProgressMonitor
latestSubtask
private javax.swing.event.ChangeListener
listener
private java.lang.String
name
private java.util.List<SplashScreen.Task>
tasks
-
Fields inherited from interface org.openstreetmap.josm.gui.progress.ProgressMonitor
ALL_TICKS, DEFAULT_TICKS
-
-
Constructor Summary
Constructors Constructor Description SplashProgressMonitor(java.lang.String name, javax.swing.event.ChangeListener listener)
Constructs a newSplashProgressMonitor
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCancelListener(ProgressMonitor.CancelListener listener)
Add listener for user abort actionvoid
appendLogMessage(java.lang.String message)
Appends a message to the log managed by the progress monitor.void
beginTask(java.lang.String title)
Starts this progress monitor.void
beginTask(java.lang.String title, int ticks)
Starts this progress monitor.void
cancel()
Abort current operation, usually called when user somehow requested an abortProgressMonitor
createSubTaskMonitor(int ticks, boolean internal)
Creates subtasks monitor.void
finishTask()
Deprecated.UsefinishTask(String)
instead.void
finishTask(java.lang.String title)
Displays the given task as finished.ProgressTaskId
getProgressTaskId()
Returns the task ID of the progress dialog Should be used only by PleaseWaitRunnableint
getTicks()
Get the current number of work unitsint
getTicksCount()
Get the total number of work unitsjava.awt.Component
getWindowParent()
Return the parent windows of progress dialogvoid
indeterminateSubTask(java.lang.String title)
Subtask that will show progress running back and forthvoid
invalidate()
Can be used if method receives ProgressMonitor, but it's not interested progress monitoring.boolean
isCanceled()
Returns the state of user abortsvoid
removeCancelListener(ProgressMonitor.CancelListener listener)
Remove listener for user abort actionvoid
setCustomText(java.lang.String text)
Shows additional textvoid
setExtraText(java.lang.String text)
Show extra text after normal task title.void
setProgressTaskId(ProgressTaskId taskId)
Set the task ID of the progress dialog Should be used only by PleaseWaitRunnable.void
setTicks(int ticks)
Set the current number of work unitsvoid
setTicksCount(int ticks)
Set the total number of work unitsvoid
subTask(java.lang.String title)
Normal subtaskjava.lang.StringBuilder
toHtml(java.lang.StringBuilder sb)
Returns a HTML representation for this task.void
worked(int ticks)
Increase number of already done work units by ticks-
Methods inherited from class org.openstreetmap.josm.gui.SplashScreen.Task
toString
-
-
-
-
Field Detail
-
name
private final java.lang.String name
-
listener
private final javax.swing.event.ChangeListener listener
-
tasks
private final java.util.List<SplashScreen.Task> tasks
-
latestSubtask
private SplashScreen.SplashProgressMonitor latestSubtask
-
-
Constructor Detail
-
SplashProgressMonitor
public SplashProgressMonitor(java.lang.String name, javax.swing.event.ChangeListener listener)
Constructs a newSplashProgressMonitor
.- Parameters:
name
- namelistener
- change listener
-
-
Method Detail
-
toHtml
public java.lang.StringBuilder toHtml(java.lang.StringBuilder sb)
Description copied from class:SplashScreen.Task
Returns a HTML representation for this task.- Specified by:
toHtml
in classSplashScreen.Task
- Parameters:
sb
- aStringBuilder
used to build the HTML code- Returns:
sb
-
beginTask
public void beginTask(java.lang.String title)
Description copied from interface:ProgressMonitor
Starts this progress monitor. Must be called exactly once Ticks count is set to default value- Specified by:
beginTask
in interfaceProgressMonitor
- Parameters:
title
- title text of the task
-
beginTask
public void beginTask(java.lang.String title, int ticks)
Description copied from interface:ProgressMonitor
Starts this progress monitor. Must be called exactly once- Specified by:
beginTask
in interfaceProgressMonitor
- Parameters:
title
- title text of the taskticks
- number of work units (seeProgressMonitor.setTicksCount(int ticks)
)
-
setCustomText
public void setCustomText(java.lang.String text)
Description copied from interface:ProgressMonitor
Shows additional text- Specified by:
setCustomText
in interfaceProgressMonitor
- Parameters:
text
- custom text
-
setExtraText
public void setExtraText(java.lang.String text)
Description copied from interface:ProgressMonitor
Show extra text after normal task title. Hack for ProgressInputStream to show number of kB already downloaded- Specified by:
setExtraText
in interfaceProgressMonitor
- Parameters:
text
- extra text
-
indeterminateSubTask
public void indeterminateSubTask(java.lang.String title)
Description copied from interface:ProgressMonitor
Subtask that will show progress running back and forth- Specified by:
indeterminateSubTask
in interfaceProgressMonitor
- Parameters:
title
- Can benull
, in that case task title is not changed
-
subTask
public void subTask(java.lang.String title)
Description copied from interface:ProgressMonitor
Normal subtask- Specified by:
subTask
in interfaceProgressMonitor
- Parameters:
title
- Can benull
, in that case task title is not changed
-
createSubTaskMonitor
public ProgressMonitor createSubTaskMonitor(int ticks, boolean internal)
Description copied from interface:ProgressMonitor
Creates subtasks monitor.- Specified by:
createSubTaskMonitor
in 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
-
finishTask
@Deprecated public void finishTask()
Deprecated.UsefinishTask(String)
instead.Description copied from interface:ProgressMonitor
Finish 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:
finishTask
in interfaceProgressMonitor
-
finishTask
public void finishTask(java.lang.String title)
Displays the given task as finished.- Parameters:
title
- the task title
-
invalidate
public void invalidate()
Description copied from interface:ProgressMonitor
Can 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:
invalidate
in interfaceProgressMonitor
-
setTicksCount
public void setTicksCount(int ticks)
Description copied from interface:ProgressMonitor
Set the total number of work units- Specified by:
setTicksCount
in interfaceProgressMonitor
- Parameters:
ticks
- Number of total work units
-
getTicksCount
public int getTicksCount()
Description copied from interface:ProgressMonitor
Get the total number of work units- Specified by:
getTicksCount
in interfaceProgressMonitor
- Returns:
- Number of total work units
-
setTicks
public void setTicks(int ticks)
Description copied from interface:ProgressMonitor
Set the current number of work units- Specified by:
setTicks
in interfaceProgressMonitor
- Parameters:
ticks
- Number of work units already done
-
getTicks
public int getTicks()
Description copied from interface:ProgressMonitor
Get the current number of work units- Specified by:
getTicks
in interfaceProgressMonitor
- Returns:
- Number of work units already done
-
worked
public void worked(int ticks)
Description copied from interface:ProgressMonitor
Increase number of already done work units by ticks- Specified by:
worked
in interfaceProgressMonitor
- Parameters:
ticks
- number of ticks to add
-
isCanceled
public boolean isCanceled()
Description copied from interface:ProgressMonitor
Returns the state of user aborts- Specified by:
isCanceled
in interfaceProgressMonitor
- Returns:
true
if user aborted operation
-
cancel
public void cancel()
Description copied from interface:ProgressMonitor
Abort current operation, usually called when user somehow requested an abort- Specified by:
cancel
in interfaceProgressMonitor
-
addCancelListener
public void addCancelListener(ProgressMonitor.CancelListener listener)
Description copied from interface:ProgressMonitor
Add listener for user abort action- Specified by:
addCancelListener
in interfaceProgressMonitor
- Parameters:
listener
- the listener for cancel operation
-
removeCancelListener
public void removeCancelListener(ProgressMonitor.CancelListener listener)
Description copied from interface:ProgressMonitor
Remove listener for user abort action- Specified by:
removeCancelListener
in interfaceProgressMonitor
- Parameters:
listener
- the listener for cancel operation
-
appendLogMessage
public void appendLogMessage(java.lang.String message)
Description copied from interface:ProgressMonitor
Appends a message to the log managed by the progress monitor.- Specified by:
appendLogMessage
in interfaceProgressMonitor
- Parameters:
message
- the log message. Ignored if null or white space only.
-
setProgressTaskId
public void setProgressTaskId(ProgressTaskId taskId)
Description copied from interface:ProgressMonitor
Set the task ID of the progress dialog Should be used only by PleaseWaitRunnable. If taskId<> null
then "In background" button will be shown- Specified by:
setProgressTaskId
in interfaceProgressMonitor
- Parameters:
taskId
- the task ID
-
getProgressTaskId
public ProgressTaskId getProgressTaskId()
Description copied from interface:ProgressMonitor
Returns the task ID of the progress dialog Should be used only by PleaseWaitRunnable- Specified by:
getProgressTaskId
in interfaceProgressMonitor
- Returns:
- the task ID
-
getWindowParent
public java.awt.Component getWindowParent()
Description copied from interface:ProgressMonitor
Return the parent windows of progress dialog- Specified by:
getWindowParent
in interfaceProgressMonitor
- Returns:
- component suitable as parent for dialogs that wants to be shown in front of progress dialog
-
-