public void initialize(Composite composite) { GridData gridData; downSpeedCanvas = new Canvas(composite, SWT.DOUBLE_BUFFERED); 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.overhead"), skinProperties.getColor("color.topbar.speed.value1"), skinProperties.getColor("color.topbar.speed.value2plus"), skinProperties.getColor("color.topbar.speed.trimmed")); }
public void periodicUpdate() { if (manager == null || stats == null) { return; } int swarms_peer_speed = (int) stats.getTotalSwarmsPeerRate(true, false); downSpeedGraphic.addIntsValue( new int[] { stats.getDataReceiveRate() + stats.getProtocolReceiveRate(), stats.getProtocolReceiveRate(), COConfigurationManager.getIntParameter("Max Download Speed KBs") * 1024, swarms_peer_speed }); }
public void refresh() { if (!everRefreshed) { everRefreshed = true; timerEvent = SimpleTimer.addPeriodicEvent( "TopBarSpeedGraphicView", 1000, new TimerEventPerformer() { public void perform(TimerEvent event) { if (downSpeedCanvas.isDisposed()) { timerEvent.cancel(); } else { periodicUpdate(); } } }); } downSpeedGraphic.refresh(); }
public void delete() { Utils.disposeComposite(downSpeedCanvas); downSpeedGraphic.dispose(); }