public void refresh(TableCell cell) { ClientStatsDataSource ds = (ClientStatsDataSource) cell.getDataSource(); if (ds == null) { return; } float val = ds.count * 1000f / ds.overall.count; if (cell.setSortValue(val) || !cell.isValid()) { cell.setText(DisplayFormatters.formatPercentFromThousands((int) val)); } }
public void refresh(TableCell cell) { int average = -1; DownloadManager dm = (DownloadManager) cell.getDataSource(); if (dm != null) { PEPeerManager pm = dm.getPeerManager(); if (pm != null) { average = pm.getAverageCompletionInThousandNotation(); } } if (!cell.setSortValue(average) && cell.isValid()) { return; } if (average < 0) { cell.setText(""); } else { cell.setText(DisplayFormatters.formatPercentFromThousands(average)); } }