com.limegroup.gnutella.gui
Class VisualConnectionCallback

java.lang.Object
  extended bycom.limegroup.gnutella.gui.VisualConnectionCallback
All Implemented Interfaces:
com.limegroup.gnutella.ActivityCallback

public final class VisualConnectionCallback
extends java.lang.Object
implements com.limegroup.gnutella.ActivityCallback

This class is the interface from the backend to the frontend. It delegates all callbacks to the appropriate frontend classes, and it also handles putting an necessary calls onto the Swing thread. It implements the ActivityCallback callback interface, designed to make it easy to swap UIs.


Method Summary
 void acceptChat(com.limegroup.gnutella.chat.Chatter chatter)
          Adds a new chat session, encapsulated in the specified Chatter instance.
 void addDownload(com.limegroup.gnutella.Downloader mgr)
           
 void addSharedDirectory(java.io.File dir, java.io.File parent)
           
 void addSharedFile(com.limegroup.gnutella.FileDesc file, java.io.File parent)
          NOTE: We have to share the FileDesc if we want to be able to to display any qualities of the shared file Things that could be displayed range from...
 void addUpload(com.limegroup.gnutella.Uploader mgr)
           
 void browseHostFailed(com.limegroup.gnutella.GUID guid)
          Display an error message for a ResultPanel (if it still exists)
 void chatErrorMessage(com.limegroup.gnutella.chat.Chatter chatter, java.lang.String str)
          Display an error message for the specified chat session.
 void chatUnavailable(com.limegroup.gnutella.chat.Chatter chatter)
          Specifies that the given chat host is no longer available, thereby ending the chat session.
 void clearSharedFiles()
           
 void connectionClosed(com.limegroup.gnutella.Connection c)
          Handle a removed connection.
 void connectionInitialized(com.limegroup.gnutella.Connection c)
          Change the status of a connection when it's been fully initialized
 void connectionInitializing(com.limegroup.gnutella.Connection c)
          Handle a new connection.
 void downloadsComplete()
           
 void fileManagerLoaded()
          File manager finished loading.
 java.lang.String getHostValue(java.lang.String key)
           
 com.limegroup.gnutella.security.User getUserAuthenticationInfo(java.lang.String host)
          Asks user to authenticate, and returns the information received from user
 void handleQueryResult(com.limegroup.gnutella.RemoteFileDesc rfd, com.limegroup.gnutella.search.HostData data, java.util.Set locs)
          Add a query reply to a query screen
 void handleQueryString(java.lang.String query)
          Add a query string to the monitor screen
 void handleSharedFileUpdate(java.io.File file)
          This method notifies the frontend that the data for the specified shared File instance has been updated.
 void knownHost(com.limegroup.gnutella.Endpoint e)
          Add a known host to the host catcher
 void notifyUserAboutUpdate(java.lang.String m, boolean isPro, boolean loc)
          called by backend when it realizes a new version is available
 void promptAboutCorruptDownload(com.limegroup.gnutella.Downloader downloader)
          Shows the user a message informing her that a file being downloaded is corrupt.
 void receiveMessage(com.limegroup.gnutella.chat.Chatter chatter)
          Receives a new chat message for a specific Chatter instance.
 void removeDownload(com.limegroup.gnutella.Downloader mgr)
           
 void removeUpload(com.limegroup.gnutella.Uploader mgr)
           
 void restoreApplication()
          Tell the GUI to deiconify.
 void setAnnotateEnabled(boolean enabled)
           
 void showDownloads()
          Show active downloads
 void uploadsComplete()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

connectionInitializing

public void connectionInitializing(com.limegroup.gnutella.Connection c)
Handle a new connection.

Specified by:
connectionInitializing in interface com.limegroup.gnutella.ActivityCallback

connectionInitialized

public void connectionInitialized(com.limegroup.gnutella.Connection c)
Change the status of a connection when it's been fully initialized

Specified by:
connectionInitialized in interface com.limegroup.gnutella.ActivityCallback

connectionClosed

public void connectionClosed(com.limegroup.gnutella.Connection c)
Handle a removed connection.

Specified by:
connectionClosed in interface com.limegroup.gnutella.ActivityCallback

knownHost

public void knownHost(com.limegroup.gnutella.Endpoint e)
Add a known host to the host catcher

Specified by:
knownHost in interface com.limegroup.gnutella.ActivityCallback

handleQueryResult

public void handleQueryResult(com.limegroup.gnutella.RemoteFileDesc rfd,
                              com.limegroup.gnutella.search.HostData data,
                              java.util.Set locs)
Add a query reply to a query screen

Specified by:
handleQueryResult in interface com.limegroup.gnutella.ActivityCallback

handleQueryString

public void handleQueryString(java.lang.String query)
Add a query string to the monitor screen

Specified by:
handleQueryString in interface com.limegroup.gnutella.ActivityCallback

fileManagerLoaded

public void fileManagerLoaded()
File manager finished loading.

Specified by:
fileManagerLoaded in interface com.limegroup.gnutella.ActivityCallback

addSharedDirectory

public void addSharedDirectory(java.io.File dir,
                               java.io.File parent)
Specified by:
addSharedDirectory in interface com.limegroup.gnutella.ActivityCallback

addSharedFile

public void addSharedFile(com.limegroup.gnutella.FileDesc file,
                          java.io.File parent)
NOTE: We have to share the FileDesc if we want to be able to to display any qualities of the shared file Things that could be displayed range from... - number of alternate locations - number of hits - number of attempted uploads - number of completed uploads - average D/L time for this file - etc... Of course, the FileDesc must support this.

Specified by:
addSharedFile in interface com.limegroup.gnutella.ActivityCallback

handleSharedFileUpdate

public void handleSharedFileUpdate(java.io.File file)
This method notifies the frontend that the data for the specified shared File instance has been updated.

Specified by:
handleSharedFileUpdate in interface com.limegroup.gnutella.ActivityCallback
Parameters:
file - the File instance for the shared file whose data has been updated

clearSharedFiles

public void clearSharedFiles()
Specified by:
clearSharedFiles in interface com.limegroup.gnutella.ActivityCallback

setAnnotateEnabled

public void setAnnotateEnabled(boolean enabled)
Specified by:
setAnnotateEnabled in interface com.limegroup.gnutella.ActivityCallback

addDownload

public void addDownload(com.limegroup.gnutella.Downloader mgr)
Specified by:
addDownload in interface com.limegroup.gnutella.ActivityCallback

removeDownload

public void removeDownload(com.limegroup.gnutella.Downloader mgr)
Specified by:
removeDownload in interface com.limegroup.gnutella.ActivityCallback

downloadsComplete

public void downloadsComplete()
Specified by:
downloadsComplete in interface com.limegroup.gnutella.ActivityCallback

addUpload

public void addUpload(com.limegroup.gnutella.Uploader mgr)
Specified by:
addUpload in interface com.limegroup.gnutella.ActivityCallback

removeUpload

public void removeUpload(com.limegroup.gnutella.Uploader mgr)
Specified by:
removeUpload in interface com.limegroup.gnutella.ActivityCallback

uploadsComplete

public void uploadsComplete()
Specified by:
uploadsComplete in interface com.limegroup.gnutella.ActivityCallback

notifyUserAboutUpdate

public void notifyUserAboutUpdate(java.lang.String m,
                                  boolean isPro,
                                  boolean loc)
called by backend when it realizes a new version is available

Specified by:
notifyUserAboutUpdate in interface com.limegroup.gnutella.ActivityCallback

acceptChat

public void acceptChat(com.limegroup.gnutella.chat.Chatter chatter)
Adds a new chat session, encapsulated in the specified Chatter instance.

Specified by:
acceptChat in interface com.limegroup.gnutella.ActivityCallback
Parameters:
chatter - the Chatter instance that provides all data access regarding the chat session

receiveMessage

public void receiveMessage(com.limegroup.gnutella.chat.Chatter chatter)
Receives a new chat message for a specific Chatter instance.

Specified by:
receiveMessage in interface com.limegroup.gnutella.ActivityCallback
Parameters:
chatter - the Chatter instance that is receiving a new message

chatUnavailable

public void chatUnavailable(com.limegroup.gnutella.chat.Chatter chatter)
Specifies that the given chat host is no longer available, thereby ending the chat session.

Specified by:
chatUnavailable in interface com.limegroup.gnutella.ActivityCallback
Parameters:
chatter - the Chatter instance for the chat session that is terminating

chatErrorMessage

public void chatErrorMessage(com.limegroup.gnutella.chat.Chatter chatter,
                             java.lang.String str)
Display an error message for the specified chat session.

Specified by:
chatErrorMessage in interface com.limegroup.gnutella.ActivityCallback
Parameters:
chatter - the Chatter instance to show an error for
str - the error to display

browseHostFailed

public void browseHostFailed(com.limegroup.gnutella.GUID guid)
Display an error message for a ResultPanel (if it still exists)

Specified by:
browseHostFailed in interface com.limegroup.gnutella.ActivityCallback
Parameters:
guid - The GUID of the ResultPanel.

getUserAuthenticationInfo

public com.limegroup.gnutella.security.User getUserAuthenticationInfo(java.lang.String host)
Asks user to authenticate, and returns the information received from user

Specified by:
getUserAuthenticationInfo in interface com.limegroup.gnutella.ActivityCallback
Parameters:
host - The host who is requesting authentication
Returns:
The authentication information input by user

promptAboutCorruptDownload

public void promptAboutCorruptDownload(com.limegroup.gnutella.Downloader downloader)
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 com.limegroup.gnutella.ActivityCallback

restoreApplication

public void restoreApplication()
Tell the GUI to deiconify.

Specified by:
restoreApplication in interface com.limegroup.gnutella.ActivityCallback

showDownloads

public void showDownloads()
Show active downloads

Specified by:
showDownloads in interface com.limegroup.gnutella.ActivityCallback

getHostValue

public java.lang.String getHostValue(java.lang.String key)
Specified by:
getHostValue in interface com.limegroup.gnutella.ActivityCallback