FileDocCategorySizeDatePackage
ViewDownSpeedGraph.javaAPI DocAzureus 3.0.3.44193Sat Jun 02 14:13:54 BST 2007com.aelitis.azureus.ui.swt.views

ViewDownSpeedGraph

public class ViewDownSpeedGraph extends org.gudy.azureus2.ui.swt.views.AbstractIView
author
TuxPaper
created
Apr 7, 2007

Fields Summary
org.gudy.azureus2.core3.global.GlobalManager
manager
org.gudy.azureus2.core3.global.GlobalManagerStats
stats
org.gudy.azureus2.core3.stats.transfer.OverallStats
totalStats
org.eclipse.swt.widgets.Canvas
downSpeedCanvas
org.gudy.azureus2.ui.swt.components.graphics.SpeedGraphic
downSpeedGraphic
Constructors Summary
public ViewDownSpeedGraph()

		this.manager = AzureusCoreFactory.getSingleton().getGlobalManager();
		this.stats = manager.getStats();
		this.totalStats = StatsFactory.getStats();
		
		SimpleTimer.addPeriodicEvent("TopBarSpeedGraphicView", 1000, new TimerEventPerformer() {
			public void perform(TimerEvent event) {
				periodicUpdate();
			}
		});
	
Methods Summary
public voiddelete()

		Utils.disposeComposite(downSpeedCanvas);
		downSpeedGraphic.dispose();
	
public org.eclipse.swt.widgets.CompositegetComposite()

		return downSpeedCanvas;
	
public java.lang.StringgetData()

		return "SpeedView.title.full";
	
public java.lang.StringgetFullTitle()

		return "DL Speed";
	
public voidinitialize(org.eclipse.swt.widgets.Composite composite)

		GridData gridData;

		downSpeedCanvas = new Canvas(composite, SWT.NONE);
		gridData = new GridData(GridData.FILL_BOTH);
		downSpeedCanvas.setLayoutData(gridData);
		downSpeedGraphic = SpeedGraphic.getInstance();
		downSpeedGraphic.initialize(downSpeedCanvas);
		//downSpeedGraphic.setAutoAlpha(true);
		SWTSkinProperties skinProperties = SWTSkinFactory.getInstance().getSkinProperties();
		Color cBG1 = skinProperties.getColor("color.topbar.speed.bg1");
		Color cBG2 = skinProperties.getColor("color.topbar.speed.bg2");
		Color cBG3 = skinProperties.getColor("color.topbar.speed.bg3");
		downSpeedGraphic.setColors(cBG1, cBG2, cBG3);
		downSpeedGraphic.setLineColors(skinProperties.getColor("color.topbar.speed.average"),
				skinProperties.getColor("color.topbar.speed.value0"),
				skinProperties.getColor("color.topbar.speed.value1"),
				skinProperties.getColor("color.topbar.speed.value2plus"),
				skinProperties.getColor("color.topbar.speed.trimmed"));
	
public voidperiodicUpdate()


		int swarms_peer_speed = (int) stats.getTotalSwarmsPeerRate(true, false);

		downSpeedGraphic.addIntsValue(new int[] {
			stats.getDataReceiveRate() + stats.getProtocolReceiveRate(),
			COConfigurationManager.getIntParameter("Max Download Speed KBs") * 1024,
			swarms_peer_speed
		});
	
public voidrefresh()

		downSpeedGraphic.refresh();