use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class DescriptionItem method refresh.
@Override
public void refresh(TableCell cell) {
if (cell.isDisposed()) {
return;
}
DownloadManager dm = (DownloadManager) cell.getDataSource();
String desc = "";
if (dm != null) {
try {
desc = PlatformTorrentUtils.getContentDescription(dm.getTorrent());
if (desc == null) {
desc = "";
}
} catch (Throwable e) {
}
}
cell.setText(desc);
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class ETAItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
long value = (dm == null) ? 0 : dm.getStats().getETA();
Long sortVal = value < 0 ? null : value;
if (!cell.setSortValue(sortVal) && 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 FileExtensionItem method refresh.
@Override
public void refresh(TableCell cell) {
Object ds = cell.getDataSource();
String text = "";
DownloadManager dm;
if (ds instanceof DownloadManager) {
dm = (DownloadManager) ds;
DiskManagerFileInfo prim = dm.getDownloadState().getPrimaryFile();
text = prim == null ? "" : prim.getFile(true).getName();
} else if (ds instanceof DiskManagerFileInfo) {
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
dm = fileInfo.getDownloadManager();
text = fileInfo.getFile(true).getName();
} else {
return;
}
String incomp_suffix = dm == null ? null : dm.getDownloadState().getAttribute(DownloadManagerState.AT_INCOMP_FILE_SUFFIX);
if (incomp_suffix != null && text.endsWith(incomp_suffix)) {
text = text.substring(0, text.length() - incomp_suffix.length());
}
int pos = text.lastIndexOf(".");
if (pos >= 0) {
text = text.substring(pos + 1);
} else {
text = "";
}
cell.setText(text);
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class FilesLinkedItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
int link_count = 0;
if (dm != null) {
link_count = dm.getDownloadState().getFileLinks().size();
}
if (!cell.setSortValue(link_count) && cell.isValid()) {
return;
}
cell.setText(link_count == 0 ? "" : String.valueOf(link_count));
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class PeerSourcesItem method refresh.
@Override
public void refresh(TableCell cell) {
String ps = "";
DownloadManager dm = (DownloadManager) cell.getDataSource();
if (dm != null) {
String[] nets = dm.getDownloadState().getPeerSources();
for (int i = 0; i < nets.length; i++) {
ps += (i == 0 ? "" : ",") + nets[i];
}
}
cell.setText(ps);
}
Aggregations