uk.org.ogsadai.client.databrowser
Class DBProgressView

java.lang.Object
  |
  +--uk.org.ogsadai.client.databrowser.DBProgressView
All Implemented Interfaces:
java.util.Observer

public class DBProgressView
extends java.lang.Object
implements java.util.Observer

Displays the progress of a task.

Observes the DBProgressModel and displays information about the status of a task. Works for both tasks of indeterminate length and known length. Note that it sets the WAIT cursor for itself and its parent and catches any ActionEvent to prevent user interaction with the GUI while the task is running, so do not use if it is a background task and you want to allow the user to access the GUI.

Version:
$Revision: 1.3 $
Author:
Paul J Graham, EPCC
See Also:
DBProgressModel

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static java.awt.Cursor DEFAULT_CURSOR
           
private static int HEIGHT
           
private static boolean MODAL
           
private static java.awt.event.MouseAdapter MOUSEADAPTER
           
private  javax.swing.JRootPane mParentRootPane
           
private  javax.swing.JProgressBar mProgressBar
           
private  javax.swing.JDialog mProgressDialog
           
private  DBProgressModel mProgressModel
           
private  javax.swing.JLabel mSubtaskname
           
private  javax.swing.JLabel mTaskname
           
private static java.lang.String TITLE
           
private static java.awt.Cursor WAIT_CURSOR
           
private static int WIDTH
           
 
Constructor Summary
DBProgressView(javax.swing.JDialog parent, java.util.Observable observable)
          Shows a dialog displaying progress when triggered by DBProgressModel.
DBProgressView(javax.swing.JFrame parent, java.util.Observable observable)
          Shows a dialog displaying progress when triggered by DBProgressModel.
 
Method Summary
private  void finish()
          Task is finished so reset values and close the dialog
private  void initialise(java.util.Observable observable)
          Initialise the GUI variables and components.
private  void setProgress(java.lang.String message)
          Update the progress dialog with the latest progress
private  void start()
          Display the progress dialog
static void startWaitCursor(javax.swing.JComponent component)
          Sets the cursor to WAIT_CURSOR and absorbs the mouse clicks for the component
static void stopWaitCursor(javax.swing.JComponent component)
          Sets the cursor to DEFAULT_CURSOR and returns mouse click handling to normal
 void update(java.util.Observable observable, java.lang.Object updatedObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

WIDTH

private static final int WIDTH

HEIGHT

private static final int HEIGHT

TITLE

private static final java.lang.String TITLE
See Also:
Constant Field Values

MODAL

private static final boolean MODAL
See Also:
Constant Field Values

MOUSEADAPTER

private static final java.awt.event.MouseAdapter MOUSEADAPTER

WAIT_CURSOR

private static final java.awt.Cursor WAIT_CURSOR

DEFAULT_CURSOR

private static final java.awt.Cursor DEFAULT_CURSOR

mParentRootPane

private javax.swing.JRootPane mParentRootPane

mProgressDialog

private javax.swing.JDialog mProgressDialog

mProgressModel

private DBProgressModel mProgressModel

mTaskname

private javax.swing.JLabel mTaskname

mSubtaskname

private javax.swing.JLabel mSubtaskname

mProgressBar

private javax.swing.JProgressBar mProgressBar
Constructor Detail

DBProgressView

public DBProgressView(javax.swing.JFrame parent,
                      java.util.Observable observable)
Shows a dialog displaying progress when triggered by DBProgressModel. Will set the WAIT_CURSOR for its parent JFrame and itself while the task is running.

Parameters:
parent - The parent of this dialog
observable - The observable passing on info on the tasks progress (usually DBProgressModel)

DBProgressView

public DBProgressView(javax.swing.JDialog parent,
                      java.util.Observable observable)
Shows a dialog displaying progress when triggered by DBProgressModel. Will set the WAIT_CURSOR for its parent JDialog and itself while the task is running.

Parameters:
parent - The parent of this dialog
observable - The observable passing on info on the task's progress (usually DBProgressModel)
Method Detail

initialise

private void initialise(java.util.Observable observable)
Initialise the GUI variables and components.


update

public void update(java.util.Observable observable,
                   java.lang.Object updatedObject)
Specified by:
update in interface java.util.Observer

start

private void start()
Display the progress dialog


setProgress

private void setProgress(java.lang.String message)
Update the progress dialog with the latest progress

Parameters:
message - The subtask information

finish

private void finish()
Task is finished so reset values and close the dialog


startWaitCursor

public static void startWaitCursor(javax.swing.JComponent component)
Sets the cursor to WAIT_CURSOR and absorbs the mouse clicks for the component

Parameters:
component - The component for whom the cursor will be changed

stopWaitCursor

public static void stopWaitCursor(javax.swing.JComponent component)
Sets the cursor to DEFAULT_CURSOR and returns mouse click handling to normal

Parameters:
component - The component for whom the cursor will be changed