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

📄 swtnetworkselection.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:   SWTNetworkSelection.java

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.mainwindow.SWTThread;

public class SWTNetworkSelection
	implements AENetworkClassifierListener
{
	protected class classifierDialog
	{

		protected Shell shell;
		protected AESemaphore sem;
		protected String selection[];
		private Button checkboxes[];
		final SWTNetworkSelection this$0;

		protected void close(boolean ok)
		{
			if (!ok)
			{
				selection = null;
			} else
			{
				List l = new ArrayList();
				for (int i = 0; i < AENetworkClassifier.AT_NETWORKS.length; i++)
					if (checkboxes[i].getSelection())
						l.add(AENetworkClassifier.AT_NETWORKS[i]);

				selection = new String[l.size()];
				l.toArray(selection);
			}
			shell.dispose();
			sem.release();
		}

		protected String[] getSelection()
		{
			return selection;
		}

		protected classifierDialog(AESemaphore _sem, Display display, String description, String tracker_networks[])
		{
			this$0 = SWTNetworkSelection.this;
			super();
			sem = _sem;
			if (display.isDisposed())
			{
				sem.release();
				return;
			}
			shell = new Shell(display, 0x10860);
			Utils.setShellIcon(shell);
			shell.setText(MessageText.getString("window.networkselection.title"));
			GridLayout layout = new GridLayout();
			layout.numColumns = 3;
			shell.setLayout(layout);
			Label info_label = new Label(shell, 0);
			info_label.setText(MessageText.getString("window.networkselection.info"));
			GridData gridData = new GridData(1808);
			gridData.horizontalSpan = 3;
			info_label.setLayoutData(gridData);
			Label labelSeparator = new Label(shell, 258);
			gridData = new GridData(768);
			gridData.horizontalSpan = 3;
			labelSeparator.setLayoutData(gridData);
			Label desc_label = new Label(shell, 0);
			desc_label.setText(MessageText.getString("window.networkselection.description"));
			gridData = new GridData(1808);
			gridData.horizontalSpan = 1;
			desc_label.setLayoutData(gridData);
			Label desc_value = new Label(shell, 0);
			desc_value.setText(description);
			gridData = new GridData(1808);
			gridData.horizontalSpan = 2;
			desc_value.setLayoutData(gridData);
			checkboxes = new Button[AENetworkClassifier.AT_NETWORKS.length];
			for (int i = 0; i < AENetworkClassifier.AT_NETWORKS.length; i++)
			{
				String network = AENetworkClassifier.AT_NETWORKS[i];
				String msg_text = (new StringBuilder()).append("ConfigView.section.connection.networks.").append(network).toString();
				Label label = new Label(shell, 0);
				gridData = new GridData(1808);
				gridData.horizontalSpan = 1;
				label.setLayoutData(gridData);
				Messages.setLanguageText(label, msg_text);
				Button checkBox = new Button(shell, 32);
				checkBox.setSelection(false);
				gridData = new GridData(1808);
				gridData.horizontalSpan = 2;
				checkBox.setLayoutData(gridData);
				checkboxes[i] = checkBox;
				for (int j = 0; j < tracker_networks.length; j++)
					if (tracker_networks[j] == network)
						checkBox.setSelection(true);

			}

			labelSeparator = new Label(shell, 258);
			gridData = new GridData(768);
			gridData.horizontalSpan = 3;
			labelSeparator.setLayoutData(gridData);
			new Label(shell, 0);
			Button bOk = new Button(shell, 8);
			bOk.setText(MessageText.getString("Button.ok"));
			gridData = new GridData(896);
			gridData.grabExcessHorizontalSpace = true;
			gridData.widthHint = 70;
			bOk.setLayoutData(gridData);
			bOk.addListener(13, new Listener() {

				final SWTNetworkSelection val$this$0;
				final classifierDialog this$1;

				public void handleEvent(Event e)
				{
					close(true);
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			Button bCancel = new Button(shell, 8);
			bCancel.setText(MessageText.getString("Button.cancel"));
			gridData = new GridData(128);
			gridData.grabExcessHorizontalSpace = false;
			gridData.widthHint = 70;
			bCancel.setLayoutData(gridData);
			bCancel.addListener(13, new Listener() {

				final SWTNetworkSelection val$this$0;
				final classifierDialog this$1;

				public void handleEvent(Event e)
				{
					close(false);
				}


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

				final SWTNetworkSelection val$this$0;
				final classifierDialog this$1;

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


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			shell.pack();
			Utils.centreWindow(shell);
			shell.open();
		}
	}


	public SWTNetworkSelection()
	{
		AENetworkClassifier.addListener(this);
	}

	public String[] selectNetworks(final String description, final String tracker_networks[])
	{
		final Display display = SWTThread.getInstance().getDisplay();
		if (display.isDisposed())
			return null;
		final AESemaphore sem = new AESemaphore("NetworkClassifier");
		final classifierDialog dialog[] = new classifierDialog[1];
		try
		{
			display.asyncExec(new AERunnable() {

				final classifierDialog val$dialog[];
				final AESemaphore val$sem;
				final Display val$display;
				final String val$description;
				final String val$tracker_networks[];
				final SWTNetworkSelection this$0;

				public void runSupport()
				{
					dialog[0] = new classifierDialog(sem, display, description, tracker_networks);
				}

			
			{
				this$0 = SWTNetworkSelection.this;
				dialog = aclassifierdialog;
				sem = aesemaphore;
				display = display1;
				description = s;
				tracker_networks = as;
				super();
			}
			});
		}
		catch (Throwable e)
		{
			Debug.printStackTrace(e);
			return null;
		}
		sem.reserve();
		return dialog[0].getSelection();
	}
}

⌨️ 快捷键说明

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