use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class IncomingRequestCountItem method refresh.
@Override
public void refresh(TableCell cell) {
PEPeer peer = (PEPeer) cell.getDataSource();
long value = (peer == null) ? 0 : peer.getIncomingRequestCount();
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText("" + value);
}
use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class IpItem method refresh.
@Override
public void refresh(TableCell cell) {
PEPeer peer = (PEPeer) cell.getDataSource();
String sText = (peer == null) ? "" : peer.getIp();
if (cell.setText(sText) || !cell.isValid()) {
String[] sBlocks = sText.split("\\.");
if (sBlocks.length == 4) {
try {
long l = (Long.parseLong(sBlocks[0]) << 24) + (Long.parseLong(sBlocks[1]) << 16) + (Long.parseLong(sBlocks[2]) << 8) + Long.parseLong(sBlocks[3]);
cell.setSortValue(l);
} catch (Exception e) {
e.printStackTrace();
/* ignore */
}
}
}
}
use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class PiecesItem method dispose.
@Override
public void dispose(TableCell cell) {
synchronized (this) {
row_count--;
}
// Named infoObj so code can be copied easily to the other PiecesItem
final List<Image> to_dispose = new ArrayList<>();
PEPeer infoObj = (PEPeer) cell.getDataSource();
if (infoObj != null) {
Image img = (Image) infoObj.getData("PiecesImage");
if (img != null) {
to_dispose.add(img);
}
infoObj.setData("PiecesImageBuffer", null);
infoObj.setData("PiecesImage", null);
}
Graphic graphic = cell.getGraphic();
if (graphic instanceof UISWTGraphic) {
Image img = ((UISWTGraphic) graphic).getImage();
if (img != null && to_dispose.contains(img)) {
to_dispose.add(img);
}
}
if (to_dispose.size() > 0) {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
for (Image img : to_dispose) {
if (!img.isDisposed()) {
img.dispose();
}
}
}
});
}
}
use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class ProtocolItem method refresh.
@Override
public void refresh(TableCell cell) {
PEPeer peer = (PEPeer) cell.getDataSource();
String value;
if (peer == null) {
value = "";
} else {
value = peer.getProtocol();
String qualifier = peer.getProtocolQualifier();
if (qualifier != null) {
value += " (" + qualifier + ")";
}
}
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText(value);
}
use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class TotalDownSpeedItem method refresh.
@Override
public void refresh(TableCell cell) {
PEPeer peer = (PEPeer) cell.getDataSource();
long value = (peer == null) ? 0 : peer.getStats().getEstimatedDownloadRateOfPeer();
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(value));
}
Aggregations