use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class HealthItem method refresh.
@Override
public void refresh(TableCell cell) {
if (tracker_host == null) {
try {
tracker_host = CoreFactory.getSingleton().getTrackerHost();
} catch (Throwable t) {
}
if (tracker_host == null) {
return;
}
}
DownloadManager dm = (DownloadManager) cell.getDataSource();
int health;
TRHostTorrent ht;
if (dm == null) {
health = 0;
ht = null;
} else {
health = dm.getHealthStatus();
ht = tracker_host.getHostTorrent(dm.getTorrent());
}
if (!cell.setSortValue(health + (ht == null ? 0 : 256)) && cell.isValid())
return;
String sHelpID = null;
if (health == DownloadManager.WEALTH_KO) {
sHelpID = "health.explain.red";
} else if (health == DownloadManager.WEALTH_OK) {
sHelpID = "health.explain.green";
} else if (health == DownloadManager.WEALTH_NO_TRACKER) {
sHelpID = "health.explain.blue";
} else if (health == DownloadManager.WEALTH_NO_REMOTE) {
sHelpID = "health.explain.yellow";
} else if (health == DownloadManager.WEALTH_ERROR) {
} else {
sHelpID = "health.explain.grey";
}
String sToolTip = (health == DownloadManager.WEALTH_ERROR && dm != null) ? dm.getErrorDetails() : MessageText.getString(sHelpID);
if (ht != null)
sToolTip += "\n" + MessageText.getString("health.explain.share");
cell.setToolTip(sToolTip);
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class IPFilterItem method refresh.
@Override
public void refresh(TableCell cell) {
// String state = "";
UISWTGraphic icon = null;
int sort = 0;
if (ipfilter == null) {
ipfilter = IpFilterManagerFactory.getSingleton().getIPFilter();
}
if (ipfilter.isEnabled()) {
if (tick_icon == null) {
tick_icon = new UISWTGraphicImpl(ImageLoader.getInstance().getImage("tick_mark"));
cross_icon = new UISWTGraphicImpl(ImageLoader.getInstance().getImage("cross_mark"));
}
DownloadManager dm = (DownloadManager) cell.getDataSource();
if (dm != null) {
boolean excluded = dm.getDownloadState().getFlag(DownloadManagerState.FLAG_DISABLE_IP_FILTER);
if (excluded) {
icon = cross_icon;
sort = 1;
// state = "\u2718";
} else {
icon = tick_icon;
sort = 2;
// state = "\u2714";
}
}
}
cell.setSortValue(sort);
if (cell.getGraphic() != icon) {
cell.setGraphic(icon);
}
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class MergedDataItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
long value = (dm == null) ? 0 : dm.getDownloadState().getLongAttribute(DownloadManagerState.AT_MERGED_DATA);
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText(value == 0 ? "" : DisplayFormatters.formatByteCountToKiBEtc(value));
String info = dm.isSwarmMerging();
if (info == null) {
info = "";
}
cell.setToolTip(info);
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class MinSRItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
int value = 0;
if (dm != null) {
value = dm.getDownloadState().getIntParameter(DownloadManagerState.PARAM_MIN_SHARE_RATIO);
}
if (!cell.setSortValue(value) && cell.isValid()) {
return;
}
cell.setText(value == 0 ? "" : String.valueOf(value / 1000.0f));
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class MoveOnCompleteItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
String target = (dm == null) ? null : dm.getDownloadState().getAttribute(DownloadManagerState.AT_MOVE_ON_COMPLETE_DIR);
if (target == null) {
target = "";
}
if (!cell.setSortValue(target) && cell.isValid()) {
return;
}
cell.setText(target);
}
Aggregations