FileDocCategorySizeDatePackage
UpItem.javaAPI DocAzureus 3.0.3.42917Sun Sep 23 04:54:50 BST 2007org.gudy.azureus2.ui.swt.views.tableitems.peers

UpItem

public class UpItem 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 UpItem(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("upload", 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().getTotalDataBytesSent();
			prot_value = peer.getStats().getTotalProtocolBytesSent();
		}
		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));