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

📄 simpletextentrywindow.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:   SimpleTextEntryWindow.java

package org.gudy.azureus2.ui.swt;

import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.Constants;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.plugins.ui.UIInputValidator;
import org.gudy.azureus2.ui.swt.components.ControlUtils;
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;
import org.gudy.azureus2.ui.swt.pluginsimpl.AbstractUISWTInputReceiver;

// Referenced classes of package org.gudy.azureus2.ui.swt:
//			Utils

public class SimpleTextEntryWindow extends AbstractUISWTInputReceiver
{

	private Display display;

	public SimpleTextEntryWindow(Display display)
	{
		this.display = display;
	}

	protected void promptForInput()
	{
		Utils.execSWTThread(new Runnable() {

			final SimpleTextEntryWindow this$0;

			public void run()
			{
				promptForInput0();
			}

			
			{
				this$0 = SimpleTextEntryWindow.this;
				super();
			}
		}, false);
	}

	private void promptForInput0()
	{
		final Shell shell = ShellFactory.createShell(Utils.findAnyShell(), 0x10860);
		if (title != null)
			shell.setText(title);
		Utils.setShellIcon(shell);
		GridLayout layout = new GridLayout();
		shell.setLayout(layout);
		int width_hint = this.width_hint != -1 ? this.width_hint : 330;
		Label label = null;
		GridData gridData = null;
		for (int i = 0; i < messages.length; i++)
		{
			label = new Label(shell, 0);
			label.setText(messages[i]);
			gridData = new GridData();
			gridData.widthHint = width_hint;
			label.setLayoutData(gridData);
		}

		Scrollable text_entry;
		final Combo text_entry_combo;
		final Text text_entry_text;
		if (choices != null)
		{
			int text_entry_flags = 4;
			if (!choices_allow_edit)
				text_entry_flags |= 8;
			text_entry_combo = new Combo(shell, text_entry_flags);
			text_entry_combo.setItems(choices);
			text_entry_text = null;
			text_entry = text_entry_combo;
		} else
		{
			int text_entry_flags = 2048;
			if (multiline_mode)
				text_entry_flags |= 0x242;
			else
				text_entry_flags |= 4;
			text_entry_text = new Text(shell, text_entry_flags);
			text_entry_combo = null;
			text_entry = text_entry_text;
		}
		if (preentered_text != null)
			if (text_entry_text != null)
			{
				text_entry_text.setText(preentered_text);
				if (select_preentered_text)
					text_entry_text.selectAll();
			} else
			if (text_entry_combo != null)
				text_entry_combo.setText(preentered_text);
		text_entry.addTraverseListener(new TraverseListener() {

			final SimpleTextEntryWindow this$0;

			public void keyTraversed(TraverseEvent e)
			{
				if (e.detail == 16 || e.detail == 8)
					e.doit = true;
			}

			
			{
				this$0 = SimpleTextEntryWindow.this;
				super();
			}
		});
		int line_height = this.line_height;
		if (line_height == -1)
			line_height = multiline_mode ? 3 : 1;
		gridData = new GridData();
		gridData.widthHint = width_hint;
		if (text_entry_text != null)
			gridData.minimumHeight = text_entry_text.getLineHeight() * line_height;
		gridData.heightHint = gridData.minimumHeight;
		text_entry.setLayoutData(gridData);
		Composite panel = new Composite(shell, 0);
		RowLayout rLayout = new RowLayout();
		rLayout.marginTop = 0;
		rLayout.marginLeft = 0;
		rLayout.marginBottom = 0;
		rLayout.marginRight = 0;
		try
		{
			rLayout.fill = true;
		}
		catch (NoSuchFieldError e) { }
		rLayout.spacing = ControlUtils.getButtonMargin();
		panel.setLayout(rLayout);
		gridData = new GridData();
		gridData.horizontalAlignment = Constants.isOSX ? 0x1000008 : 0x1000000;
		panel.setLayoutData(gridData);
		Button ok = createAlertButton(panel, "Button.ok");
		Button cancel = createAlertButton(panel, "Button.cancel");
		ok.addListener(13, new Listener() );
		cancel.addListener(13, new Listener() {

			final Shell val$shell;
			final SimpleTextEntryWindow this$0;

			public void handleEvent(Event event)
			{
				recordUserAbort();
				shell.dispose();
			}

			
			{
				this$0 = SimpleTextEntryWindow.this;
				shell = shell1;
				super();
			}
		});
		shell.setDefaultButton(ok);
		shell.addListener(31, new Listener() {

			final Shell val$shell;
			final SimpleTextEntryWindow this$0;

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

			
			{
				this$0 = SimpleTextEntryWindow.this;
				shell = shell1;
				super();
			}
		});
		shell.pack();
		if (text_entry_text != null)
			Utils.createURLDropTarget(shell, text_entry_text);
		Utils.centreWindow(shell);
		shell.open();
		do
		{
			if (shell.isDisposed())
				break;
			if (!display.readAndDispatch())
				display.sleep();
		} while (true);
	}

	private static Button createAlertButton(Composite panel, String localizationKey)
	{
		Button button = new Button(panel, 8);
		button.setText(MessageText.getString(localizationKey));
		RowData rData = new RowData();
		rData.width = Math.max(ControlUtils.getDialogButtonMinWidth(), button.computeSize(-1, -1).x);
		button.setLayoutData(rData);
		return button;
	}









}

⌨️ 快捷键说明

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