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));
}
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);
}
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);
}
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());
}
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));
}
Aggregations