All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ejmf.toolkit.media.BasicCachingControl

java.lang.Object
   |
   +----ejmf.toolkit.media.BasicCachingControl

public class BasicCachingControl
extends Object
implements CachingControl
This class provides a CachingControl for the AbstractController class. It provides a progress bar to monitor the media download. Its control Component is simply a button that stops the media download. Whenever there is a change in this BasicCachingControl, a CachingControlEvent is posted automatically.

See Also:
AbstractController

Constructor Index

 o BasicCachingControl(AbstractController, long)
Constructs a BasicCachingControl for the given AbstractController.

Method Index

 o addToProgress(long)
Adds an amount of bytes to the media already downloaded.
 o blockWhilePaused()
Blocks the current thread until the download is not paused.
 o getContentLength()
Get the total number of bytes in the media being downloaded.
 o getContentProgress()
Get the total number of bytes of media data that have been downloaded so far.
 o getControlComponent()
Get a Component that provides additional download control.
 o getProgressBarComponent()
Get a Component for displaying the download progress.
 o isDownloading()
Check whether or not media is being downloaded.
 o isPaused()
Tells whether the media download is paused or not.
 o reset(long)
Resets this BasicCachingControl.
 o setContentLength(long)
Set the length of the media without reinitializing the progress bar.
 o setContentProgress(long)
Set the current progress of the media download.
 o setDone()
Indicates that the media is fully downloaded.
 o setDownLoading(boolean)
Sets whether the AbstractController is downloading or not.
 o setPaused(boolean)
Sets whether the AbstractController is paused or not.

Constructors

 o BasicCachingControl
 public BasicCachingControl(AbstractController c,
                            long length)
Constructs a BasicCachingControl for the given AbstractController. Uses the length arg to initialize the progress bar.

Parameters:
c - The AbstractController from which CachingControlEvents are posted whenever the status of this BasicCachingControl changes.
length - The length of the media to be downloaded.

Methods

 o setPaused
 protected synchronized void setPaused(boolean isPaused)
Sets whether the AbstractController is paused or not.

Parameters:
isDownloading - boolean indicating whether the media is downloading.
 o isPaused
 public boolean isPaused()
Tells whether the media download is paused or not.

 o blockWhilePaused
 public synchronized void blockWhilePaused()
Blocks the current thread until the download is not paused.

 o setDownLoading
 public void setDownLoading(boolean isDownloading)
Sets whether the AbstractController is downloading or not. Other methods in the BasicCachingControl call this method automatically.

Parameters:
isDownloading - boolean indicating whether the media is downloading.
 o reset
 public synchronized void reset(long length)
Resets this BasicCachingControl. Sets the media length, reinitializes the progress bar, and posts a CachingControlEvent.

Parameters:
length - The length of the media.
 o setContentLength
 public synchronized void setContentLength(long length)
Set the length of the media without reinitializing the progress bar.

Parameters:
length - The length of the media.
 o setContentProgress
 public synchronized void setContentProgress(long progress)
Set the current progress of the media download.

Parameters:
progress - Number of bytes that have been downloaded.
 o addToProgress
 public void addToProgress(long toAdd)
Adds an amount of bytes to the media already downloaded.

Parameters:
toAdd - Number of bytes that have been downloaded since the last time this method or setContentProgress have been called.
 o setDone
 public void setDone()
Indicates that the media is fully downloaded.

 o isDownloading
 public boolean isDownloading()
Check whether or not media is being downloaded.

 o getContentLength
 public long getContentLength()
Get the total number of bytes in the media being downloaded. Returns LENGTH_UNKNOWN if this information is not available.

Returns:
The media length in bytes, or LENGTH_UNKNOWN.
 o getContentProgress
 public long getContentProgress()
Get the total number of bytes of media data that have been downloaded so far.

Returns:
The number of bytes downloaded.
 o getProgressBarComponent
 public Component getProgressBarComponent()
Get a Component for displaying the download progress.

Returns:
Progress bar GUI Component.
 o getControlComponent
 public Component getControlComponent()
Get a Component that provides additional download control. Returns null if only a progress bar is provided.

Returns:
Download control GUI Component.

All Packages  Class Hierarchy  This Package  Previous  Next  Index