FileDocCategorySizeDatePackage
DownItem.javaAPI DocAzureus 3.0.3.42934Sun Sep 23 04:55:04 BST 2007org.gudy.azureus2.ui.swt.views.tableitems.peers

DownItem

public class DownItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener
author
Olivier
author
TuxPaper (2004/Apr/19: modified to TableCellAdapter)

Fields Summary
protected static boolean
separate_prot_data_stats
protected static boolean
data_stats_only
Constructors Summary
public DownItem(String table_id)
Default Constructor

		COConfigurationManager.addAndFireParameterListeners(new String[] {
				"config.style.dataStatsOnly",
				"config.style.separateProtDataStats" }, new ParameterListener() {
			public void parameterChanged(String x) {
				separate_prot_data_stats = COConfigurationManager.getBooleanParameter("config.style.separateProtDataStats");
				data_stats_only = COConfigurationManager.getBooleanParameter("config.style.dataStatsOnly");
			}
		});
	
		super("download", ALIGN_TRAIL, POSITION_INVISIBLE, 70, table_id);
		setRefreshInterval(INTERVAL_LIVE);
	
Methods Summary
public voidrefresh(TableCell cell)

		PEPeer peer = (PEPeer) cell.getDataSource();
		long data_value = 0;
		long prot_value = 0;

		if (peer != null) {
			data_value = peer.getStats().getTotalDataBytesReceived();
			prot_value = peer.getStats().getTotalProtocolBytesReceived();
		}
		long sort_value;
		if (separate_prot_data_stats) {
			sort_value = (data_value << 24) + prot_value;
		} else if (data_stats_only) {
			sort_value = data_value;
		} else {
			sort_value = data_value + prot_value;
		}

		if (!cell.setSortValue(sort_value) && cell.isValid())
			return;

		cell.setText(DisplayFormatters.formatDataProtByteCountToKiBEtc(data_value,
				prot_value));