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
-
BasicCachingControl(AbstractController, long)
- Constructs a BasicCachingControl for the given
AbstractController.
-
addToProgress(long)
- Adds an amount of bytes to the media already downloaded.
-
blockWhilePaused()
- Blocks the current thread until the download is not
paused.
-
getContentLength()
- Get the total number of bytes in the media being
downloaded.
-
getContentProgress()
- Get the total number of bytes of media data that have been
downloaded so far.
-
getControlComponent()
- Get a Component that provides additional download control.
-
getProgressBarComponent()
- Get a Component for displaying the download progress.
-
isDownloading()
- Check whether or not media is being downloaded.
-
isPaused()
- Tells whether the media download is paused or not.
-
reset(long)
- Resets this BasicCachingControl.
-
setContentLength(long)
- Set the length of the media without reinitializing the
progress bar.
-
setContentProgress(long)
- Set the current progress of the media download.
-
setDone()
- Indicates that the media is fully downloaded.
-
setDownLoading(boolean)
- Sets whether the AbstractController is downloading or not.
-
setPaused(boolean)
- Sets whether the AbstractController is paused or not.
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.
setPaused
protected synchronized void setPaused(boolean isPaused)
- Sets whether the AbstractController is paused or not.
- Parameters:
- isDownloading
- boolean indicating whether the media is
downloading.
isPaused
public boolean isPaused()
- Tells whether the media download is paused or not.
blockWhilePaused
public synchronized void blockWhilePaused()
- Blocks the current thread until the download is not
paused.
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.
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.
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.
setContentProgress
public synchronized void setContentProgress(long progress)
- Set the current progress of the media download.
- Parameters:
- progress
- Number of bytes that have been downloaded.
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.
setDone
public void setDone()
- Indicates that the media is fully downloaded.
isDownloading
public boolean isDownloading()
- Check whether or not media is being downloaded.
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.
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.
getProgressBarComponent
public Component getProgressBarComponent()
- Get a Component for displaying the download progress.
- Returns:
- Progress bar GUI Component.
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