FileDocCategorySizeDatePackage
AvailabilityItem.javaAPI DocAzureus 3.0.3.42702Mon Feb 19 14:24:06 GMT 2007org.gudy.azureus2.ui.swt.views.tableitems.mytorrents

AvailabilityItem

public class AvailabilityItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener
Availability/"Seeing Copies" Column
author
TuxPaper

Fields Summary
private static final String
zeros
private static final int
numZeros
private int
iTimesBy
Constructors Summary
public AvailabilityItem(String sTableID)
Default Constructor

  
     
     
    super("availability", ALIGN_TRAIL, POSITION_INVISIBLE, 50, sTableID);
    setRefreshInterval(INTERVAL_LIVE);
    setMinWidthAuto(true);

    iTimesBy = 1;
    for (int i = 1; i < numZeros; i++)
      iTimesBy *= 10;
  
Methods Summary
public voidrefresh(TableCell cell)

    String sText = "";
    DownloadManager dm = (DownloadManager)cell.getDataSource();
    if (dm == null)
      return;

    PEPeerManager pm = dm.getPeerManager();
    if (pm != null) {
      float f = pm.getMinAvailability();
      if (!cell.setSortValue((long)(f * 1000)) && cell.isValid())
        return;
      
        sText = String.valueOf((int)(f * iTimesBy));
        if (numZeros - sText.length() > 0)
          sText = zeros.substring(0, numZeros - sText.length()) + sText;
        sText = sText.substring(0, sText.length() - numZeros + 1) + "." + 
                sText.substring(sText.length() - numZeros + 1);
     
    } else {
      cell.setSortValue(0);
    }
    cell.setText(sText);