use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class OptimisticUnchokeItem method refresh.
@Override
public void refresh(TableCell cell) {
PEPeer peer = (PEPeer) cell.getDataSource();
long value = (peer == null) ? 0 : (peer.isOptimisticUnchoke() ? 1 : 0);
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText((value == 1) ? "*" : "");
}
use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class OutgoingRequestCountItem method refresh.
@Override
public void refresh(TableCell cell) {
PEPeer peer = (PEPeer) cell.getDataSource();
long value = (peer == null) ? 0 : peer.getOutgoingRequestCount();
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText("" + value);
}
use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class PeerIDItem method refresh.
@Override
public void refresh(TableCell cell) {
PEPeer peer = (PEPeer) cell.getDataSource();
if (peer == null) {
cell.setText("");
return;
}
byte[] peer_id = peer.getId();
if (peer_id == null) {
cell.setText("");
return;
}
try {
String text = new String(peer_id, 0, peer_id.length, Constants.BYTE_ENCODING);
// Replace newlines.
text = text.replace((char) 12, (char) 32);
text = text.replace((char) 10, (char) 32);
cell.setText(text);
} catch (java.io.UnsupportedEncodingException uee) {
cell.setText("");
}
}
use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class PercentItem method refresh.
@Override
public void refresh(TableCell cell) {
PEPeer peer = (PEPeer) cell.getDataSource();
int value = (peer == null) ? 0 : peer.getPercentDoneInThousandNotation();
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText(DisplayFormatters.formatPercentFromThousands(value));
}
use of com.biglybt.core.peer.PEPeer in project BiglyBT by BiglySoftware.
the class ASItem method refresh.
@Override
public void refresh(TableCell cell) {
final PEPeer peer = (PEPeer) cell.getDataSource();
String text = "";
if (peer != null) {
text = (String) peer.getUserData(ASItem.class);
if (text == null) {
text = "";
peer.setUserData(ASItem.class, text);
String peer_ip = peer.getIp();
if (AENetworkClassifier.categoriseAddress(peer_ip) == AENetworkClassifier.AT_PUBLIC) {
try {
NetworkAdmin.getSingleton().lookupASN(InetAddress.getByName(peer_ip), new NetworkAdminASNListener() {
@Override
public void success(NetworkAdminASN asn) {
peer.setUserData(ASItem.class, asn.getAS() + " - " + asn.getASName());
}
@Override
public void failed(NetworkAdminException error) {
}
});
} catch (Throwable e) {
}
}
}
}
if (!cell.setSortValue(text) && cell.isValid()) {
return;
}
cell.setText(text);
}
Aggregations