Search in sources :

Example 51 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class SessionUpItem method refresh.

@Override
public void refresh(TableCell cell) {
    Object ds = cell.getDataSource();
    long value = 0;
    if (ds instanceof DownloadManager) {
        DownloadManager dm = (DownloadManager) cell.getDataSource();
        value = dm.getStats().getSessionDataBytesSent();
    }
    if (!cell.setSortValue(value) && cell.isValid())
        return;
    cell.setText(DisplayFormatters.formatByteCountToKiBEtc(value));
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Example 52 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class SizeItem method cellHover.

@Override
public void cellHover(TableCell cell) {
    Comparable sortValue = cell.getSortValue();
    if (!(sortValue instanceof sizeitemsort)) {
        return;
    }
    sizeitemsort value = (sizeitemsort) sortValue;
    String tooltip = NumberFormat.getInstance().format(value.size) + " " + MessageText.getString("DHTView.transport.bytes");
    if (value.remaining > 0) {
        tooltip += "\n" + DisplayFormatters.formatByteCountToKiBEtc(value.remaining, false, false) + " " + MessageText.getString("TableColumn.header.remaining");
    }
    Object ds = cell.getDataSource();
    if (ds instanceof DownloadManager) {
        DownloadManager dm = (DownloadManager) ds;
        long fullSize = dm.getSize();
        if (fullSize > value.size) {
            tooltip += "\n" + DisplayFormatters.formatByteCountToKiBEtc(fullSize - value.size, false, false) + " " + MessageText.getString("FileView.BlockView.Skipped");
        }
    }
    cell.setToolTip(tooltip);
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Example 53 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class SizeItem method refresh.

@Override
public void refresh(TableCell cell) {
    sizeitemsort value;
    Object ds = cell.getDataSource();
    if (ds instanceof DownloadManager) {
        DownloadManager dm = (DownloadManager) ds;
        value = new sizeitemsort(dm.getStats().getSizeExcludingDND(), dm.getStats().getRemainingExcludingDND());
    } else if (ds instanceof DiskManagerFileInfo) {
        DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
        value = new sizeitemsort(fileInfo.getLength(), fileInfo.getLength() - fileInfo.getDownloaded());
    } else {
        return;
    }
    // I'm afraid something will break.. so use compareTo
    if (value.compareTo(cell.getSortValue()) == 0 && cell.isValid())
        return;
    cell.setSortValue(value);
    String s = DisplayFormatters.formatCustomSize("column.size", value.size);
    if (s == null) {
        s = DisplayFormatters.formatByteCountToKiBEtc(value.size);
    }
    if (DO_MULTILINE && cell.getMaxLines() > 1 && value.remaining > 0) {
        s += "\n" + DisplayFormatters.formatByteCountToKiBEtc(value.remaining, false, false, 0) + " " + MessageText.getString("TableColumn.header.remaining");
    }
    cell.setText(s);
    if (Utils.getUserMode() > 0 && (cell instanceof TableCellSWT)) {
        if (value.size >= 0x40000000l) {
            ((TableCellSWT) cell).setTextAlpha(200 | 0x100);
        } else if (value.size < 0x100000) {
            ((TableCellSWT) cell).setTextAlpha(180);
        } else {
            ((TableCellSWT) cell).setTextAlpha(255);
        }
    }
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) TableCellSWT(com.biglybt.ui.swt.views.table.TableCellSWT) DownloadManager(com.biglybt.core.download.DownloadManager)

Example 54 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class SmoothedETAItem method refresh.

@Override
public void refresh(TableCell cell) {
    Object ds = cell.getDataSource();
    if (ds instanceof DiskManagerFileInfo) {
        DiskManagerFileInfo file = (DiskManagerFileInfo) cell.getDataSource();
        long value = file.getETA();
        if (!cell.setSortValue(value) && cell.isValid()) {
            return;
        }
        cell.setText(ViewUtils.formatETA(value, eta_absolute, cdf.getDateFormat()));
    } else {
        DownloadManager dm = (DownloadManager) cell.getDataSource();
        long value = (dm == null) ? 0 : dm.getStats().getSmoothedETA();
        if (!cell.setSortValue(value) && cell.isValid()) {
            return;
        }
        cell.setText(ViewUtils.formatETA(value, eta_absolute, cdf.getDateFormat()));
    }
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) DownloadManager(com.biglybt.core.download.DownloadManager)

Example 55 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class SmoothedUpItem method refresh.

@Override
public void refresh(TableCell cell) {
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    long value = (dm == null) ? 0 : dm.getStats().getSmoothedDataSendRate();
    if (!cell.setSortValue(value) && cell.isValid()) {
        return;
    }
    cell.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(value));
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Aggregations

DownloadManager (com.biglybt.core.download.DownloadManager)307 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)54 TOTorrent (com.biglybt.core.torrent.TOTorrent)35 GlobalManager (com.biglybt.core.global.GlobalManager)33 PEPeerManager (com.biglybt.core.peer.PEPeerManager)29 File (java.io.File)29 List (java.util.List)21 Core (com.biglybt.core.Core)17 Download (com.biglybt.pif.download.Download)17 Point (org.eclipse.swt.graphics.Point)17 UIFunctions (com.biglybt.ui.UIFunctions)16 Tag (com.biglybt.core.tag.Tag)15 UIInputReceiverListener (com.biglybt.pif.ui.UIInputReceiverListener)14 TOTorrentException (com.biglybt.core.torrent.TOTorrentException)13 ArrayList (java.util.ArrayList)13 DiskManager (com.biglybt.core.disk.DiskManager)12 DownloadManagerStats (com.biglybt.core.download.DownloadManagerStats)12 CoreRunningListener (com.biglybt.core.CoreRunningListener)11 DownloadManagerState (com.biglybt.core.download.DownloadManagerState)11 PEPeer (com.biglybt.core.peer.PEPeer)11