use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class SessionUpItem method refresh.
@Override
public void refresh(TableCell cell) {
Object ds = cell.getDataSource();
long value = 0;
if (ds instanceof DownloadManager) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
value = dm.getStats().getSessionDataBytesSent();
}
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText(DisplayFormatters.formatByteCountToKiBEtc(value));
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class SizeItem method cellHover.
@Override
public void cellHover(TableCell cell) {
Comparable sortValue = cell.getSortValue();
if (!(sortValue instanceof sizeitemsort)) {
return;
}
sizeitemsort value = (sizeitemsort) sortValue;
String tooltip = NumberFormat.getInstance().format(value.size) + " " + MessageText.getString("DHTView.transport.bytes");
if (value.remaining > 0) {
tooltip += "\n" + DisplayFormatters.formatByteCountToKiBEtc(value.remaining, false, false) + " " + MessageText.getString("TableColumn.header.remaining");
}
Object ds = cell.getDataSource();
if (ds instanceof DownloadManager) {
DownloadManager dm = (DownloadManager) ds;
long fullSize = dm.getSize();
if (fullSize > value.size) {
tooltip += "\n" + DisplayFormatters.formatByteCountToKiBEtc(fullSize - value.size, false, false) + " " + MessageText.getString("FileView.BlockView.Skipped");
}
}
cell.setToolTip(tooltip);
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class SizeItem method refresh.
@Override
public void refresh(TableCell cell) {
sizeitemsort value;
Object ds = cell.getDataSource();
if (ds instanceof DownloadManager) {
DownloadManager dm = (DownloadManager) ds;
value = new sizeitemsort(dm.getStats().getSizeExcludingDND(), dm.getStats().getRemainingExcludingDND());
} else if (ds instanceof DiskManagerFileInfo) {
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
value = new sizeitemsort(fileInfo.getLength(), fileInfo.getLength() - fileInfo.getDownloaded());
} else {
return;
}
// I'm afraid something will break.. so use compareTo
if (value.compareTo(cell.getSortValue()) == 0 && cell.isValid())
return;
cell.setSortValue(value);
String s = DisplayFormatters.formatCustomSize("column.size", value.size);
if (s == null) {
s = DisplayFormatters.formatByteCountToKiBEtc(value.size);
}
if (DO_MULTILINE && cell.getMaxLines() > 1 && value.remaining > 0) {
s += "\n" + DisplayFormatters.formatByteCountToKiBEtc(value.remaining, false, false, 0) + " " + MessageText.getString("TableColumn.header.remaining");
}
cell.setText(s);
if (Utils.getUserMode() > 0 && (cell instanceof TableCellSWT)) {
if (value.size >= 0x40000000l) {
((TableCellSWT) cell).setTextAlpha(200 | 0x100);
} else if (value.size < 0x100000) {
((TableCellSWT) cell).setTextAlpha(180);
} else {
((TableCellSWT) cell).setTextAlpha(255);
}
}
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class SmoothedETAItem method refresh.
@Override
public void refresh(TableCell cell) {
Object ds = cell.getDataSource();
if (ds instanceof DiskManagerFileInfo) {
DiskManagerFileInfo file = (DiskManagerFileInfo) cell.getDataSource();
long value = file.getETA();
if (!cell.setSortValue(value) && cell.isValid()) {
return;
}
cell.setText(ViewUtils.formatETA(value, eta_absolute, cdf.getDateFormat()));
} else {
DownloadManager dm = (DownloadManager) cell.getDataSource();
long value = (dm == null) ? 0 : dm.getStats().getSmoothedETA();
if (!cell.setSortValue(value) && cell.isValid()) {
return;
}
cell.setText(ViewUtils.formatETA(value, eta_absolute, cdf.getDateFormat()));
}
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class SmoothedUpItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
long value = (dm == null) ? 0 : dm.getStats().getSmoothedDataSendRate();
if (!cell.setSortValue(value) && cell.isValid()) {
return;
}
cell.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(value));
}
Aggregations