Class PleaseWaitProgressMonitor
- java.lang.Object
-
- org.openstreetmap.josm.gui.progress.AbstractProgressMonitor
-
- org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor
-
- All Implemented Interfaces:
ProgressMonitor
public class PleaseWaitProgressMonitor extends AbstractProgressMonitor
A progress monitor used inPleaseWaitRunnable
.Progress is displayed in a dialog window (
PleaseWaitDialog
).- Since:
- 12675 (moved from
gui.progress
package}
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PleaseWaitProgressMonitor.ProgressMonitorDialog
Implemented by both foreground dialog and background progress dialog (in status bar)-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.progress.AbstractProgressMonitor
AbstractProgressMonitor.State
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.progress.ProgressMonitor
ProgressMonitor.CancelListener
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
cancelable
private ActionListener
cancelListener
(package private) static PleaseWaitProgressMonitor
currentProgressMonitor
The progress monitor being currently displayed.private int
currentProgressValue
private String
customText
private PleaseWaitDialog
dialog
private Component
dialogParent
private ActionListener
inBackgroundListener
private boolean
indeterminate
private boolean
isInBackground
static int
PROGRESS_BAR_MAX
The maximum value the progress bar that displays the current progress should have.protected ProgressTaskId
taskId
private String
title
private WindowListener
windowListener
private String
windowTitle
-
Fields inherited from class org.openstreetmap.josm.gui.progress.AbstractProgressMonitor
state
-
Fields inherited from interface org.openstreetmap.josm.gui.progress.ProgressMonitor
ALL_TICKS, DEFAULT_TICKS
-
-
Constructor Summary
Constructors Constructor Description PleaseWaitProgressMonitor()
Constructs a newPleaseWaitProgressMonitor
.PleaseWaitProgressMonitor(Component dialogParent)
Constructs a newPleaseWaitProgressMonitor
.PleaseWaitProgressMonitor(Component dialogParent, String windowTitle)
Constructs a newPleaseWaitProgressMonitor
.PleaseWaitProgressMonitor(String windowTitle)
Constructs a newPleaseWaitProgressMonitor
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendLogMessage(String message)
Default implementation is empty.void
close()
Close the progress dialog window.void
doBeginTask()
void
doFinishTask()
private void
doInEDT(Runnable runnable)
protected void
doSetCustomText(String title)
protected void
doSetIntermediate(boolean value)
protected void
doSetTitle(String title)
static PleaseWaitProgressMonitor
getCurrent()
Returns the progress monitor being currently displayed.private PleaseWaitProgressMonitor.ProgressMonitorDialog
getDialog()
ProgressTaskId
getProgressTaskId()
Returns the task ID of the progress dialog Should be used only by PleaseWaitRunnableComponent
getWindowParent()
Return the parent windows of progress dialogboolean
isCancelable()
See if this task is cancelablevoid
reset()
Update the dialog valuesvoid
setCancelable(boolean cancelable)
Sets this task to be cancelableprivate void
setDialogVisible(boolean visible)
void
setProgressTaskId(ProgressTaskId taskId)
Set the task ID of the progress dialog Should be used only by PleaseWaitRunnable.void
showForegroundDialog()
Show the progress dialog in foregroundString
toString()
protected void
updateProgress(double progressValue)
-
Methods inherited from class org.openstreetmap.josm.gui.progress.AbstractProgressMonitor
addCancelListener, beginTask, beginTask, cancel, checkState, childFinished, childSetCustomText, childSetIntermediate, childSetProgress, childSetTitle, createSubTaskMonitor, finishTask, getTicks, getTicksCount, indeterminateSubTask, invalidate, isCanceled, removeCancelListener, setCustomText, setExtraText, setTicks, setTicksCount, subTask, worked
-
-
-
-
Field Detail
-
PROGRESS_BAR_MAX
public static final int PROGRESS_BAR_MAX
The maximum value the progress bar that displays the current progress should have.- See Also:
- Constant Field Values
-
currentProgressMonitor
static PleaseWaitProgressMonitor currentProgressMonitor
The progress monitor being currently displayed.
-
dialogParent
private final Component dialogParent
-
currentProgressValue
private int currentProgressValue
-
customText
private String customText
-
indeterminate
private boolean indeterminate
-
isInBackground
private boolean isInBackground
-
dialog
private PleaseWaitDialog dialog
-
windowTitle
private String windowTitle
-
taskId
protected ProgressTaskId taskId
-
cancelable
private boolean cancelable
-
cancelListener
private final ActionListener cancelListener
-
inBackgroundListener
private final ActionListener inBackgroundListener
-
windowListener
private final WindowListener windowListener
-
-
Constructor Detail
-
PleaseWaitProgressMonitor
public PleaseWaitProgressMonitor()
Constructs a newPleaseWaitProgressMonitor
.
-
PleaseWaitProgressMonitor
public PleaseWaitProgressMonitor(String windowTitle)
Constructs a newPleaseWaitProgressMonitor
.- Parameters:
windowTitle
- window title
-
PleaseWaitProgressMonitor
public PleaseWaitProgressMonitor(Component dialogParent)
Constructs a newPleaseWaitProgressMonitor
.- Parameters:
dialogParent
- component to get parent frame from
-
PleaseWaitProgressMonitor
public PleaseWaitProgressMonitor(Component dialogParent, String windowTitle)
Constructs a newPleaseWaitProgressMonitor
.- Parameters:
dialogParent
- component to get parent frame fromwindowTitle
- window title
-
-
Method Detail
-
getCurrent
public static PleaseWaitProgressMonitor getCurrent()
Returns the progress monitor being currently displayed.- Returns:
- the progress monitor being currently displayed
- Since:
- 12638
-
setDialogVisible
private void setDialogVisible(boolean visible)
-
getDialog
private PleaseWaitProgressMonitor.ProgressMonitorDialog getDialog()
-
isCancelable
public final boolean isCancelable()
See if this task is cancelable- Returns:
true
if it can be canceled
-
setCancelable
public final void setCancelable(boolean cancelable)
Sets this task to be cancelable- Parameters:
cancelable
- Whether it can be canceled
-
doBeginTask
public void doBeginTask()
- Specified by:
doBeginTask
in classAbstractProgressMonitor
-
doFinishTask
public void doFinishTask()
- Specified by:
doFinishTask
in classAbstractProgressMonitor
-
updateProgress
protected void updateProgress(double progressValue)
- Specified by:
updateProgress
in classAbstractProgressMonitor
-
doSetCustomText
protected void doSetCustomText(String title)
- Specified by:
doSetCustomText
in classAbstractProgressMonitor
-
doSetTitle
protected void doSetTitle(String title)
- Specified by:
doSetTitle
in classAbstractProgressMonitor
-
doSetIntermediate
protected void doSetIntermediate(boolean value)
- Specified by:
doSetIntermediate
in classAbstractProgressMonitor
-
appendLogMessage
public void appendLogMessage(String message)
Description copied from class:AbstractProgressMonitor
Default implementation is empty. Override in subclasses to display the log messages.- Specified by:
appendLogMessage
in interfaceProgressMonitor
- Overrides:
appendLogMessage
in classAbstractProgressMonitor
- Parameters:
message
- the log message. Ignored if null or white space only.
-
reset
public void reset()
Update the dialog values
-
close
public void close()
Close the progress dialog window.
-
showForegroundDialog
public void showForegroundDialog()
Show the progress dialog in foreground
-
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- 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- Returns:
- the task ID
-
getWindowParent
public Component getWindowParent()
Description copied from interface:ProgressMonitor
Return the parent windows of progress dialog- Returns:
- component suitable as parent for dialogs that wants to be shown in front of progress dialog
-
-