Search in sources :

Example 6 with DownloadStubFile

use of com.biglybt.pif.download.DownloadStub.DownloadStubFile in project BiglyBT by BiglySoftware.

the class SizeItem method refresh.

@Override
public void refresh(TableCell cell, boolean sortOnlyRefresh) {
    DownloadStubFile fileInfo = (DownloadStubFile) cell.getDataSource();
    long size;
    if (fileInfo == null) {
        size = 0;
    } else {
        size = fileInfo.getLength();
    }
    if (!cell.setSortValue(size) && cell.isValid()) {
        return;
    }
    if (size < 0) {
        // skipped
        cell.setText("(" + DisplayFormatters.formatByteCountToKiBEtc(-size) + ")");
    } else {
        cell.setText(DisplayFormatters.formatByteCountToKiBEtc(size));
    }
    if (Utils.getUserMode() > 0 && (cell instanceof TableCellSWT)) {
        if (size >= 0x40000000l) {
            ((TableCellSWT) cell).setTextAlpha(200 | 0x100);
        } else if (size < 0x100000) {
            ((TableCellSWT) cell).setTextAlpha(180);
        } else {
            ((TableCellSWT) cell).setTextAlpha(255);
        }
    }
}
Also used : DownloadStubFile(com.biglybt.pif.download.DownloadStub.DownloadStubFile) TableCellSWT(com.biglybt.ui.swt.views.table.TableCellSWT)

Aggregations

DownloadStubFile (com.biglybt.pif.download.DownloadStub.DownloadStubFile)6 File (java.io.File)2 PluginInterface (com.biglybt.pif.PluginInterface)1 Download (com.biglybt.pif.download.Download)1 DownloadStub (com.biglybt.pif.download.DownloadStub)1 TableDataSourceChangedListener (com.biglybt.ui.common.table.TableDataSourceChangedListener)1 TableLifeCycleListener (com.biglybt.ui.common.table.TableLifeCycleListener)1 TableCellSWT (com.biglybt.ui.swt.views.table.TableCellSWT)1 TableViewSWTMenuFillListener (com.biglybt.ui.swt.views.table.TableViewSWTMenuFillListener)1 ArrayList (java.util.ArrayList)1 Pattern (java.util.regex.Pattern)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1