use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class TrackerNameItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
String name = "";
if (dm != null && dm.getTorrent() != null) {
TOTorrent torrent = dm.getTorrent();
name = getTrackerName(torrent);
}
if (cell.setText(name) || !cell.isValid()) {
TrackerCellUtils.updateColor(cell, dm, false);
}
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class TrackerNextAccessItem method cellHover.
@Override
public void cellHover(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
cell.setToolTip(TrackerCellUtils.getTooltipText(cell, dm, false));
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class TrackerStatusItem method cellHover.
@Override
public void cellHover(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
cell.setToolTip(TrackerCellUtils.getTooltipText(cell, dm, true));
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class UpSpeedLimitItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
long value = (dm == null) ? 0 : dm.getEffectiveUploadRateLimitBytesPerSecond();
if (!cell.setSortValue(value) && cell.isValid())
return;
if (value == -1) {
cell.setText(MessageText.getString("MyTorrents.items.UpSpeedLimit.disabled"));
} else if (value == 0) {
cell.setText(Constants.INFINITY_STRING);
} else {
cell.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(value));
}
}
use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.
the class StatusItem method refresh.
@Override
public void refresh(TableCell cell) {
DownloadManager dm = (DownloadManager) cell.getDataSource();
if (dm == null) {
return;
}
int state = dm.getState();
long sort_value;
String text;
String tooltip = null;
if (showTrackerErrors && dm.isUnauthorisedOnTracker() && state != DownloadManager.STATE_ERROR) {
text = dm.getTrackerStatus();
sort_value = 1100;
} else {
text = DisplayFormatters.formatDownloadStatus(dm);
if (dm.isForceStart() && (state == DownloadManager.STATE_DOWNLOADING || state == DownloadManager.STATE_SEEDING)) {
sort_value = 1000;
} else {
switch(state) {
case DownloadManager.STATE_SEEDING:
{
sort_value = 900;
break;
}
case DownloadManager.STATE_DOWNLOADING:
{
sort_value = 800;
break;
}
case DownloadManager.STATE_QUEUED:
{
sort_value = 700;
tooltip = MessageText.getString("ManagerItem.queued.tooltip");
break;
}
case DownloadManager.STATE_STOPPED:
{
if (dm.isPaused()) {
sort_value = 600;
} else {
sort_value = 500;
}
break;
}
default:
{
sort_value = 0;
}
}
}
}
sort_value += state;
sort_value <<= 32;
if (dm.isDownloadComplete(false)) {
Download dl = PluginCoreUtils.wrap(dm);
if (dl != null) {
sort_value += dl.getSeedingRank();
}
} else {
sort_value -= dm.getPosition();
}
boolean update;
if (priority_sort) {
update = cell.setSortValue(sort_value);
if (!update) {
if (!cell.getText().equals(text)) {
update = true;
}
}
} else {
update = cell.setSortValue(text);
}
if (update || !cell.isValid()) {
cell.setText(text);
cell.setToolTip(tooltip);
boolean clickable = false;
if (cell instanceof TableCellSWT) {
int cursor_id;
if (!text.contains("http://")) {
dm.setUserData(CLICK_KEY, null);
cursor_id = SWT.CURSOR_ARROW;
} else {
dm.setUserData(CLICK_KEY, text);
cursor_id = SWT.CURSOR_HAND;
clickable = true;
}
((TableCellSWT) cell).setCursorID(cursor_id);
}
if (!changeCellFG && !changeRowFG) {
// clickable, make it blue whatever
cell.setForeground(clickable ? BLUE : null);
return;
}
TableRow row = cell.getTableRow();
if (row != null) {
Color color = null;
if (state == DownloadManager.STATE_SEEDING) {
color = Colors.blues[Colors.BLUES_MIDDARK];
} else if (state == DownloadManager.STATE_ERROR) {
color = Colors.colorError;
} else {
color = null;
}
if (changeRowFG) {
row.setForeground(Utils.colorToIntArray(color));
} else if (changeCellFG) {
cell.setForeground(Utils.colorToIntArray(color));
}
if (clickable) {
cell.setForeground(Utils.colorToIntArray(Colors.blue));
}
}
}
}
Aggregations