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

E13403-04

oracle.ide.db.controls
Class RestartableProgressBar

java.lang.Object
  extended by oracle.ide.db.controls.RestartableProgressBar
All Implemented Interfaces:
java.lang.Runnable

public class RestartableProgressBar
extends java.lang.Object
implements java.lang.Runnable

An extension of ProgressBar that allows the user to wait on the original progress thread completing

Since:
release specific (what release of product did this appear in)

Constructor Summary
RestartableProgressBar(java.awt.Component parent, java.lang.String dialogTitle, java.lang.Runnable runnable, boolean useBusyBar)
          Constructor.
 
Method Summary
 int getStatus()
           
 boolean hasUserCancelled()
          The client code's run() method that implements the long-running process should call this method to determine if the user has pressed the Cancel button on the ProgressBar's dialog to terminate the long-running process.
 boolean isCancelable()
           
 void run()
          The entrypoint for the thread that executes the long-running process.
 void setCancelable(boolean canCancel)
           
 void setDoneStatus()
          The client code should call this when the long-running process is complete.
 void setThreadComplete(boolean complete)
           
 void sleepForUIToRepaint()
          The client code should call this in it's run() method that implements the long-running process.
 void start(java.lang.String initialText, java.lang.String stepText)
          Starts the ProgressBar.
 void updateProgress(int completionStatus, java.lang.String progressText, java.lang.String stepText)
          The client code's run() method that implements the long-running process should use this method to update the ProgressBar to indicate the progress made in the long-running process.
 void updateProgress(java.lang.String progressText, java.lang.String stepText)
          The client code's run() method that implements the long-running process should use this method to update the ProgressBar to indicate the progress made in the long-running process.
 void waitUntilDone()
          The client code should call this to wait until the long-running process is complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestartableProgressBar

public RestartableProgressBar(java.awt.Component parent,
                              java.lang.String dialogTitle,
                              java.lang.Runnable runnable,
                              boolean useBusyBar)
Constructor. Creates the ProgressBar object

Parameters:
parent - The UI object to use as the ProgressBar dialog's parent
dialogTitle - The title to use for the ProgressBar dialog
runnable - The Runnable object whose run() method implements the long-running process
useBusyBar - Set to true when the task is indeterminate; false when the the task is determinate
Method Detail

setCancelable

public void setCancelable(boolean canCancel)

isCancelable

public boolean isCancelable()

start

public void start(java.lang.String initialText,
                  java.lang.String stepText)
Starts the ProgressBar. If the thread is already running, this just diplays a progress bar whilst waiting for the thread to complete. If no thread is running, this starts a thread.

Parameters:
initialText - The text to display just above the progress indicator. An example might be "Downloading components."
stepText - The text to display just below the progress indicator. An example might be "Retrieving file abc.jar."

updateProgress

public void updateProgress(int completionStatus,
                           java.lang.String progressText,
                           java.lang.String stepText)
The client code's run() method that implements the long-running process should use this method to update the ProgressBar to indicate the progress made in the long-running process. Use this method only when the indicator used is the JProgressBar not the BusyBar.

Parameters:
completionStatus - The amount of progress that has been made.
progressText - The text to display just above the progress indicator. If a null string or zero-length string is passed in the text will not be updated.
stepText - The text to display just below the progress indicator. If a null string or zero-length string is passed in the text will not be updated.

updateProgress

public void updateProgress(java.lang.String progressText,
                           java.lang.String stepText)
The client code's run() method that implements the long-running process should use this method to update the ProgressBar to indicate the progress made in the long-running process. Use this method only when the indicator used is the BusyBar not the JProgressBar.

Parameters:
progressText - The text to display just above the progress indicator. If a null string or zero-length string is passed in the text will not be updated.
stepText - The text to display just below the progress indicator. If a null string or zero-length string is passed in the text will not be updated.

hasUserCancelled

public boolean hasUserCancelled()
The client code's run() method that implements the long-running process should call this method to determine if the user has pressed the Cancel button on the ProgressBar's dialog to terminate the long-running process. The long-running process should call this method fairly often and should clean up as necessary if the Cancel button has been pressed.

Returns:
true if the user has pressed the cancel button, false otherwise.

sleepForUIToRepaint

public void sleepForUIToRepaint()
The client code should call this in it's run() method that implements the long-running process. This method forces the long-running process to sleep for a little bit periodically to give the UI thread a chance to repaint. Every second or so force a sleep to make sure the UI has caught up.


waitUntilDone

public void waitUntilDone()
The client code should call this to wait until the long-running process is complete. ### Provide sample implementation ###


setDoneStatus

public void setDoneStatus()
The client code should call this when the long-running process is complete. ### provide sample implementation ###


run

public void run()
The entrypoint for the thread that executes the long-running process. This method should not be called by client code, it is public only because it must be public to match the Runnable interface.

Specified by:
run in interface java.lang.Runnable

getStatus

public int getStatus()

setThreadComplete

public void setThreadComplete(boolean complete)

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

E13403-04

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