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

📄 progresswindow.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:   ProgressWindow.java

package org.gudy.azureus2.ui.swt.sharing.progress;

import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.AERunnable;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.plugins.PluginInterface;
import org.gudy.azureus2.plugins.sharing.*;
import org.gudy.azureus2.pluginsimpl.local.PluginInitializer;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.animations.Animator;
import org.gudy.azureus2.ui.swt.animations.shell.AnimableShell;
import org.gudy.azureus2.ui.swt.animations.shell.LinearAnimator;
import org.gudy.azureus2.ui.swt.mainwindow.SWTThread;
import org.gudy.azureus2.ui.swt.shells.PopupShell;

public class ProgressWindow
	implements ShareManagerListener
{
	private class progressDialog extends PopupShell
		implements AnimableShell
	{

		Animator currentAnimator;
		int x0;
		int y0;
		int x1;
		int y1;
		boolean isAnimated;
		boolean hideAfter;
		final ProgressWindow this$0;

		protected void hidePanel()
		{
			manually_hidden = true;
			currentAnimator = new LinearAnimator(this, new Point(x0, y1), new Point(x1, y1), 15, 30);
			currentAnimator.start();
			hideAfter = true;
		}

		protected void showPanel()
		{
			manually_hidden = false;
			boolean animate = false;
			if (!shell_opened)
			{
				shell_opened = true;
				shell.open();
				animate = true;
			}
			Shell otherShell = Utils.findAnyShell();
			if (otherShell != null)
				shell.moveAbove(otherShell);
			if (!shell.isVisible())
			{
				shell.setVisible(true);
				animate = true;
			}
			if (animate && currentAnimator == null)
			{
				currentAnimator = new LinearAnimator(this, new Point(x0, y0), new Point(x0, y1), 15, 30);
				currentAnimator.start();
			}
		}

		protected boolean isShown()
		{
			return shell.isVisible();
		}

		public void animationEnded(Animator source)
		{
			if (source != currentAnimator)
				return;
			isAnimated = false;
			currentAnimator = null;
			if (hideAfter)
			{
				hideAfter = false;
				if (display == null || display.isDisposed())
					return;
				display.asyncExec(new AERunnable() );
			}
		}

		public void animationStarted(Animator animator)
		{
		}

		public Shell getShell()
		{
			return shell;
		}

		public void reportPercent(int i)
		{
		}


		protected progressDialog(Display dialog_display)
		{
			this$0 = ProgressWindow.this;
			super(dialog_display);
			if (dialog_display.isDisposed())
			{
				return;
			} else
			{
				shell.setText(MessageText.getString("sharing.progress.title"));
				tasks = new StyledText(shell, 2824);
				tasks.setBackground(dialog_display.getSystemColor(1));
				progress = new ProgressBar(shell, 0);
				progress.setMinimum(0);
				progress.setMaximum(100);
				Button hide_button = new Button(shell, 8);
				hide_button.setText(MessageText.getString("sharing.progress.hide"));
				cancel_button = new Button(shell, 8);
				cancel_button.setText(MessageText.getString("sharing.progress.cancel"));
				cancel_button.setEnabled(false);
				FormData formData = new FormData();
				formData.right = new FormAttachment(100, -5);
				formData.bottom = new FormAttachment(100, -10);
				hide_button.setLayoutData(formData);
				formData = new FormData();
				formData.right = new FormAttachment(hide_button, -5);
				formData.bottom = new FormAttachment(100, -10);
				cancel_button.setLayoutData(formData);
				formData = new FormData();
				formData.right = new FormAttachment(cancel_button, -5);
				formData.left = new FormAttachment(0, 50);
				formData.bottom = new FormAttachment(100, -10);
				progress.setLayoutData(formData);
				formData = new FormData();
				formData.right = new FormAttachment(100, -5);
				formData.bottom = new FormAttachment(100, -50);
				formData.top = new FormAttachment(0, 5);
				formData.left = new FormAttachment(0, 5);
				tasks.setLayoutData(formData);
				layout();
				cancel_button.addListener(13, new Listener() {

					final ProgressWindow val$this$0;
					final progressDialog this$1;

					public void handleEvent(Event e)
					{
						cancel_button.setEnabled(false);
						share_manager.cancelOperation();
					}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
				});
				hide_button.addListener(13, new Listener() {

					final ProgressWindow val$this$0;
					final progressDialog this$1;

					public void handleEvent(Event e)
					{
						hidePanel();
					}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
				});
				shell.setDefaultButton(hide_button);
				shell.addListener(31, new Listener() {

					final ProgressWindow val$this$0;
					final progressDialog this$1;

					public void handleEvent(Event e)
					{
						if (e.character == '\033')
							hidePanel();
					}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
				});
				Rectangle bounds = dialog_display.getClientArea();
				x0 = (bounds.x + bounds.width) - 255;
				x1 = bounds.x + bounds.width;
				y0 = bounds.y + bounds.height;
				y1 = (bounds.y + bounds.height) - 155;
				shell.setLocation(x0, y0);
				return;
			}
		}
	}


	private ShareManager share_manager;
	private progressDialog dialog;
	private Display display;
	private StyledText tasks;
	private ProgressBar progress;
	private Button cancel_button;
	private boolean shell_opened;
	private boolean manually_hidden;

	public ProgressWindow()
	{
		dialog = null;
		share_manager = PluginInitializer.getDefaultInterface().getShareManager();
		display = SWTThread.getInstance().getDisplay();
		if (display.isDisposed())
			return;
		try
		{
			share_manager.addListener(this);
		}
		catch (ShareException e)
		{
			Debug.printStackTrace(e);
		}
		return;
	}

	public void resourceAdded(ShareResource resource)
	{
		if (!share_manager.isInitialising())
			reportCurrentTask((new StringBuilder()).append("Resource added: ").append(resource.getName()).toString());
	}

	public void resourceModified(ShareResource resource)
	{
		reportCurrentTask((new StringBuilder()).append("Resource modified: ").append(resource.getName()).toString());
	}

	public void resourceDeleted(ShareResource resource)
	{
		reportCurrentTask((new StringBuilder()).append("Resource deleted: ").append(resource.getName()).toString());
	}

	public void reportProgress(final int percent_complete)
	{
		Utils.execSWTThread(new AERunnable() {

			final int val$percent_complete;
			final ProgressWindow this$0;

			public void runSupport()
			{
				if (progress != null && !progress.isDisposed())
				{
					if (dialog == null)
					{
						dialog = new progressDialog(display);
						if (dialog == null)
							return;
					}
					if (!dialog.isShown() && !manually_hidden)
						dialog.showPanel();
					cancel_button.setEnabled(percent_complete < 100);
					progress.setSelection(percent_complete);
				}
			}

			
			{
				this$0 = ProgressWindow.this;
				percent_complete = i;
				super();
			}
		});
	}

	public void reportCurrentTask(final String task_description)
	{
		Utils.execSWTThread(new AERunnable() {

			final String val$task_description;
			final ProgressWindow this$0;

			public void runSupport()
			{
				if (dialog == null)
				{
					dialog = new progressDialog(display);
					if (dialog == null)
						return;
				}
				if (tasks != null && !tasks.isDisposed())
				{
					dialog.showPanel();
					tasks.append((new StringBuilder()).append(task_description).append(Text.DELIMITER).toString());
					int lines = tasks.getLineCount();
					tasks.setTopIndex(lines - 1);
				}
			}

			
			{
				this$0 = ProgressWindow.this;
				task_description = s;
				super();
			}
		});
	}














}

⌨️ 快捷键说明

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