Extension SDK 10.1.2

oracle.javatools.dialogs.progress
Class DeterminateProgressMonitor

java.lang.Object
  extended byoracle.javatools.dialogs.progress.AbstractProgressMonitor
      extended byoracle.javatools.dialogs.progress.DeterminateProgressMonitor

public class DeterminateProgressMonitor
extends oracle.javatools.dialogs.progress.AbstractProgressMonitor

A progress monitor implementation for determinate progress feedback.

This class is based on Swing's ProgressMonitor, but the implementation conforms to user interface specifications and offers the following additional features:

By default, the progress monitor will not use a delay before making the dialog visible. Recommended settings for the popup decision and delay are 500 and 2000 milliseconds respectively. Thread advice - instances of this class should be configured and their methods invoked from a consumer worker thread and not the AWT event dispatcher thread, which must be left free to process events.

See Also:
IndeterminateProgressMonitor

Constructor Summary
DeterminateProgressMonitor(java.awt.Component parent, java.lang.String title)
           
DeterminateProgressMonitor(java.awt.Component parent, java.lang.String title, int min, int max)
           
DeterminateProgressMonitor(java.awt.Component parent, java.lang.String title, java.lang.Object message, java.lang.String note)
           
DeterminateProgressMonitor(java.awt.Component parent, java.lang.String title, java.lang.Object message, java.lang.String note, int min, int max)
           
 
Method Summary
 void close()
          Indicates that the operation is complete.
protected  void closeImpl()
           
protected  javax.swing.JProgressBar createProgressBar()
           
 void display()
          Forces the progress dialog to be displayed, regardless of timing.
protected  void displayImpl()
           
 void finish()
          Finishes progress indication by setting the level to its maximum ahead of monitor closure.
protected  void finishImpl(javax.swing.JProgressBar progressBar)
           
 boolean getCloseOnFinish()
          Asks whether the monitor's dialog will close when responding to the AbstractProgressMonitor.finish() method.
 java.awt.Component getComponent()
          Gets the progress monitor dialog component, if created.
 java.awt.Component getDetailContent()
          Returns the content of the dialog to appear in a 'details' section.
 int getMaximum()
          Returns the maximum value -- the higher end of the progress value.
 int getMillisToDecideToPopup()
          Returns the amount of time this object waits before deciding whether or not to popup a progress monitor.
 int getMillisToPopup()
          Returns the amount of time it will take for the popup to appear.
 int getMinimum()
          Returns the minimum value -- the lower end of the progress value.
 ProgressPanel getPanel()
          Gets the panel component for this progress monitor.
 int getProgress()
          Get the current progress.
 void incProgress()
          Increment the current progress by one.
 void incProgress(int increment)
          Increment the current progress by the specified amount
 boolean isBarVisible()
          Returns the visibility of the dialog's progress bar before it is shown.
 boolean isCanceled()
          Returns true if the user hits the Cancel button in the progress dialog.
 boolean isCancellable()
          Returns whether the progress dialog can be cancelled.
 boolean isCancelled()
          Returns true if the user hits the Cancel button in the progress dialog.
 void setBarVisible(boolean barVisible)
          Specifies the visibility of the dialog's progress bar before it is shown.
 void setCancellable(boolean cancellable)
          Specifies whether the progress dialog can be cancelled.
 void setCloseOnFinish(boolean closeOnFinish)
          Sets whether the monitor's dialog should close when responding to the AbstractProgressMonitor.finish() method.
 void setDetailContent(java.awt.Component detailContent)
          Specifies the content of the dialog to appear in a 'details' section.
 void setMaximum(int m)
          Specifies the maximum value.
 void setMillisToDecideToPopup(int millisToDecideToPopup)
          Specifies the amount of time to wait before deciding whether or not to popup a progress monitor.
 void setMillisToPopup(int millisToPopup)
          Specifies the amount of time it will take for the popup to appear.
 void setMinimum(int m)
          Specifies the minimum value.
 void setProgress(int nv)
          Indicates the progress of the operation being monitored.
 void uncancel()
          Resets the cancelled state of the progress dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeterminateProgressMonitor

public DeterminateProgressMonitor(java.awt.Component parent,
                                  java.lang.String title)

DeterminateProgressMonitor

public DeterminateProgressMonitor(java.awt.Component parent,
                                  java.lang.String title,
                                  int min,
                                  int max)

DeterminateProgressMonitor

public DeterminateProgressMonitor(java.awt.Component parent,
                                  java.lang.String title,
                                  java.lang.Object message,
                                  java.lang.String note)

DeterminateProgressMonitor

public DeterminateProgressMonitor(java.awt.Component parent,
                                  java.lang.String title,
                                  java.lang.Object message,
                                  java.lang.String note,
                                  int min,
                                  int max)
Method Detail

getProgress

public int getProgress()
Get the current progress.

Returns:
the current progress.

incProgress

public void incProgress()
Increment the current progress by one.


incProgress

public void incProgress(int increment)
Increment the current progress by the specified amount

Parameters:
increment - amount to increase progress by

setProgress

public void setProgress(int nv)
Indicates the progress of the operation being monitored. If the specified value is >= the maximum, the progress monitor is closed. Do not invoke from the AWT event thread.

Parameters:
nv - an int specifying the current value, between the maximum and minimum specified for this component
See Also:
setMinimum(int), setMaximum(int), AbstractProgressMonitor.close()

getMinimum

public int getMinimum()
Returns the minimum value -- the lower end of the progress value.

Returns:
an int representing the minimum value
See Also:
setMinimum(int)

setMinimum

public void setMinimum(int m)
Specifies the minimum value.

Parameters:
m - an int specifying the minimum value
See Also:
getMinimum()

getMaximum

public int getMaximum()
Returns the maximum value -- the higher end of the progress value.

Returns:
an int representing the maximum value
See Also:
setMaximum(int)

setMaximum

public void setMaximum(int m)
Specifies the maximum value.

Parameters:
m - an int specifying the maximum value
See Also:
getMaximum()

setMillisToDecideToPopup

public void setMillisToDecideToPopup(int millisToDecideToPopup)
Specifies the amount of time to wait before deciding whether or not to popup a progress monitor.

Parameters:
millisToDecideToPopup - an int specifying the time to wait, in milliseconds
See Also:
getMillisToDecideToPopup()

getMillisToDecideToPopup

public int getMillisToDecideToPopup()
Returns the amount of time this object waits before deciding whether or not to popup a progress monitor.

See Also:
setMillisToDecideToPopup(int)

createProgressBar

protected javax.swing.JProgressBar createProgressBar()

finishImpl

protected void finishImpl(javax.swing.JProgressBar progressBar)

setCloseOnFinish

public void setCloseOnFinish(boolean closeOnFinish)
Sets whether the monitor's dialog should close when responding to the AbstractProgressMonitor.finish() method.

Parameters:
closeOnFinish - a decision on dialog closure.

getCloseOnFinish

public boolean getCloseOnFinish()
Asks whether the monitor's dialog will close when responding to the AbstractProgressMonitor.finish() method.


finish

public void finish()
Finishes progress indication by setting the level to its maximum ahead of monitor closure.


close

public void close()
Indicates that the operation is complete. This happens automatically when the value set by setProgress is >= max, but it may be called earlier if the operation ends early.


isCanceled

public boolean isCanceled()
Returns true if the user hits the Cancel button in the progress dialog.


setMillisToPopup

public void setMillisToPopup(int millisToPopup)
Specifies the amount of time it will take for the popup to appear. (If the predicted time remaining is less than this time, the popup won't be displayed.)

Parameters:
millisToPopup - an int specifying the time in milliseconds
See Also:
AbstractProgressMonitor.getMillisToPopup()

getMillisToPopup

public int getMillisToPopup()
Returns the amount of time it will take for the popup to appear.

See Also:
AbstractProgressMonitor.setMillisToPopup(int)

setDetailContent

public void setDetailContent(java.awt.Component detailContent)
Specifies the content of the dialog to appear in a 'details' section. This part of the dialog is made optionally visible on a button.

Parameters:
detailContent - the detail content component.
See Also:
AbstractProgressMonitor.getDetailContent()

getDetailContent

public java.awt.Component getDetailContent()
Returns the content of the dialog to appear in a 'details' section.

Returns:
the detail content component.
See Also:
AbstractProgressMonitor.setDetailContent(java.awt.Component)

setBarVisible

public void setBarVisible(boolean barVisible)
Specifies the visibility of the dialog's progress bar before it is shown.

Parameters:
barVisible - the visibility value.
See Also:
AbstractProgressMonitor.isBarVisible()

isBarVisible

public boolean isBarVisible()
Returns the visibility of the dialog's progress bar before it is shown.

Returns:
the visibility value.
See Also:
AbstractProgressMonitor.setBarVisible(boolean)

setCancellable

public void setCancellable(boolean cancellable)
Specifies whether the progress dialog can be cancelled.

Parameters:
cancellable - the cancellable value.
See Also:
AbstractProgressMonitor.isCancellable()

isCancellable

public boolean isCancellable()
Returns whether the progress dialog can be cancelled.

Returns:
the cancellable value.
See Also:
AbstractProgressMonitor.setCancellable(boolean)

display

public void display()
Forces the progress dialog to be displayed, regardless of timing. Do not invoke from the AWT event thread.

See Also:
AbstractProgressMonitor.close()

getComponent

public java.awt.Component getComponent()
Gets the progress monitor dialog component, if created.

Returns:
the dialog component.

isCancelled

public boolean isCancelled()
Returns true if the user hits the Cancel button in the progress dialog.

Returns:
the cancellation value.

uncancel

public void uncancel()
Resets the cancelled state of the progress dialog. The cancel button will be re-enabled if the user has previously cancelled the dialog.


getPanel

public ProgressPanel getPanel()
Gets the panel component for this progress monitor.

Returns:
the progress panel.

displayImpl

protected void displayImpl()

closeImpl

protected void closeImpl()

Extension SDK

 

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