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

E13403-04

oracle.ide.dialogs
Class ProgressBar

java.lang.Object
  extended by oracle.ide.dialogs.ProgressBar
All Implemented Interfaces:
java.awt.event.ActionListener, java.lang.Runnable, java.util.EventListener

public class ProgressBar
extends java.lang.Object
implements java.awt.event.ActionListener, java.lang.Runnable

The ProgressBar provides the user with feedback while a long-running process is in progress. The dialog consists of a label known as the progressText, a progress indicator, and another label known as the stepText.

The progress indicator displayed is the javax.swing.JProgressBar

Client code must implement the Runnable interface in order to use the ProgressBar. The ProgressBar will create a new thread and invoke the run() method in the Runnable passed in via the constructor. This is done so the UI can be repainted while the long-running process is executing. Extension developers should not rely on the fact that this class implements ActionListener and Runnable. These are implementation details of this class, and should not have been exposed. Extension developers should also assume that this class is final.


Constructor Summary
ProgressBar(java.awt.Component parent, java.lang.String dialogTitle, java.lang.Runnable runnable, boolean useBusyBar)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Deprecated. since 11.1.1 this method should not have been exposed as a public API.
 int getCompletionStatus()
          Gets the amount of progress that has been reported so far.
 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()
          Deprecated. since 11.1.1 this method should not have been exposed as a public API.
 void setCancelable(boolean canCancel)
           
 void setDialogName(java.lang.String dialogName)
           
 void setDoneStatus()
          The client code should call this when the long-running process is complete.
 void setRunnable(java.lang.Runnable runnable)
           
 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 with a default range (0-100).
 void start(java.lang.String initialText, java.lang.String stepText, int delay)
          Starts the ProgressBar with a default range (0-100) after a delay.
 void start(java.lang.String initialText, java.lang.String stepText, int min, int max)
          Starts the ProgressBar with a specified range.
 void start(java.lang.String initialText, java.lang.String stepText, int min, int max, int delay)
          Starts the ProgressBar with a specified range after a delay.
 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

ProgressBar

public ProgressBar(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

setRunnable

public void setRunnable(java.lang.Runnable runnable)

setDialogName

public void setDialogName(java.lang.String dialogName)

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 with a default range (0-100).

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."

start

public void start(java.lang.String initialText,
                  java.lang.String stepText,
                  int delay)
Starts the ProgressBar with a default range (0-100) after a delay.

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."
delay - The number of milliseconds to wait before showing the progress dialog

start

public void start(java.lang.String initialText,
                  java.lang.String stepText,
                  int min,
                  int max)
Starts the ProgressBar with a specified range.

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."
min - the minimum progress to report (typically this will be 0)
max - the maximum progress to be reported

start

public void start(java.lang.String initialText,
                  java.lang.String stepText,
                  int min,
                  int max,
                  int delay)
Starts the ProgressBar with a specified range after a delay.

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."
min - the minimum progress to report (typically this will be 0)
max - the maximum progress to be reported
delay - The number of milliseconds to wait before showing the progress dialog

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.

getCompletionStatus

public int getCompletionStatus()
Gets the amount of progress that has been reported so far.


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 ###


actionPerformed

@Deprecated
public void actionPerformed(java.awt.event.ActionEvent event)
Deprecated. since 11.1.1 this method should not have been exposed as a public API.

This is invoked when an action is performed. In this case, it should only be a Timer event. Client code should not invoke this method, it is public only to match the ActionInterface.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - the action event

run

@Deprecated
public void run()
Deprecated. since 11.1.1 this method should not have been exposed as a public API.

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

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.