Search in sources :

Example 51 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class PiecesItem method cellAdded.

@Override
public void cellAdded(TableCell cell) {
    synchronized (this) {
        row_count++;
    }
    cell.setFillCell(true);
    Object ds = cell.getDataSource();
    if (ds instanceof PEPeer) {
        PEPeer peer = (PEPeer) ds;
        DiskManager diskmanager = peer.getManager().getDiskManager();
        if (diskmanager.getRemaining() > 0) {
            if (!diskmanager.hasListener(this)) {
                diskmanager.addListener(this);
            }
        }
    }
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Example 52 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class PortItem method refresh.

@Override
public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer) cell.getDataSource();
    int value = (peer == null) ? 0 : peer.getPort();
    if (!cell.setSortValue(value) && cell.isValid())
        return;
    cell.setText("" + value);
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Example 53 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class SnubbedItem method refresh.

@Override
public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer) cell.getDataSource();
    boolean bSnubbed = (peer == null) ? false : peer.isSnubbed();
    if (!cell.setSortValue(bSnubbed ? 1 : 0) && cell.isValid())
        return;
    cell.setText(bSnubbed ? "*" : "");
    TableRow row = cell.getTableRow();
    if (row != null) {
        row.setForeground(Utils.colorToIntArray(bSnubbed ? Colors.grey : null));
    }
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Example 54 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class StatUpItem method refresh.

@Override
public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer) cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getStats().getEstimatedUploadRateOfPeer();
    if (!cell.setSortValue(value) && cell.isValid())
        return;
    cell.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(value));
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Example 55 with PEPeer

use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.

the class TimeToSendPieceItem method refresh.

@Override
public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer) cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getUploadHint();
    Comparable sortValue = cell.getSortValue();
    long oldValue = 0;
    if (sortValue instanceof Number) {
        oldValue = ((Number) sortValue).longValue();
    }
    if (!cell.setSortValue(value) && cell.isValid())
        return;
    String text = TimeFormatter.format(value / 1000);
    if (oldValue > 0) {
        text += ", " + TimeFormatter.format(oldValue / 1000);
    }
    cell.setText(text);
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Aggregations

PEPeer (com.biglybt.core.peer.PEPeer)84 PEPeerManager (com.biglybt.core.peer.PEPeerManager)18 DownloadManager (com.biglybt.core.download.DownloadManager)11 ArrayList (java.util.ArrayList)11 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)5 AERunnable (com.biglybt.core.util.AERunnable)5 PEPiece (com.biglybt.core.peer.PEPiece)4 List (java.util.List)4 Image (org.eclipse.swt.graphics.Image)4 DiskManager (com.biglybt.core.disk.DiskManager)3 GlobalManager (com.biglybt.core.global.GlobalManager)3 PEPeerStats (com.biglybt.core.peer.PEPeerStats)3 PEPeerTransport (com.biglybt.core.peer.impl.PEPeerTransport)3 TOTorrent (com.biglybt.core.torrent.TOTorrent)3 Point (org.eclipse.swt.graphics.Point)3 DiskManagerPiece (com.biglybt.core.disk.DiskManagerPiece)2 DownloadManagerPeerListener (com.biglybt.core.download.DownloadManagerPeerListener)2 PiecePicker (com.biglybt.core.peermanager.piecepicker.PiecePicker)2 BitFlags (com.biglybt.core.peermanager.piecepicker.util.BitFlags)2 Tag (com.biglybt.core.tag.Tag)2