|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gui.dialog.DialogContentPane gui.dialog.WorkerContentPane
public class WorkerContentPane
This is a dialog that executes a given Thread or Runnable if it is shown on screen. It has an optional cancel button. A click on the dialog close button or on the cancel button will interrupt the Thread. The Thread may watch for this event but does not need to. The behaviour if the Thread is interrupted (isInterrupted() returns true) and has finished is the same as if a user clicks the cancel button. You may therefore control this behaviour by defining another default button operation for the cancel button and by overwriting the isInterrupted() method of your Thread. If the Thread is not interrupted and has finished, the next content pane is shown. If there is no next content pane, the dialog is closed according to the ON_CLICK button operation. By default, it is disposed.
Warning: The Thread should not call dispose() on the dialog, as this may lead to a deadlock or an Exception!
Nested Class Summary | |
---|---|
private class |
WorkerContentPane.InternalThread
A wrapper for the worker runnable. |
private class |
WorkerContentPane.WorkerComponentListener
|
Nested classes/interfaces inherited from class gui.dialog.DialogContentPane |
---|
DialogContentPane.CheckError, DialogContentPane.IWizardSuitable, DialogContentPane.IWizardSuitableNoWizardButtons, DialogContentPane.Layout |
Field Summary | |
---|---|
static java.lang.String |
DOTS
|
static java.lang.String |
IMG_BUSY
|
private boolean |
m_bInterruptThreadSafe
|
private java.lang.Thread |
m_internalThread
|
private int |
m_iProgressStatus
|
private java.lang.Runnable |
m_workerRunnable
|
private java.lang.Thread |
m_workerThread
|
static java.lang.String |
MSG_PLEASE_WAIT
|
Constructor Summary | |
---|---|
WorkerContentPane(JAPDialog a_parentDialog,
java.lang.String a_strText,
DialogContentPane a_previousContentPane,
java.lang.Runnable a_workerRunnable)
|
|
WorkerContentPane(JAPDialog a_parentDialog,
java.lang.String a_strText,
DialogContentPane a_previousContentPane,
java.lang.Runnable a_workerRunnable,
java.util.Observable a_observable)
|
|
WorkerContentPane(JAPDialog a_parentDialog,
java.lang.String a_strText,
java.lang.Runnable a_workerRunnable)
|
|
WorkerContentPane(JAPDialog a_parentDialog,
java.lang.String a_strText,
java.lang.Runnable a_workerRunnable,
java.util.Observable a_observable)
|
|
WorkerContentPane(JAPDialog a_parentDialog,
java.lang.String a_strText,
java.lang.String a_strTitle,
DialogContentPane a_previousContentPane,
java.lang.Runnable a_workerRunnable)
|
|
WorkerContentPane(JAPDialog a_parentDialog,
java.lang.String a_strText,
java.lang.String a_strTitle,
DialogContentPane a_previousContentPane,
java.lang.Runnable a_workerRunnable,
java.util.Observable a_observable)
|
|
WorkerContentPane(JAPDialog a_parentDialog,
java.lang.String a_strText,
java.lang.String a_strTitle,
java.lang.Runnable a_workerRunnable)
|
|
WorkerContentPane(JAPDialog a_parentDialog,
java.lang.String a_strText,
java.lang.String a_strTitle,
java.lang.Runnable a_workerRunnable,
java.util.Observable a_observable)
|
Method Summary | |
---|---|
DialogContentPane.CheckError[] |
checkCancel()
Interrupts the Thread. |
void |
dispose()
|
int |
getProgressStatus()
Only meaningful if a ProgressCapsule observer is used. |
java.lang.Object |
getValue()
If an instance of IReturnRunnable is run, this method returns the result of IReturnRunnable.getValue(). |
void |
interruptWorkerThread()
Interrupts the thread. |
boolean |
isInterruptThreadSafe()
Returns true if the content pane only does a close or move operation if the thread has stopped. |
boolean |
isReady()
Returns if the content pane is ready to start a new thread. |
boolean |
isSkippedAsPreviousContentPane()
Returns true by default, that means this worker content pane is skipped if a move from the next content pane to this one is done. |
void |
joinThread()
The caller waits until the thread has stopped. |
void |
setInterruptThreadSafe(boolean a_bInterruptThreadSafe)
Defines this content pane should interrupt the wrapped thread safe or not if the user closed the parent dialog or clicked cancel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String IMG_BUSY
public static final java.lang.String MSG_PLEASE_WAIT
public static final java.lang.String DOTS
private java.lang.Thread m_workerThread
private java.lang.Runnable m_workerRunnable
private java.lang.Thread m_internalThread
private boolean m_bInterruptThreadSafe
private int m_iProgressStatus
Constructor Detail |
---|
public WorkerContentPane(JAPDialog a_parentDialog, java.lang.String a_strText, java.lang.Runnable a_workerRunnable)
public WorkerContentPane(JAPDialog a_parentDialog, java.lang.String a_strText, java.lang.Runnable a_workerRunnable, java.util.Observable a_observable)
public WorkerContentPane(JAPDialog a_parentDialog, java.lang.String a_strText, java.lang.String a_strTitle, java.lang.Runnable a_workerRunnable)
public WorkerContentPane(JAPDialog a_parentDialog, java.lang.String a_strText, java.lang.String a_strTitle, java.lang.Runnable a_workerRunnable, java.util.Observable a_observable)
public WorkerContentPane(JAPDialog a_parentDialog, java.lang.String a_strText, DialogContentPane a_previousContentPane, java.lang.Runnable a_workerRunnable)
public WorkerContentPane(JAPDialog a_parentDialog, java.lang.String a_strText, DialogContentPane a_previousContentPane, java.lang.Runnable a_workerRunnable, java.util.Observable a_observable)
public WorkerContentPane(JAPDialog a_parentDialog, java.lang.String a_strText, java.lang.String a_strTitle, DialogContentPane a_previousContentPane, java.lang.Runnable a_workerRunnable)
public WorkerContentPane(JAPDialog a_parentDialog, java.lang.String a_strText, java.lang.String a_strTitle, DialogContentPane a_previousContentPane, java.lang.Runnable a_workerRunnable, java.util.Observable a_observable)
Method Detail |
---|
public final boolean isInterruptThreadSafe()
joinThread()
to safely wait for the end of the thread before starting a new one.
Remember that a call to updateDialog() of this content pane gives an undefined result if the previously
startet thread has not stopped yet.
public final void setInterruptThreadSafe(boolean a_bInterruptThreadSafe)
a_bInterruptThreadSafe
- true if the content pane only does a close or move operation if the
thread has stopped. Otherwise, the close or move operation is performed if the thread has been
interrupted by closing the dialog window or clicking on the cancel button. If you want this, the
calling thread is recommended to call joinThread()
to safely wait for the end of the
thread before starting a new one. Remember that a call to updateDialog() of this content pane
gives an undefined result if the previously started thread has not stopped yet.public final void joinThread()
public boolean isReady()
true
after the thread has stopped.
public boolean isSkippedAsPreviousContentPane()
isSkippedAsPreviousContentPane
in class DialogContentPane
public DialogContentPane.CheckError[] checkCancel()
checkCancel
in class DialogContentPane
public void dispose()
dispose
in class DialogContentPane
public int getProgressStatus()
public void interruptWorkerThread()
public java.lang.Object getValue()
null
is returned.
getValue
in class DialogContentPane
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |