bodhidharma.utilities
Class LargeProgressBarTaskMonitor

java.lang.Object
  extended by bodhidharma.utilities.LargeProgressBarTaskMonitor
Direct Known Subclasses:
ProgressBarTaskTrainMonitor

public abstract class LargeProgressBarTaskMonitor
extends java.lang.Object

An abstract class that is used by LargeProgressBarDialog windows in order to perform the processing that is measured by the window as well as keep the window updated.

All parts of this class are implemented here except for the go method. This method should use a SwingWorker object to start and perform the task to be performed. It should also keep the fields of this object updated so that they can be queried by the calling LargeProgressBarDialog.

The part of the class implemented here essentially provides an interface for the calling LargeProgressBarDialog and calculates the time elapsed and the estimated processing time remaining. The get and is methods can be called to get updates on how the process is progressing. The stop method can be called in order to stop processing if the process is to be cancelled. The markTaskComplete method is used to note that the task has been completed.

See Also:
LargeProgressBarDialog, SwingWorker
Author:
Cory McKay

Field Summary
protected  int bottom_current_amount_completed
           
protected  int bottom_length_of_task
           
protected  java.lang.String bottom_progress_message
           
protected  long bottom_time_started
           
protected  int middle_current_amount_completed
           
protected  int middle_length_of_task
           
protected  java.lang.String middle_progress_message
           
protected  long middle_time_started
           
protected  boolean new_bottom_task_started
           
protected  boolean new_middle_task_started
           
protected  boolean new_top_task_started
           
protected  boolean task_canceled
           
protected  boolean task_completed
           
protected  int top_current_amount_completed
           
protected  int top_length_of_task
           
protected  java.lang.String top_progress_message
           
protected  long top_time_started
           
 
Constructor Summary
LargeProgressBarTaskMonitor()
          Basic constructor that sets other private fields to defaluts.
 
Method Summary
protected  java.lang.String findTimeWithProperUnits(int seconds)
           
 int getBottomCurrentAmountCompleted()
          Called from a LargeProgressBarDialog to find out how many sub-tasks have been done.
 int getBottomLengthOfTask()
          Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.
 java.lang.String getBottomTextMessage()
          Returns a String indicating how much time has already passed and the estimated time remaining as well as the task currently being performed.
 int getMiddleCurrentAmountCompleted()
          Called from a LargeProgressBarDialog to find out how many sub-tasks have been done.
 int getMiddleLengthOfTask()
          Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.
 java.lang.String getMiddleTextMessage()
          Returns a String indicating how much time has already passed and the estimated time remaining as well as the task currently being performed.
 int getTopCurrentAmountCompleted()
          Called from a LargeProgressBarDialog to find out how many sub-tasks have been done.
 int getTopLengthOfTask()
          Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.
 java.lang.String getTopTextMessage()
          Returns a String indicating how much time has already passed and the estimated time remaining as well as the task currently being performed.
abstract  void go()
          Called from ProgressBarDialog to start the overall task.
 boolean isCancelled()
          Called if the overall task has been cancelled.
 boolean isDone()
          Called to find out if the overall task has completed.
 void markTaskComplete()
          Called if the overall task is complete.
 boolean startNewBottomProgress()
          Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.
 boolean startNewMiddleProgress()
          Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.
 boolean startNewTopProgress()
          Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.
 void stop()
          Called if the overall task is cancelled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

top_length_of_task

protected int top_length_of_task

middle_length_of_task

protected int middle_length_of_task

bottom_length_of_task

protected int bottom_length_of_task

new_top_task_started

protected boolean new_top_task_started

new_middle_task_started

protected boolean new_middle_task_started

new_bottom_task_started

protected boolean new_bottom_task_started

top_current_amount_completed

protected int top_current_amount_completed

middle_current_amount_completed

protected int middle_current_amount_completed

bottom_current_amount_completed

protected int bottom_current_amount_completed

top_time_started

protected long top_time_started

middle_time_started

protected long middle_time_started

bottom_time_started

protected long bottom_time_started

top_progress_message

protected java.lang.String top_progress_message

middle_progress_message

protected java.lang.String middle_progress_message

bottom_progress_message

protected java.lang.String bottom_progress_message

task_completed

protected boolean task_completed

task_canceled

protected boolean task_canceled
Constructor Detail

LargeProgressBarTaskMonitor

public LargeProgressBarTaskMonitor()
Basic constructor that sets other private fields to defaluts.

Method Detail

go

public abstract void go()
Called from ProgressBarDialog to start the overall task. Sets up a SwingWorker object to carry out the thread and sets time_started. Keeps the appropriate fields updated (see above).


startNewTopProgress

public boolean startNewTopProgress()
Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.


startNewMiddleProgress

public boolean startNewMiddleProgress()
Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.


startNewBottomProgress

public boolean startNewBottomProgress()
Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.


getTopLengthOfTask

public int getTopLengthOfTask()
Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.


getMiddleLengthOfTask

public int getMiddleLengthOfTask()
Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.


getBottomLengthOfTask

public int getBottomLengthOfTask()
Called from a LargeProgressBarDialog to find out how many sub-tasks remain to be done.


getTopCurrentAmountCompleted

public int getTopCurrentAmountCompleted()
Called from a LargeProgressBarDialog to find out how many sub-tasks have been done.


getMiddleCurrentAmountCompleted

public int getMiddleCurrentAmountCompleted()
Called from a LargeProgressBarDialog to find out how many sub-tasks have been done.


getBottomCurrentAmountCompleted

public int getBottomCurrentAmountCompleted()
Called from a LargeProgressBarDialog to find out how many sub-tasks have been done.


isDone

public boolean isDone()
Called to find out if the overall task has completed.


isCancelled

public boolean isCancelled()
Called if the overall task has been cancelled.


getTopTextMessage

public java.lang.String getTopTextMessage()
Returns a String indicating how much time has already passed and the estimated time remaining as well as the task currently being performed.


getMiddleTextMessage

public java.lang.String getMiddleTextMessage()
Returns a String indicating how much time has already passed and the estimated time remaining as well as the task currently being performed.


getBottomTextMessage

public java.lang.String getBottomTextMessage()
Returns a String indicating how much time has already passed and the estimated time remaining as well as the task currently being performed.


stop

public void stop()
Called if the overall task is cancelled. Stops processing.


markTaskComplete

public void markTaskComplete()
Called if the overall task is complete. Stops processing.


findTimeWithProperUnits

protected java.lang.String findTimeWithProperUnits(int seconds)