LimeWire Consolidated API

com.limegroup.gnutella
Class ActivityCallbackAdapter

java.lang.Object
  extended by com.limegroup.gnutella.ActivityCallbackAdapter
All Implemented Interfaces:
ActivityCallback, DownloadCallback

public class ActivityCallbackAdapter
extends Object
implements ActivityCallback

Provides a default implementation of ActivityCallback where all the methods are either empty or return false. You can extend this class when you are only need specific methods.


Constructor Summary
ActivityCallbackAdapter()
           
 
Method Summary
 void addDownload(Downloader d)
          Add a file to the download window
 void addUpload(Uploader u)
          Add an uploader to the upload window
 void browseHostFailed(GUID guid)
           
 void componentLoading(String state, String component)
           
 void downloadCompleted(Downloader d)
          Remove a downloader from the download window.
 void downloadsComplete()
          Notifies the GUI that all active downloads have been completed.
 String getHostValue(String key)
           
 void handleAddressStateChanged()
           
 void handleConnectionLifecycleEvent(ConnectionLifecycleEvent evt)
           
 void handleDAAPConnectionError(Throwable t)
           
 void handleMagnets(MagnetOptions[] magnets)
          The core passes parsed magnets to the callback and asks it if it wants to handle them itself.
 void handleQuery(QueryRequest query, String address, int port)
          Add a query string to the monitor screen
 void handleQueryResult(RemoteFileDesc rfd, QueryReply queryReply, Set<? extends IpPort> locs)
          Notifies the UI that a new query result has come in to the backend.
 void handleSaveLocationException(DownloadAction downLoadAction, SaveLocationException sle, boolean supportsNewSaveDir)
          Handles the supplied SaveLocation exception by prompting the user for a new savelocation or whether to overwrite the file.
 void handleSharedFileUpdate(File file)
           
 void handleTorrent(File torrentFile)
          Try to download the torrent file
 void installationCorrupted()
          Notification that installation may be corrupted.
 boolean isQueryAlive(GUID guid)
           
 void promptAboutCorruptDownload(Downloader dloader)
          Shows the user a message informing her that a file being downloaded is corrupt.
 void promptTorrentUploadCancel(ManagedTorrent torrent)
          Validates with the user that the torrent upload should be cancelled.
 void removeUpload(Uploader u)
          Remove an uploader from the upload window.
 void restoreApplication()
          Tell to deiconify.
 void showDownloads()
           
 String translate(String s)
          Translate a String taking into account Locale.
 void updateAvailable(UpdateInformation info)
           
 void uploadsComplete()
          Notifies that all active uploads have been completed.
 boolean warnAboutSharingSensitiveDirectory(File dir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityCallbackAdapter

public ActivityCallbackAdapter()
Method Detail

addUpload

public void addUpload(Uploader u)
Description copied from interface: ActivityCallback
Add an uploader to the upload window

Specified by:
addUpload in interface ActivityCallback

browseHostFailed

public void browseHostFailed(GUID guid)

componentLoading

public void componentLoading(String state,
                             String component)

handleAddressStateChanged

public void handleAddressStateChanged()

handleConnectionLifecycleEvent

public void handleConnectionLifecycleEvent(ConnectionLifecycleEvent evt)

handleMagnets

public void handleMagnets(MagnetOptions[] magnets)
Description copied from interface: ActivityCallback
The core passes parsed magnets to the callback and asks it if it wants to handle them itself.

If this is the case the callback should return true, otherwise the core starts the downloads itself.

Specified by:
handleMagnets in interface ActivityCallback
Parameters:
magnets - Array of magnet information to handle

handleQueryResult

public void handleQueryResult(RemoteFileDesc rfd,
                              QueryReply queryReply,
                              Set<? extends IpPort> locs)
Description copied from interface: ActivityCallback
Notifies the UI that a new query result has come in to the backend.

Specified by:
handleQueryResult in interface ActivityCallback
Parameters:
rfd - the descriptor for the remote file
locs - the Set of alternate locations for the file

handleQuery

public void handleQuery(QueryRequest query,
                        String address,
                        int port)
Description copied from interface: ActivityCallback
Add a query string to the monitor screen

Specified by:
handleQuery in interface ActivityCallback

handleSharedFileUpdate

public void handleSharedFileUpdate(File file)
Specified by:
handleSharedFileUpdate in interface ActivityCallback

handleTorrent

public void handleTorrent(File torrentFile)
Description copied from interface: ActivityCallback
Try to download the torrent file

Specified by:
handleTorrent in interface ActivityCallback

installationCorrupted

public void installationCorrupted()
Description copied from interface: ActivityCallback
Notification that installation may be corrupted.

Specified by:
installationCorrupted in interface ActivityCallback

isQueryAlive

public boolean isQueryAlive(GUID guid)
Specified by:
isQueryAlive in interface ActivityCallback
Returns:
true If the guid that maps to a query result screen is still available/viewable to the user.

removeUpload

public void removeUpload(Uploader u)
Description copied from interface: ActivityCallback
Remove an uploader from the upload window.

Specified by:
removeUpload in interface ActivityCallback

restoreApplication

public void restoreApplication()
Description copied from interface: ActivityCallback
Tell to deiconify.

Specified by:
restoreApplication in interface ActivityCallback

updateAvailable

public void updateAvailable(UpdateInformation info)

uploadsComplete

public void uploadsComplete()
Description copied from interface: ActivityCallback
Notifies that all active uploads have been completed.

Specified by:
uploadsComplete in interface ActivityCallback

warnAboutSharingSensitiveDirectory

public boolean warnAboutSharingSensitiveDirectory(File dir)

addDownload

public void addDownload(Downloader d)
Description copied from interface: DownloadCallback
Add a file to the download window

Specified by:
addDownload in interface DownloadCallback

downloadsComplete

public void downloadsComplete()
Description copied from interface: DownloadCallback
Notifies the GUI that all active downloads have been completed.

Specified by:
downloadsComplete in interface DownloadCallback

getHostValue

public String getHostValue(String key)

promptAboutCorruptDownload

public void promptAboutCorruptDownload(Downloader dloader)
Description copied from interface: DownloadCallback
Shows the user a message informing her that a file being downloaded is corrupt.

This method MUST call dloader.discardCorruptDownload(boolean b) otherwise there will be threads piling up waiting for a notification

Specified by:
promptAboutCorruptDownload in interface DownloadCallback

downloadCompleted

public void downloadCompleted(Downloader d)
Description copied from interface: DownloadCallback
Remove a downloader from the download window.

Specified by:
downloadCompleted in interface DownloadCallback

showDownloads

public void showDownloads()

handleDAAPConnectionError

public void handleDAAPConnectionError(Throwable t)

translate

public String translate(String s)
Description copied from interface: ActivityCallback
Translate a String taking into account Locale. String literals that should be translated must still be marked for translation using I18nMarker.marktr(String).

Specified by:
translate in interface ActivityCallback
Parameters:
s - The String to translate
Returns:
the translated String

handleSaveLocationException

public void handleSaveLocationException(DownloadAction downLoadAction,
                                        SaveLocationException sle,
                                        boolean supportsNewSaveDir)
Description copied from interface: ActivityCallback
Handles the supplied SaveLocation exception by prompting the user for a new savelocation or whether to overwrite the file.

Specified by:
handleSaveLocationException in interface ActivityCallback

promptTorrentUploadCancel

public void promptTorrentUploadCancel(ManagedTorrent torrent)
Description copied from interface: ActivityCallback
Validates with the user that the torrent upload should be cancelled. There are various reasons the user will not want the cancel to go through. 1) If the torrent is still downloading, the upload cannot be cancelled without cancelling the download. 2) If the torrent is seeding, but the seed ratio is low, the user may wish to seed to at least 100% to be a good samaritan.

Specified by:
promptTorrentUploadCancel in interface ActivityCallback

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.