Search in sources :

Example 56 with PEPeer

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

the class TimeUntilCompleteItem method refresh.

@Override
public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer) cell.getDataSource();
    long value = (peer == null) ? Long.MAX_VALUE : peer.getStats().getEstimatedSecondsToCompletion();
    if (!cell.setSortValue(value) && cell.isValid())
        return;
    if (value > 7 * 24 * 60 * 60) {
        value = Long.MAX_VALUE;
    }
    cell.setText(DisplayFormatters.formatETA(value));
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Example 57 with PEPeer

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

the class UniquePieceItem method refresh.

@Override
public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer) cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getUniqueAnnounce();
    if (!cell.setSortValue(value) && cell.isValid())
        return;
    cell.setText((value == -1) ? MessageText.getString("label.none") : "" + value);
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Example 58 with PEPeer

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

the class ClientIdentificationItem method refresh.

/* (non-Javadoc)
	 * @see com.biglybt.pif.ui.tables.TableCellRefreshListener#refresh(com.biglybt.pif.ui.tables.TableCell)
	 */
@Override
public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer) cell.getDataSource();
    if (peer == null) {
        cell.setText("");
        return;
    }
    String peer_id_name = peer.getClientNameFromPeerID();
    String peer_handshake_name = peer.getClientNameFromExtensionHandshake();
    if (peer_id_name == null) {
        peer_id_name = "";
    }
    if (peer_handshake_name == null) {
        peer_handshake_name = "";
    }
    if (peer_id_name.equals("") && peer_handshake_name.equals("")) {
        cell.setText("");
        return;
    }
    String result = peer_id_name;
    if (!peer_handshake_name.equals("")) {
        result += " / " + peer_handshake_name;
    }
    cell.setText(result);
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Example 59 with PEPeer

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

the class ClientItem method refresh.

@Override
public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer) cell.getDataSource();
    cell.setText(peer == null ? "" : peer.getClient());
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer)

Example 60 with PEPeer

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

the class DLedFromOthersItem method refresh.

@Override
public void refresh(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));
}
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