⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 downloadbar.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   DownloadBar.java

package org.gudy.azureus2.ui.swt.minibar;

import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.download.DownloadManagerStats;
import org.gudy.azureus2.core3.util.DisplayFormatters;
import org.gudy.azureus2.plugins.download.DownloadException;
import org.gudy.azureus2.pluginsimpl.local.download.DownloadManagerImpl;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.views.utils.ManagerUtils;

// Referenced classes of package org.gudy.azureus2.ui.swt.minibar:
//			MiniBar, MiniBarManager

public class DownloadBar extends MiniBar
{

	private static MiniBarManager manager = new MiniBarManager("AllTransfersBar");
	private DownloadManager download;
	private Label download_name;
	private ProgressBar progress_bar;
	private Label down_speed;
	private Label up_speed;
	private Label eta;

	public static MiniBarManager getManager()
	{
		return manager;
	}

	public static DownloadBar open(DownloadManager download, Shell main)
	{
		DownloadBar result = (DownloadBar)manager.getMiniBarForObject(download);
		if (result == null)
			result = new DownloadBar(download, main);
		return result;
	}

	public static void close(DownloadManager download)
	{
		DownloadBar result = (DownloadBar)manager.getMiniBarForObject(download);
		if (result != null)
			result.close();
	}

	private DownloadBar(DownloadManager download, Shell main)
	{
		super(manager);
		this.download = download;
		construct(main);
	}

	public Object getContextObject()
	{
		return download;
	}

	public void beginConstruction()
	{
		createFixedTextLabel("MinimizedWindow.name", false, false);
		download_name = createDataLabel(200);
		progress_bar = createPercentProgressBar(100);
		createFixedTextLabel("ConfigView.download.abbreviated", false, false);
		down_speed = createSpeedLabel();
		createFixedTextLabel("ConfigView.upload.abbreviated", false, false);
		up_speed = createSpeedLabel();
		createFixedTextLabel("TableColumn.header.eta", true, false);
		eta = createDataLabel(65);
	}

	public void buildMenu(Menu menu)
	{
		MenuItem itemQueue = new MenuItem(menu, 8);
		Messages.setLanguageText(itemQueue, "MyTorrentsView.menu.queue");
		Utils.setMenuItemImage(itemQueue, "start");
		itemQueue.addListener(13, new Listener() {

			final DownloadBar this$0;

			public void handleEvent(Event e)
			{
				ManagerUtils.queue(download, splash);
			}

			
			{
				this$0 = DownloadBar.this;
				super();
			}
		});
		itemQueue.setEnabled(ManagerUtils.isStartable(download));
		MenuItem itemStop = new MenuItem(menu, 8);
		Messages.setLanguageText(itemStop, "MyTorrentsView.menu.stop");
		Utils.setMenuItemImage(itemStop, "stop");
		itemStop.addListener(13, new Listener() {

			final DownloadBar this$0;

			public void handleEvent(Event e)
			{
				ManagerUtils.stop(download, splash);
			}

			
			{
				this$0 = DownloadBar.this;
				super();
			}
		});
		itemStop.setEnabled(ManagerUtils.isStopable(download));
		new MenuItem(menu, 2);
		super.buildMenu(menu);
	}

	protected void refresh0()
	{
		DownloadManagerStats stats = download.getStats();
		download_name.setText(download.getDisplayName());
		int percent = stats.getCompleted();
		updateSpeedLabel(down_speed, stats.getDataReceiveRate(), stats.getProtocolReceiveRate());
		updateSpeedLabel(up_speed, stats.getDataSendRate(), stats.getProtocolSendRate());
		eta.setText(DisplayFormatters.formatETA(stats.getETA()));
		if (progress_bar.getSelection() != percent)
		{
			progress_bar.setSelection(percent);
			progress_bar.redraw();
		}
	}

	public String[] getPluginMenuIdentifiers(Object context)
	{
		if (context == null)
			return null;
		else
			return (new String[] {
				"downloadbar", "download_context"
			});
	}

	public Object getPluginMenuContextObject()
	{
		return DownloadManagerImpl.getDownloadStatic(download);
		DownloadException de;
		de;
		return null;
	}


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -