FileDocCategorySizeDatePackage
DLedFromOthersItem.javaAPI DocAzureus 3.0.3.42561Sun Sep 23 04:55:06 BST 2007org.gudy.azureus2.ui.swt.views.tableitems.peers

DLedFromOthersItem

public class DLedFromOthersItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener
Downloaded from others WHILE connected to you
author
TuxPaper
since
2.1.0.1

Fields Summary
Constructors Summary
public DLedFromOthersItem(String table_id)
Default Constructor

    super("DLedFromOthers", ALIGN_TRAIL, POSITION_INVISIBLE, 70, table_id);
    setRefreshInterval(INTERVAL_LIVE);
  
Methods Summary
public voidrefresh(TableCell cell)

    PEPeer peer = (PEPeer)cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getStats().getTotalBytesDownloadedByPeer() - peer.getStats().getTotalDataBytesSent();
    // Just because we sent data doesn't mean the peer has told us the piece is done yet
    if (value < 0) value = 0;
    
    if ( peer != null ){
	    Long prev_value = (Long)peer.getData( "DLedFromOther_prev" );
	    
	    if( prev_value != null ) {
	      if( value < prev_value.longValue() ) {  //dont show decrement while we're actively uploading
	        value = prev_value.longValue();
	      }
	      else if( value > prev_value.longValue() ) {
	        peer.setData( "DLedFromOther_prev", new Long( value ) );
	      }
	    }
	    else {
	      peer.setData( "DLedFromOther_prev", new Long( value ) );
	    }
    }
    
    if (!cell.setSortValue(value) && cell.isValid())
      return;

    cell.setText(DisplayFormatters.formatByteCountToKiBEtc(value));