org.progeeks.util.swing
Class SwingProgressReporter

java.lang.Object
  extended by org.progeeks.util.swing.SwingProgressReporter
All Implemented Interfaces:
ProgressReporter

public class SwingProgressReporter
extends java.lang.Object
implements ProgressReporter

A swing implementation of a progress reporter window. This is similar to a ProgressMonitor except that it doesn't have any of the delayed pop-up characteristics. It also supports a progress bar that is in an indeterminate state. This class may someday support progress aggregation by allowing multiple tasks to be registered. In that case, it will have to be wrapped by separate progress reporters for each sub-task or it can provide progress monitors for its subtasks.

Version:
$Revision: 1.2 $
Author:
Paul Speed

Constructor Summary
SwingProgressReporter(java.awt.Component parent, java.lang.String title, java.lang.String message, int min, int max)
          Creates a new progress reporter that uses a swing JOptionPane to display status.
 
Method Summary
 void done()
          Indicates that the operation has completed.
 int getMaximum()
          Returns the maximum progress value.
 java.lang.String getMessage()
          Returns the string message associated with the current part of the task being performed.
 int getMinimum()
          Returns the minimum progress value.
 int getProgress()
          Returns the current progress amount.
 boolean isCanceled()
          Returns true when the operation has been canceled by the user.
 void setMaximum(int val)
          Sets the maximum progress value.
 void setMessage(java.lang.String message)
          Sets the string message associated with the current part of the task being performed.
 void setMinimum(int val)
          Sets the minimum progress value.
 void setProgress(int val)
          Sets the current progress amount.
protected  boolean shouldBeIndeterminate()
          Returns true if the bar should be indeterminate based on its min/max values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingProgressReporter

public SwingProgressReporter(java.awt.Component parent,
                             java.lang.String title,
                             java.lang.String message,
                             int min,
                             int max)
Creates a new progress reporter that uses a swing JOptionPane to display status. If the min and max are both set to -1 then the progress bar is put in an indeterminate state as defined by JProgressBar.setIndeterminate(true).

Method Detail

shouldBeIndeterminate

protected boolean shouldBeIndeterminate()
Returns true if the bar should be indeterminate based on its min/max values.


setMessage

public void setMessage(java.lang.String message)
Sets the string message associated with the current part of the task being performed.

Specified by:
setMessage in interface ProgressReporter

getMessage

public java.lang.String getMessage()
Returns the string message associated with the current part of the task being performed.

Specified by:
getMessage in interface ProgressReporter

setProgress

public void setProgress(int val)
Sets the current progress amount.

Specified by:
setProgress in interface ProgressReporter

getProgress

public int getProgress()
Returns the current progress amount.

Specified by:
getProgress in interface ProgressReporter

setMinimum

public void setMinimum(int val)
Sets the minimum progress value.

Specified by:
setMinimum in interface ProgressReporter

getMinimum

public int getMinimum()
Returns the minimum progress value.

Specified by:
getMinimum in interface ProgressReporter

setMaximum

public void setMaximum(int val)
Sets the maximum progress value.

Specified by:
setMaximum in interface ProgressReporter

getMaximum

public int getMaximum()
Returns the maximum progress value.

Specified by:
getMaximum in interface ProgressReporter

isCanceled

public boolean isCanceled()
Returns true when the operation has been canceled by the user. The active task should check this flag to discontinue its operation in the event of a user-cancel. Default implementation always returns false.

Specified by:
isCanceled in interface ProgressReporter

done

public void done()
Indicates that the operation has completed. Default implementation does nothing.

Specified by:
done in interface ProgressReporter


Copyright © 2002-2003 Paul Speed. All Rights Reserved.