Search in sources :

Example 6 with DiskManagerFileInfo

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()));
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo)

Example 7 with DiskManagerFileInfo

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));
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo)

Example 8 with DiskManagerFileInfo

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));
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo)

Example 9 with DiskManagerFileInfo

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);
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) FilesView(com.biglybt.ui.swt.views.FilesView)

Example 10 with DiskManagerFileInfo

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));
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo)

Aggregations

DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)107 DownloadManager (com.biglybt.core.download.DownloadManager)54 File (java.io.File)16 TOTorrent (com.biglybt.core.torrent.TOTorrent)15 PEPeerManager (com.biglybt.core.peer.PEPeerManager)9 DiskManagerFileInfoSet (com.biglybt.core.disk.DiskManagerFileInfoSet)8 TableRowCore (com.biglybt.ui.common.table.TableRowCore)8 DiskManager (com.biglybt.core.disk.DiskManager)7 IOException (java.io.IOException)7 Point (org.eclipse.swt.graphics.Point)7 DownloadManagerState (com.biglybt.core.download.DownloadManagerState)6 MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)6 FilesView (com.biglybt.ui.swt.views.FilesView)6 List (java.util.List)6 Image (org.eclipse.swt.graphics.Image)6 DiskManagerPiece (com.biglybt.core.disk.DiskManagerPiece)5 PEPeer (com.biglybt.core.peer.PEPeer)5 TOTorrentException (com.biglybt.core.torrent.TOTorrentException)5 UIFunctions (com.biglybt.ui.UIFunctions)5 ISelectedContent (com.biglybt.ui.selectedcontent.ISelectedContent)5