com.limegroup.gnutella.gui.upload
Class UploadMediator

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

public final class UploadMediator
extends AbstractTableMediator

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


Nested Class Summary
 
Nested classes inherited from class com.limegroup.gnutella.gui.tables.AbstractTableMediator
AbstractTableMediator.Resorter
 
Field Summary
 
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
 
Constructor Summary
UploadMediator()
          Constructs all of the elements of the upload window, including the table, the buttons, etc.
 
Method Summary
 void add(java.lang.Object uploader)
          Override 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 refresh so we can set the clear button.
 int getActiveUploads()
          Returns the total number of active Uploads.
 int getCurrentUploads()
          Returns the total number of current Uploads.
 int getTotalUploads()
          Returns the total number of Uploads that have occurred in this session.
 void handleMouseDoubleClick(java.awt.Point p)
          Don't do anything on a double click.
 void handleNoSelection()
          Handles the deselection of all rows in the upload 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 UploadMediator instance()
           
 void remove(java.lang.Object uploader)
          Override the default remove Removes a upload from the list if the user has configured their system to automatically clear completed upload and if the upload is complete.
 void removeSelection()
          Override the default remove to not actually remove, but instead just call 'cleanup'.
protected  void setupConstants()
          Set us up the 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, 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
 

Constructor Detail

UploadMediator

public UploadMediator()
Constructs all of the elements of the upload window, including the table, the buttons, etc.

Method Detail

instance

public static UploadMediator 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 us up the 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 refresh so we can set the clear button.

Overrides:
doRefresh in class AbstractTableMediator

getTotalUploads

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

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

getCurrentUploads

public int getCurrentUploads()
Returns the total number of current Uploads.

Returns:
the total number of current Uploads

getActiveUploads

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

Returns:
the total number of active Uploads

add

public void add(java.lang.Object uploader)
Override the default add. Adds a new Uploads to the list of Uploads, obtaining the necessary information from the supplied Uploader. If the upload is not already in the list, then it is added.

With HTTP1.1 support, swarm downloads, and chunking, it becomes important that the GUI should not get updated whenever a little chunk of a file is uploaded.

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

remove

public void remove(java.lang.Object uploader)
Override the default remove Removes a upload from the list if the user has configured their system to automatically clear completed upload and if the upload is complete.

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

removeSelection

public void removeSelection()
Override the default remove to not actually remove, but instead just call 'cleanup'. If the user has 'Clear Completed Uploads' checked, they'll be removed. Otherwise, they'll show as interupted.

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

handleMouseDoubleClick

public void handleMouseDoubleClick(java.awt.Point p)
Don't do anything on a double click.


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 upload table, disabling all necessary buttons and menu items.