FileDocCategorySizeDatePackage
AllTransfersBar.javaAPI DocAzureus 3.0.3.45668Fri Aug 31 16:31:26 BST 2007org.gudy.azureus2.ui.swt.minibar

AllTransfersBar

public class AllTransfersBar extends MiniBar
author
Allan Crooks

Fields Summary
private static MiniBarManager
manager
private org.gudy.azureus2.core3.global.GlobalManager
g_manager
private org.eclipse.swt.widgets.Label
down_speed
private org.eclipse.swt.widgets.Label
up_speed
Constructors Summary
private AllTransfersBar(org.gudy.azureus2.core3.global.GlobalManager gmanager, org.eclipse.swt.widgets.Shell main)

		super(manager);
		this.g_manager = gmanager;
		this.construct(main);
	
Methods Summary
public voidbeginConstruction()

		this.createFixedTextLabel("MinimizedWindow.all_transfers", false, true);
		this.createGap(40);

		// Download speed.
		this.createFixedTextLabel("ConfigView.download.abbreviated", false, false);
		this.down_speed = this.createSpeedLabel();
		
		// Upload speed.
		this.createFixedTextLabel("ConfigView.upload.abbreviated", false, false);
		this.up_speed = this.createSpeedLabel();
	
public voidbuildMenu(org.eclipse.swt.widgets.Menu menu)


		// Start All
		MenuItem start_all = new MenuItem(menu, SWT.PUSH);
		Messages.setLanguageText(start_all, "MainWindow.menu.transfers.startalltransfers");
		Utils.setMenuItemImage(start_all, "start");
		start_all.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event e) {
				ManagerUtils.asyncStartAll();
			}
		});
		start_all.setEnabled(true);

		// Stop All
		MenuItem stop_all = new MenuItem(menu, SWT.PUSH);
		Messages.setLanguageText(stop_all, "MainWindow.menu.transfers.stopalltransfers");
		Utils.setMenuItemImage(stop_all, "stop");
		stop_all.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event e) {
				ManagerUtils.asyncStopAll();
			}
		});
		stop_all.setEnabled(true);
		
		// Pause All
		MenuItem pause_all = new MenuItem(menu, SWT.PUSH);
		Messages.setLanguageText(pause_all, "MainWindow.menu.transfers.pausetransfers");
		Utils.setMenuItemImage(pause_all, "pause");
		pause_all.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event e) {
				ManagerUtils.asyncPause();
			}
		});
		pause_all.setEnabled(g_manager.canPauseDownloads());
		
		// Resume All
		MenuItem resume_all = new MenuItem(menu, SWT.PUSH);
		Messages.setLanguageText(resume_all, "MainWindow.menu.transfers.resumetransfers");
		Utils.setMenuItemImage(resume_all, "resume");
		resume_all.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event e) {
				ManagerUtils.asyncResume();
			}
		});
		resume_all.setEnabled(g_manager.canResumeDownloads());
		
		new MenuItem(menu, SWT.SEPARATOR);
		super.buildMenu(menu);
	
public static voidclose(org.gudy.azureus2.core3.global.GlobalManager g_manager)

		AllTransfersBar result = getBarIfOpen(g_manager);
		if (result != null) {result.close();}
	
public static org.gudy.azureus2.ui.swt.minibar.AllTransfersBargetBarIfOpen(org.gudy.azureus2.core3.global.GlobalManager g_manager)

		return (AllTransfersBar)manager.getMiniBarForObject(g_manager);
	
public java.lang.ObjectgetContextObject()

return this.g_manager;
protected org.eclipse.swt.graphics.PointgetInitialLocation()

		if (!COConfigurationManager.getBooleanParameter("Remember transfer bar location")) {
			return null;
		}
		if (!COConfigurationManager.hasParameter("transferbar.x", false)) {
			return null;
		}
		int x = COConfigurationManager.getIntParameter("transferbar.x");
		int y = COConfigurationManager.getIntParameter("transferbar.y");
		return new Point(x, y);
	
public static MiniBarManagergetManager()

		manager = new MiniBarManager("AllTransfersBar");
	
		return manager;
	
public java.lang.StringgetPluginMenuIdentifier(java.lang.Object context)

		return "transfersbar";
	
public static org.gudy.azureus2.ui.swt.minibar.AllTransfersBaropen(org.gudy.azureus2.core3.global.GlobalManager g_manager, org.eclipse.swt.widgets.Shell main)

		AllTransfersBar result = getBarIfOpen(g_manager);
		if (result == null) {
			result = new AllTransfersBar(g_manager, main);
		}
		return result;
	
protected voidrefresh0()

		GlobalManagerStats stats = g_manager.getStats();
		this.updateSpeedLabel(down_speed, stats.getDataReceiveRate(),stats.getProtocolReceiveRate());
		this.updateSpeedLabel(up_speed, stats.getDataSendRate(),stats.getProtocolSendRate());
	
protected voidstoreLastLocation(org.eclipse.swt.graphics.Point location)

		COConfigurationManager.setParameter("transferbar.x", location.x);
		COConfigurationManager.setParameter("transferbar.y", location.y);