org.gerhardb.lib.util
Class ModalProgressDialogFlex
java.lang.Object
org.gerhardb.lib.util.ModalProgressDialogFlex
- All Implemented Interfaces:
- ILoadingMessage
public class ModalProgressDialogFlex
- extends java.lang.Object
- implements ILoadingMessage
Blocks user interaction during a lenghty event during which the application
needs to behave modally providing a modal dialog box with a progress meter
if the task is lenghty. All done out of the AWT thread so the application
can be providing visual feedback to the user as the lenghty operation is
processed.
Based on WaitDialog and DialogModality developed by Craig Pell.
|
Field Summary |
static javax.swing.Icon |
WAIT_ICON
|
|
Constructor Summary |
ModalProgressDialogFlex(java.awt.Window topWindow,
java.lang.String title,
java.lang.String message,
java.lang.String cancelBtnText,
javax.swing.BoundedRangeModel range,
long thresholdMilliSeconds)
Dialog is guaranteed to come up by threshold even if the first event
has not processed. |
|
Method Summary |
int |
getNextIncrement()
|
void |
interrupt()
Halts any executing task, and hides this object's dialog if it
is displayed. |
static void |
main(java.lang.String[] args)
|
static void |
popUp(java.awt.Window topWindow,
java.lang.String titleBar,
java.lang.String explanation,
java.lang.String cancelBtnText,
javax.swing.BoundedRangeModel range,
java.lang.Runnable runMe)
|
static void |
popUp(java.awt.Window topWindow,
java.lang.String titleBar,
java.lang.String explanation,
java.lang.String cancelBtnText,
javax.swing.BoundedRangeModel range,
java.lang.Runnable runMe,
long thresholdMilliSeconds)
Dialog is guaranteed to come up by threshold even if the first event
has not processed. |
void |
run(java.lang.Runnable runMe)
|
void |
setMessage(java.lang.String msg)
|
void |
setText(java.lang.String msg)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WAIT_ICON
public static final javax.swing.Icon WAIT_ICON
ModalProgressDialogFlex
public ModalProgressDialogFlex(java.awt.Window topWindow,
java.lang.String title,
java.lang.String message,
java.lang.String cancelBtnText,
javax.swing.BoundedRangeModel range,
long thresholdMilliSeconds)
- Dialog is guaranteed to come up by threshold even if the first event
has not processed. When the first event finishes, it is used to estimate
the time to complete. If that is greater than the threshold, the dialog
comes up immediately. If not, it will be reevaluated each event. If
all events actually finish before the threshold comes up, the dialog
never appears. There is still a small chance the box could come up and
go away very fast, but it is unlikely. Also, avoiding that entirely
would require guessing on the speed of the last few events and maybe
those are where it slows down.
- Parameters:
parent - ComponenttitleBar - Stringexplanation - StringmyCancelBtnText - Stringthreshold - longrange - BoundedRangeModel if null, then indeterminatemilli - How many seconds to wait. Zero for immediate.
popUp
public static void popUp(java.awt.Window topWindow,
java.lang.String titleBar,
java.lang.String explanation,
java.lang.String cancelBtnText,
javax.swing.BoundedRangeModel range,
java.lang.Runnable runMe)
popUp
public static void popUp(java.awt.Window topWindow,
java.lang.String titleBar,
java.lang.String explanation,
java.lang.String cancelBtnText,
javax.swing.BoundedRangeModel range,
java.lang.Runnable runMe,
long thresholdMilliSeconds)
- Dialog is guaranteed to come up by threshold even if the first event
has not processed. When the first event finishes, it is used to estimate
the time to complete. If that is greater than the threshold, the dialog
comes up immediately. If not, it will be reevaluated each event. If
all events actually finish before the threshold comes up, the dialog
never appears. There is still a small chance the box could come up and
go away very fast, but it is unlikely. Also, avoiding that entirely
would require guessing on the speed of the last few events and maybe
those are where it slows down.
- Parameters:
parent - ComponenttitleBar - Stringexplanation - StringmyCancelBtnText - Stringthreshold - longrange - BoundedRangeModel if null, then indeterminaterunMe - Runnablemilli - How many seconds to wait. Zero for immediate.
run
public void run(java.lang.Runnable runMe)
interrupt
public void interrupt()
- Halts any executing task, and hides this object's dialog if it
is displayed. The executing task, if any, will be interrupted;
it is up to that task to terminate itself based on its
interruption status.
setText
public void setText(java.lang.String msg)
- Specified by:
setText in interface ILoadingMessage
setMessage
public void setMessage(java.lang.String msg)
- Specified by:
setMessage in interface ILoadingMessage
getNextIncrement
public int getNextIncrement()
- Specified by:
getNextIncrement in interface ILoadingMessage
main
public static void main(java.lang.String[] args)
Copyright ? 2007 Gerhard Beck. All rights reserved. Subject to GPL.