use of com.biglybt.pif.download.DownloadStub.DownloadStubFile in project BiglyBT by BiglySoftware.
the class SizeItem method refresh.
@Override
public void refresh(TableCell cell, boolean sortOnlyRefresh) {
DownloadStubFile fileInfo = (DownloadStubFile) cell.getDataSource();
long size;
if (fileInfo == null) {
size = 0;
} else {
size = fileInfo.getLength();
}
if (!cell.setSortValue(size) && cell.isValid()) {
return;
}
if (size < 0) {
// skipped
cell.setText("(" + DisplayFormatters.formatByteCountToKiBEtc(-size) + ")");
} else {
cell.setText(DisplayFormatters.formatByteCountToKiBEtc(size));
}
if (Utils.getUserMode() > 0 && (cell instanceof TableCellSWT)) {
if (size >= 0x40000000l) {
((TableCellSWT) cell).setTextAlpha(200 | 0x100);
} else if (size < 0x100000) {
((TableCellSWT) cell).setTextAlpha(180);
} else {
((TableCellSWT) cell).setTextAlpha(255);
}
}
}
Aggregations