jview
Class TimerDrivenProgressMonitor

java.lang.Object
  extended by javax.swing.ProgressMonitor
      extended by jview.TimerDrivenProgressMonitor
All Implemented Interfaces:
ActionListener, EventListener, Accessible

public class TimerDrivenProgressMonitor
extends ProgressMonitor
implements ActionListener

An extension to a ProgressMonitor that needs no further interaction by the user, as the minimum and maximum supplied are used for a timer process.


Nested Class Summary
static class TimerDrivenProgressMonitor.Show
          Test class.
 
Nested classes/interfaces inherited from class javax.swing.ProgressMonitor
ProgressMonitor.AccessibleProgressMonitor
 
Field Summary
private  Timer clock
          The swing timer that fires the action events on the progress monitor.
private  int count
          The count intervall in ms.
private static int MININTERVALL
          The minimum action-event firing intervall in ms.
private  String orgnote
          The note without any time adds.
private  boolean persistent
          If true, dialog stays open until closed.
private  int sum
          The summed-up time.
 
Fields inherited from class javax.swing.ProgressMonitor
accessibleContext
 
Constructor Summary
TimerDrivenProgressMonitor(Component parent, Object message, String note, int min, long len)
          Constructs a new timer-driven progress monitor.
TimerDrivenProgressMonitor(Component parent, Object message, String note, int min, long len, boolean stay)
          Constructs a new timer-driven progress monitor.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          The action events fired by the timer.
 void close()
          This method is called by the parental class if the progress is bigger or equal to the maximum.
 void setProgress(int newsum)
          We have to store our progress for internal accumulating in the timer events.
 
Methods inherited from class javax.swing.ProgressMonitor
getAccessibleContext, getMaximum, getMillisToDecideToPopup, getMillisToPopup, getMinimum, getNote, isCanceled, setMaximum, setMillisToDecideToPopup, setMillisToPopup, setMinimum, setNote
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MININTERVALL

private static final int MININTERVALL
The minimum action-event firing intervall in ms.

See Also:
Constant Field Values

count

private int count
The count intervall in ms.


sum

private int sum
The summed-up time.


persistent

private boolean persistent
If true, dialog stays open until closed.


orgnote

private String orgnote
The note without any time adds.


clock

private Timer clock
The swing timer that fires the action events on the progress monitor.

Constructor Detail

TimerDrivenProgressMonitor

public TimerDrivenProgressMonitor(Component parent,
                                  Object message,
                                  String note,
                                  int min,
                                  long len)
Constructs a new timer-driven progress monitor. The minimum and maximum values supplied are used in a way that they define an initial delay and a total time (not the total time minus initial delay), both in milliseconds. Note that the initial delay only defines a delay after which the bar stars counting, the time until it is displayed is still defined by the millis-to-popup methods. When time runs out, the progress monitor is closed automatically.


TimerDrivenProgressMonitor

public TimerDrivenProgressMonitor(Component parent,
                                  Object message,
                                  String note,
                                  int min,
                                  long len,
                                  boolean stay)
Constructs a new timer-driven progress monitor. The minimum and maximum values supplied are used in a way that they define an initial delay and a total time (not the total time minus initial delay), both in milliseconds. Note that the initial delay only defines a delay after which the bar stars counting, the time until it is displayed is still defined by the millis-to-popup methods. If the last argument is true, the progress monitor stays open until manually closed.

Method Detail

actionPerformed

public void actionPerformed(ActionEvent ae)
The action events fired by the timer. Each action event increases the progress for count milliseconds.

Specified by:
actionPerformed in interface ActionListener

setProgress

public void setProgress(int newsum)
We have to store our progress for internal accumulating in the timer events. As the parental class has no getProgress mthod, we store the progress in the cumulated sum.

Overrides:
setProgress in class ProgressMonitor

close

public void close()
This method is called by the parental class if the progress is bigger or equal to the maximum. We end the timer task here.

Overrides:
close in class ProgressMonitor