Class ProgressFrame
- java.lang.Object
-
- jebl.util.ProgressListener
-
- com.biomatters.geneious.publicapi.components.ProgressFrame
-
- All Implemented Interfaces:
jebl.util.Cancelable
public final class ProgressFrame extends jebl.util.ProgressListener
An implementation ofProgressListener
which displays progress using a progress bar and a cancel button in a Frame.
-
-
Constructor Summary
Constructors Constructor Description ProgressFrame(java.lang.String title, java.lang.String message)
Creates a progress frame manager to display the progress of a potentially time-consuming operation.ProgressFrame(java.lang.String title, java.lang.String message, long delay, boolean startDelayImmediately)
Deprecated.useProgressFrame(String, String)
insteadProgressFrame(java.lang.String title, java.lang.String message, long delay, boolean startDelayImmediately, java.awt.Window parentWindowToDisable)
Deprecated.useProgressFrame(String, String, java.awt.Window)
insteadProgressFrame(java.lang.String title, java.lang.String message, java.awt.Window parentWindowToDisable)
Creates a progress frame manager to display the progress of a potentially time-consuming operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
_addInfo(java.lang.String message)
void
_addWarning(java.lang.String message)
protected void
_setImage(java.awt.Image image)
protected void
_setIndeterminateProgress()
protected void
_setMessage(java.lang.String message)
protected void
_setProgress(double fractionCompleted)
void
addFeedbackAction(java.lang.String label, java.lang.String description, org.virion.jam.util.SimpleListener listener)
void
addFeedbackAction(java.lang.String label, org.virion.jam.util.SimpleListener listener)
void
addProgressListener(jebl.util.ProgressListener progressListener)
Adds a listener to be notified about all progress messages (i.e all methods in ProgressListener) that this ProgressFrame receives.void
cancel()
Cancels this progress frame.java.awt.Frame
getFrame()
Deprecated.usegetWindow()
java.awt.Window
getWindow()
Get the window which is used to display progress.boolean
isCanceled()
void
removeFeedbackAction(java.lang.String label)
void
removeProgressListener(jebl.util.ProgressListener progressListener)
Removes a listener added usingaddProgressListener(jebl.util.ProgressListener)
void
setAutoMinimize(int delayInMilliseconds)
Deprecated.this isn't nice for the users.void
setCancelable(boolean isCancelable)
Set whether this progress frame should be cancelable by the user.void
setCancelButtonLabel(java.lang.String label)
Set the label for the "Cancel" button.void
setComplete()
Sets the progress to 100%, causing the frame to close if it is visible.void
setIcons(Icons icons)
Set the icons for the frame/task bar (displayed in the left corner of the title bar).void
setTitle(java.lang.String title)
-
Methods inherited from class jebl.util.ProgressListener
addInfo, addWarning, createSplitProgress, createSplitProgress, forCancelable, getSplitProgress, setImage, setIndeterminateProgress, setMessage, setMessageOrThrow, setProgress, setProgress, setProgress, setProgressOrThrow, setProgressOrThrow, throwExceptionIfCanceled
-
-
-
-
Constructor Detail
-
ProgressFrame
public ProgressFrame(java.lang.String title, java.lang.String message)
Creates a progress frame manager to display the progress of a potentially time-consuming operation. After returning from the constructor, the Swing frame will automatically be created and become visible after a small delay (under a second) has elapsed. IfProgressListener.setProgress(double)
isn't called before this delay has elapsed the progress frame will show with indeterminate progress typical usage:ProgressFrame progress = new ProgressFrame("Title", "doing stuff"); while(! cancelled) { //do some stuff if (progress.setProgress(fractionComplete)) { cancelled = true; } } progress.setComplete ();
- Parameters:
title
- Title of the progress framemessage
- Initial message to display above the progress bar (replaced by any message set during progress of the operation)- Since:
- API 4.61 (Geneious 5.6.1)
-
ProgressFrame
public ProgressFrame(java.lang.String title, java.lang.String message, java.awt.Window parentWindowToDisable)
Creates a progress frame manager to display the progress of a potentially time-consuming operation. After returning from the constructor, the Swing frame will automatically be created and become visible after a small delay (under a second) has elapsed. IfProgressListener.setProgress(double)
isn't called before this delay has elapsed the progress frame will show with indeterminate progress typical usage:ProgressFrame progress = new ProgressFrame("Title", "doing stuff"); while(! cancelled) { //do some stuff if (progress.setProgress(fractionComplete)) { cancelled = true; } } progress.setComplete ();
- Parameters:
title
- Title of the progress framemessage
- Initial message to display above the progress bar (replaced by any message set during progress of the operation)parentWindowToDisable
- A window which is disabled immediately and remains disabled until the progress frame is complete.- Since:
- API 4.61 (Geneious 5.6.1)
-
ProgressFrame
@Deprecated public ProgressFrame(java.lang.String title, java.lang.String message, long delay, boolean startDelayImmediately)
Deprecated.useProgressFrame(String, String)
insteadCreates a progress frame to display the progress of a potentially time-consuming operation. The progress frame will not become visible until the operation has taken at leastdelay
milliseconds. typical usage:ProgressFrame progress = new ProgressFrame("pros", "doing stuff", 1000); while(! cancelled) { //do some stuff if (progress.setProgress(fractionComplete)) { cancelled = true; } } progress.setComplete ();
- Parameters:
title
- Title of the progress framemessage
- Initial message to display above the progress bar (replaced by any message set during progress of the operation)delay
- Delay in milliseconds before displaying the ProgressFrame.startDelayImmediately
- if true, then the delay count starts immediately. If false, then the delay timer is started when the first setProgress or setMessage call is made.
-
ProgressFrame
@Deprecated public ProgressFrame(java.lang.String title, java.lang.String message, long delay, boolean startDelayImmediately, java.awt.Window parentWindowToDisable)
Deprecated.useProgressFrame(String, String, java.awt.Window)
insteadCreates a progress frame to display the progress of a potentially time-consuming operation. The progress frame will not become visible until the operation has taken at leastdelay
milliseconds. typical usage:ProgressFrame progress = new ProgressFrame("pros", "doing stuff", 1000); while(! cancelled) { //do some stuff if (progress.setProgress(fractionComplete)) { cancelled = true; } } progress.setComplete ();
- Parameters:
title
- Title of the progress framemessage
- Initial message to display above the progress bar (replaced by any message set during progress of the operation)delay
- Delay in milliseconds before displaying the ProgressFrame.startDelayImmediately
- if true, then the delay count starts immediately. If false, then the delay timer is started when the first setProgress or setMessage call is made.parentWindowToDisable
- A window which is disabled immediately and remains disabled until the progress frame is complete.
-
-
Method Detail
-
setTitle
public void setTitle(java.lang.String title)
- Overrides:
setTitle
in classjebl.util.ProgressListener
-
setIcons
public void setIcons(Icons icons)
Set the icons for the frame/task bar (displayed in the left corner of the title bar). Must be called before the frame is made visible. This has no effect on Mac OS (because there is no frame icon).- Parameters:
icons
- Icons to display
-
getFrame
@Deprecated public java.awt.Frame getFrame()
Deprecated.usegetWindow()
Get the frame which is used to display progress. This will only return a non-null value after the frame has become visible (normally after the delay period).- Returns:
- the frame which is used to display progress. Will only return a non-null value after the frame has become visible (normally after the delay period).
-
getWindow
public java.awt.Window getWindow()
Get the window which is used to display progress. This will only return a non-null value after the frame has become visible (normally after the delay period).- Returns:
- the window which is used to display progress. Will only return a non-null value after the frame has become visible (normally after the delay period).
-
cancel
public void cancel()
Cancels this progress frame. This is the same as clicking the cancel button. This is safe to call even after the progress has already been canceled or finished.
-
_setProgress
protected void _setProgress(double fractionCompleted)
- Specified by:
_setProgress
in classjebl.util.ProgressListener
- Parameters:
fractionCompleted
- a number between 0 and 1 inclusive representing the fraction of the operation completed.
-
_setIndeterminateProgress
protected void _setIndeterminateProgress()
- Specified by:
_setIndeterminateProgress
in classjebl.util.ProgressListener
-
_setMessage
protected void _setMessage(java.lang.String message)
- Specified by:
_setMessage
in classjebl.util.ProgressListener
-
isCanceled
public boolean isCanceled()
- Specified by:
isCanceled
in interfacejebl.util.Cancelable
- Specified by:
isCanceled
in classjebl.util.ProgressListener
-
_addWarning
public void _addWarning(java.lang.String message)
- Overrides:
_addWarning
in classjebl.util.ProgressListener
-
_addInfo
public void _addInfo(java.lang.String message)
- Overrides:
_addInfo
in classjebl.util.ProgressListener
-
setComplete
public void setComplete()
Sets the progress to 100%, causing the frame to close if it is visible.
-
addProgressListener
public void addProgressListener(jebl.util.ProgressListener progressListener)
Adds a listener to be notified about all progress messages (i.e all methods in ProgressListener) that this ProgressFrame receives.- Parameters:
progressListener
- the progress listener to notify- Since:
- API 4.14 (Geneious 5.1)
-
removeProgressListener
public void removeProgressListener(jebl.util.ProgressListener progressListener)
Removes a listener added usingaddProgressListener(jebl.util.ProgressListener)
- Parameters:
progressListener
- the progress listener to notify- Since:
- API 4.14 (Geneious 5.1)
-
_setImage
protected void _setImage(java.awt.Image image)
- Overrides:
_setImage
in classjebl.util.ProgressListener
-
addFeedbackAction
public void addFeedbackAction(java.lang.String label, org.virion.jam.util.SimpleListener listener)
- Overrides:
addFeedbackAction
in classjebl.util.ProgressListener
-
addFeedbackAction
public void addFeedbackAction(java.lang.String label, java.lang.String description, org.virion.jam.util.SimpleListener listener)
- Overrides:
addFeedbackAction
in classjebl.util.ProgressListener
-
removeFeedbackAction
public void removeFeedbackAction(java.lang.String label)
- Overrides:
removeFeedbackAction
in classjebl.util.ProgressListener
-
setAutoMinimize
@Deprecated public void setAutoMinimize(int delayInMilliseconds)
Deprecated.this isn't nice for the users. Don't use it.After the specified delay has passed (since the frame became visible) the progress frame will automatically minimize. If the progress of the operation reaches a certain threshold (40% currently) before the auto-minimize delay has passed then the auto-minimize will be canceled. This is because the operation will probably finish shortly so the user would be better to wait. Useful when you want to run a lengthy operation in the background and make it clear to the user that they can continue working (eg. installing a plugin).- Parameters:
delayInMilliseconds
- delay before minimized
-
setCancelButtonLabel
public void setCancelButtonLabel(java.lang.String label)
Set the label for the "Cancel" button. Useful if canceling is not acutally possible and the button should have a lable like "Hide" in stead.- Parameters:
label
- label for the cancel button
-
setCancelable
public void setCancelable(boolean isCancelable)
Set whether this progress frame should be cancelable by the user. If not, the cancel button will be hidden and the frame will have no close button.- Parameters:
isCancelable
- whether this progress frame should be cancelable by the user- Since:
- API 4.611 (Geneious 6.1.1)
-
-