use of com.biglybt.core.disk.DiskManagerFileInfo in project BiglyBT by BiglySoftware.
the class FileETAItem method refresh.
@Override
public void refresh(TableCell cell) {
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) cell.getDataSource();
long eta = -1;
if (fileInfo != null) {
eta = fileInfo.getETA();
}
if (!cell.setSortValue(eta) && cell.isValid()) {
return;
}
cell.setText(ViewUtils.formatETA(eta, eta_absolute, cdf.getDateFormat()));
}
use of com.biglybt.core.disk.DiskManagerFileInfo in project BiglyBT by BiglySoftware.
the class FileExtensionItem method refresh.
@Override
public void refresh(TableCell cell) {
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) cell.getDataSource();
cell.setText(determineFileExt(fileInfo));
}
use of com.biglybt.core.disk.DiskManagerFileInfo in project BiglyBT by BiglySoftware.
the class FileHashItemBase method refresh.
@Override
public void refresh(TableCell cell) {
DiskManagerFileInfo file = (DiskManagerFileInfo) cell.getDataSource();
if (file == null) {
return;
}
cell.setText(getHash(hash_type, file));
}
use of com.biglybt.core.disk.DiskManagerFileInfo in project BiglyBT by BiglySoftware.
the class PercentItem method refresh.
@Override
public void refresh(TableCell cell) {
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) cell.getDataSource();
boolean internal = fileInfo instanceof FilesView.FilesViewTreeNode && !((FilesView.FilesViewTreeNode) fileInfo).isLeaf();
long percent = 0;
if (fileInfo != null) {
long bytesDownloaded = fileInfo.getDownloaded();
if (bytesDownloaded < 0) {
// unknown skeleton value
percent = -1;
} else {
long length = fileInfo.getLength();
if (length != 0) {
percent = (1000 * bytesDownloaded) / length;
} else {
percent = 1000;
}
}
} else {
// unknown skeleton value
percent = -1;
}
if (!cell.setSortValue(percent) && cell.isValid()) {
return;
}
String text;
if (percent < 0) {
text = "";
} else {
text = DisplayFormatters.formatPercentFromThousands((int) percent);
if (internal) {
// text = "(" + text + ")";
}
}
cell.setText(text);
}
use of com.biglybt.core.disk.DiskManagerFileInfo in project BiglyBT by BiglySoftware.
the class PieceCountItem method refresh.
@Override
public void refresh(TableCell cell) {
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) cell.getDataSource();
long value = (fileInfo == null) ? 0 : fileInfo.getNbPieces();
if (!cell.setSortValue(value) && cell.isValid()) {
return;
}
// < 0 -> unknown skeleton value
cell.setText(value < 0 ? "" : ("" + value));
}
Aggregations