Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

oracle.ide.dialogs
Class ProgressRunnable

java.lang.Object
  extended by oracle.ide.dialogs.ProgressRunnable
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
DatabaseFinder

public abstract class ProgressRunnable
extends java.lang.Object
implements java.lang.Runnable

The ProgressRunnable class provides a mechanism for performing connection related operations on another thread. A progress dialog with a cancel button is presented to the user. If the user elects to cancel the operation, control is returned. If, after a certain amount of time, the background thread is still running, it will be stopped. This means that a certain amount of care should be taken when using ProgressRunnable; as stopping a thread is somewhat risky, developer should ensure that the background thread will not leave any data in an unstable state if stopped.

Also, note that canceling the dialog does not abort the operation; it just returns control to the user. The operation may actually complete if it is within a certain amount of time. As such, developers should also take care to ensure that the operation is something that can be allowed to complete in the background. One example of this is connection to a database; if the user cancels the connection, completing the connection in the background but then ignoring the results should be harmless.

Any exceptions that occur during the operation will be passed back to the calling code so that they can be displayed to the user (for example, errors that occur when a connection attempt fails).

To use ProgressRunnable, developers need to create a concrete subclass. In this subclass, the doWork method must be implemented. This method will be called on the background thread to perform the work. Additionally, the finish can be overridden in order to perform any post-work operations back on the original thread.

Since:
9.0.3

Constructor Summary
ProgressRunnable()
          Creates a new ProgressRunnable instance.
 
Method Summary
protected  void doCancel()
           
protected abstract  java.lang.Object doWork()
          The actually operation that should be performed by this ProgressRunnable.
protected  void finish(java.lang.Object result)
          Called back on the original thread after the operation has completed or was canceled.
 java.lang.String getMessage()
          Retrieves the message that will be displayed in the progress dialog while the operation is proceeding.
protected  int getProgressShowDelay()
           
protected  java.lang.Thread getRunnerThread()
           
 java.lang.String getTitle()
          Retrieves the title that will be used by the progress dialog.
 boolean isCancelable()
           
 void run()
           
 void setCancelable(boolean canCancel)
           
 void setMessage(java.lang.String msg)
          Sets the message that will be displayed in the progress dialog while the operation is proceeding.
 void setTitle(java.lang.String title)
          Sets the title that will be used by the progress dialog.
 void start(boolean useThread)
          Starts the operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressRunnable

public ProgressRunnable()
Creates a new ProgressRunnable instance.

Method Detail

setTitle

public final void setTitle(java.lang.String title)
Sets the title that will be used by the progress dialog.


getTitle

public final java.lang.String getTitle()
Retrieves the title that will be used by the progress dialog.


setMessage

public final void setMessage(java.lang.String msg)
Sets the message that will be displayed in the progress dialog while the operation is proceeding.


getMessage

public final java.lang.String getMessage()
Retrieves the message that will be displayed in the progress dialog while the operation is proceeding.


setCancelable

public final void setCancelable(boolean canCancel)

isCancelable

public final boolean isCancelable()

start

public final void start(boolean useThread)
                 throws ProgressException
Starts the operation. This method is called by the client requesting that the work be done.

Parameters:
useThread - whether the work should be done on a different thread or not.
Throws:
java.lang.Exception - thrown if an error occurs during operation
ProgressException

getProgressShowDelay

protected int getProgressShowDelay()

run

public final void run()
Specified by:
run in interface java.lang.Runnable

doWork

protected abstract java.lang.Object doWork()
                                    throws java.lang.Exception
The actually operation that should be performed by this ProgressRunnable.

Returns:
the result of the work. This result will be passed into the finish method.
Throws:
java.lang.Exception - if any exception occurs during operation.

finish

protected void finish(java.lang.Object result)
Called back on the original thread after the operation has completed or was canceled.

Parameters:
result - the result of the operation, or null if the operation was cancelled.

doCancel

protected void doCancel()

getRunnerThread

protected final java.lang.Thread getRunnerThread()

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

Copyright © 1997, 2013, Oracle. All rights reserved.