info.jonclark.gui
Class ProgressClient

java.lang.Object
  extended by info.jonclark.gui.ProgressClient
All Implemented Interfaces:
info.jonclark.clientserver.ReconnectionListener

public class ProgressClient
extends Object
implements info.jonclark.clientserver.ReconnectionListener

A client program that sends the status of its progress to a ProgressServer or group of ProgressServers, if possible. If a connection cannot be made to one or more of the progress servers, the program attempts to connect to them at regular intervals while the task continues uninterrupted.


Field Summary
static int TYPE_BAR
           
static int TYPE_TEXT
           
static int UPDATE_DELAY
           
 
Constructor Summary
ProgressClient(Properties props, Logger parent)
           
 
Method Summary
 void connectionReestablished(info.jonclark.clientserver.ClientInterface client)
          Connection has just been reestablished.
static void main(String[] args)
           
 void sendFullStatus(info.jonclark.clientserver.ClientInterface client)
          Send the full status of the task.
 void setDone(boolean success)
          Announce that this task is done.
 void setMaximumValue(int n)
          Set the maximum integer value of the progress bar
 void setProgress(int n)
           
 void setStallTimeout(int nSec)
          Tell the server how long to wait before declaring this process stalled.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_BAR

public static final int TYPE_BAR
See Also:
Constant Field Values

TYPE_TEXT

public static final int TYPE_TEXT
See Also:
Constant Field Values

UPDATE_DELAY

public static final int UPDATE_DELAY
See Also:
Constant Field Values
Constructor Detail

ProgressClient

public ProgressClient(Properties props,
                      Logger parent)
               throws PropertiesException
Throws:
PropertiesException
Method Detail

setProgress

public void setProgress(int n)

setMaximumValue

public void setMaximumValue(int n)
Set the maximum integer value of the progress bar

Parameters:
n - The maximum value

setDone

public void setDone(boolean success)
Announce that this task is done.

Parameters:
success - Was this task successful? If so, the progress will be set to 100% and the bar will turn green. If not, the bar will turn red and it will stay at the same percentage.

setStallTimeout

public void setStallTimeout(int nSec)
Tell the server how long to wait before declaring this process stalled.

Parameters:
nSec - How many seconds before a stall occurs

connectionReestablished

public void connectionReestablished(info.jonclark.clientserver.ClientInterface client)
Description copied from interface: info.jonclark.clientserver.ReconnectionListener
Connection has just been reestablished. We should probably sent the client our most recent state information.

Specified by:
connectionReestablished in interface info.jonclark.clientserver.ReconnectionListener

sendFullStatus

public void sendFullStatus(info.jonclark.clientserver.ClientInterface client)
Send the full status of the task. This is usually done for new connections or reconnections.


main

public static void main(String[] args)
                 throws Exception
Throws:
Exception