com.limegroup.gnutella.gui.download
Class DownloadMediator

java.lang.Object
  extended bycom.limegroup.gnutella.gui.tables.AbstractTableMediator
      extended bycom.limegroup.gnutella.gui.download.DownloadMediator
All Implemented Interfaces:
ComponentMediator, HeaderMouseObserver, RefreshListener, ThemeObserver

public final class DownloadMediator
extends AbstractTableMediator

This class acts as a mediator between all of the components of the download window. It also constructs all of the download window components.


Nested Class Summary
 
Nested classes inherited from class com.limegroup.gnutella.gui.tables.AbstractTableMediator
AbstractTableMediator.Resorter
 
Field Summary
 java.awt.event.ActionListener BROWSE_LISTENER
           
 java.awt.event.ActionListener CHAT_LISTENER
          Variables so only one ActionListener needs to be created for both the buttons & popup menu.
 java.awt.event.ActionListener CLEAR_LISTENER
           
 java.awt.event.ActionListener LAUNCH_LISTENER
           
 java.awt.event.ActionListener RESUME_LISTENER
           
 
Fields inherited from class com.limegroup.gnutella.gui.tables.AbstractTableMediator
BUTTON_ROW, CHAT_RENDERER, COLOR_RENDERER, DATA_MODEL, DEFAULT_LISTENER, HEADER_LISTENER, ID, MAIN_PANEL, PROGRESS_BAR_RENDERER, REMOVE_LISTENER, RESORTER, SCROLL_PANE, SELECTION_LISTENER, SETTINGS, TABLE, TABLE_PANE, ZERO_DIMENSION
 
Method Summary
 void add(java.lang.Object downloader)
          Overrides the default add.
protected  void buildListeners()
          Build some extra listeners
protected  void buildSettings()
          Overriden to have different default values for tooltips.
protected  javax.swing.JPopupMenu createPopupMenu()
          Abstract method for creating a right-click popup menu for the table.
 void doRefresh()
          Override the default refreshing so that we can set the clear button appropriately.
 int getActiveDownloads()
          Returns the total number of active Downloads.
 int getCurrentDownloads()
          Returns the total number of current Downloads.
 int getTotalDownloads()
          Returns the total number of Downloads that have occurred in this session.
 void handleMouseDoubleClick(java.awt.Point p)
          Handles a double-click event in the table.
 void handleNoSelection()
          Handles the deselection of all rows in the download table, disabling all necessary buttons and menu items.
 void handleSelection(int row)
          Handles the selection of the specified row in the download window, enabling or disabling buttons and chat menu items depending on the values in the row.
static DownloadMediator instance()
           
 void remove(java.lang.Object downloader)
          Overrides the default remove.
protected  void setupConstants()
          Set up the necessary constants.
protected  void updateSplashScreen()
          Update the splash screen.
 
Methods inherited from class com.limegroup.gnutella.gui.tables.AbstractTableMediator
addListeners, addUnsorted, clearSelection, clearTable, createColumnSelectionMenu, createDefaultColumnPreferencesHandler, forceResort, getComponent, getScrolledTablePane, getSize, handleHeaderColumnLeftClick, handleHeaderColumnPressed, handleHeaderColumnReleased, handleHeaderPopupMenu, handlePopupMenu, handleRightMouseClick, refresh, removeRow, removeSelection, resort, setButtonEnabled, setDefaultEditors, setDefaultRenderers, setupMainPanel, setupTable, setupTableHeaders, sortAndMaintainSelection, update, updateTheme
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAT_LISTENER

public java.awt.event.ActionListener CHAT_LISTENER
Variables so only one ActionListener needs to be created for both the buttons & popup menu.


CLEAR_LISTENER

public java.awt.event.ActionListener CLEAR_LISTENER

BROWSE_LISTENER

public java.awt.event.ActionListener BROWSE_LISTENER

LAUNCH_LISTENER

public java.awt.event.ActionListener LAUNCH_LISTENER

RESUME_LISTENER

public java.awt.event.ActionListener RESUME_LISTENER
Method Detail

instance

public static DownloadMediator instance()

buildSettings

protected void buildSettings()
Overriden to have different default values for tooltips.

Overrides:
buildSettings in class AbstractTableMediator

buildListeners

protected void buildListeners()
Build some extra listeners

Overrides:
buildListeners in class AbstractTableMediator

setupConstants

protected void setupConstants()
Set up the necessary constants.

Specified by:
setupConstants in class AbstractTableMediator

updateSplashScreen

protected void updateSplashScreen()
Update the splash screen.

Specified by:
updateSplashScreen in class AbstractTableMediator

doRefresh

public void doRefresh()
Override the default refreshing so that we can set the clear button appropriately.

Overrides:
doRefresh in class AbstractTableMediator

getTotalDownloads

public int getTotalDownloads()
Returns the total number of Downloads that have occurred in this session.

Returns:
the total number of Downloads that have occurred in this session

getCurrentDownloads

public int getCurrentDownloads()
Returns the total number of current Downloads.

Returns:
the total number of current Downloads

getActiveDownloads

public int getActiveDownloads()
Returns the total number of active Downloads. This includes anything that is still viewable in the Downloads view.

Returns:
the total number of active Downloads

add

public void add(java.lang.Object downloader)
Overrides the default add. Adds a new Downloads to the list of Downloads, obtaining the necessary information from the supplied Downloader. If the download is not already in the list, then it is added.

Specified by:
add in interface ComponentMediator
Overrides:
add in class AbstractTableMediator

remove

public void remove(java.lang.Object downloader)
Overrides the default remove. Takes action upon downloaded theme files, asking if the user wants to apply the theme. Removes a download from the list if the user has configured their system to automatically clear completed download and if the download is complete.

Specified by:
remove in interface ComponentMediator
Overrides:
remove in class AbstractTableMediator
Parameters:
downloader - the Downloader to remove from the list if it is complete.

handleMouseDoubleClick

public void handleMouseDoubleClick(java.awt.Point p)
Handles a double-click event in the table.


createPopupMenu

protected javax.swing.JPopupMenu createPopupMenu()
Description copied from class: AbstractTableMediator
Abstract method for creating a right-click popup menu for the table. If an implemention does not support a right-click popup menu, it should return null.

Specified by:
createPopupMenu in class AbstractTableMediator
Returns:
a new JPopupMenu to display on right-click

handleSelection

public void handleSelection(int row)
Handles the selection of the specified row in the download window, enabling or disabling buttons and chat menu items depending on the values in the row.

Parameters:
row - the selected row

handleNoSelection

public void handleNoSelection()
Handles the deselection of all rows in the download table, disabling all necessary buttons and menu items.