net.sf.magicproject.management
Class MonitoredCheckContent

java.lang.Object
  extended by net.sf.magicproject.management.MonitoredCheckContent
All Implemented Interfaces:
java.lang.Runnable

public class MonitoredCheckContent
extends java.lang.Object
implements java.lang.Runnable

A monitored content represents partial data representation : source, destination, content length to proceed, content proceeded length.

Since:
0.91
Author:
Fabrice Daugan

Field Summary
static int NOTIFICATION_PERIOD
          Notficaytion period.
static java.lang.String STR_ZIP_PATH
          The string delimiting the jar/zip content.
 
Constructor Summary
MonitoredCheckContent(java.awt.Image content)
          Create a new instance of this class.
MonitoredCheckContent(java.util.List<java.lang.String> localFiles, java.util.List<java.lang.String> remoteFiles, MonitorListener listener)
          Create a new instance of this class.
 
Method Summary
 void acknowledgeFinished(MonitorListener listener)
          Unregister the specified lister from the monitored content listeners.
 void addListener(MonitorListener listener)
          Add a listener.
 java.awt.Image getContent()
          Return the current content.
 boolean isFinished()
          Is the whole content is got.
 void paintNotification(java.awt.Graphics g)
          Paint the progress bar of the content download on the given graphics.
 void run()
           
 void setFinished()
          Inidicates this content is completely loaded.
 void start()
          Start the download.
 void updateProgress(int contentLength, int currentLength)
          Update the content data progress.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTIFICATION_PERIOD

public static final int NOTIFICATION_PERIOD
Notficaytion period.

See Also:
Constant Field Values

STR_ZIP_PATH

public static final java.lang.String STR_ZIP_PATH
The string delimiting the jar/zip content.

See Also:
Constant Field Values
Constructor Detail

MonitoredCheckContent

public MonitoredCheckContent(java.awt.Image content)
Create a new instance of this class.

Parameters:
content - the completed content.

MonitoredCheckContent

public MonitoredCheckContent(java.util.List<java.lang.String> localFiles,
                             java.util.List<java.lang.String> remoteFiles,
                             MonitorListener listener)
Create a new instance of this class.

Parameters:
localFiles - the destination (local) files.
remoteFiles - the list of remotes files.
listener - the listener to notify.
Method Detail

getContent

public java.awt.Image getContent()
Return the current content.

Returns:
the current content.

isFinished

public boolean isFinished()
Is the whole content is got.

Returns:
true if the whole content is got.

setFinished

public void setFinished()
Inidicates this content is completely loaded.


addListener

public final void addListener(MonitorListener listener)
Add a listener.

Parameters:
listener - the listener to add.

paintNotification

public void paintNotification(java.awt.Graphics g)
Paint the progress bar of the content download on the given graphics.

Parameters:
g - the used graphics to draw our progressbar.

acknowledgeFinished

public void acknowledgeFinished(MonitorListener listener)
Unregister the specified lister from the monitored content listeners.

Parameters:
listener - the listener acknowledging the finished content.

start

public void start()
Start the download.


run

public void run()
Specified by:
run in interface java.lang.Runnable

updateProgress

public void updateProgress(int contentLength,
                           int currentLength)
Update the content data progress.

Parameters:
contentLength - the total content length to load.
currentLength - the current content length to load.


Copyright © 2003-2007 Magic-Project. All Rights Reserved.