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

📄 messageslideshell.java

📁 java 文件下载器。可自定义
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
// 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:   MessageSlideShell.java

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

import com.aelitis.azureus.ui.swt.*;
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
import com.aelitis.azureus.ui.swt.utils.ColorCache;
import java.io.PrintStream;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.logging.*;
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.ClipboardCopy;

// Referenced classes of package org.gudy.azureus2.ui.swt.shells:
//			GCStringPrinter, ShellSlider

public class MessageSlideShell
{
	private static class PopupParams
	{

		int iconID;
		String title;
		String text;
		String details;
		long addedOn;
		Object relatedTo[];
		int timeoutSecs;

		public PopupParams(int iconID, String title, String text, String details, int timeoutSecs)
		{
			this.iconID = iconID;
			this.title = title;
			this.text = text;
			this.details = details;
			this.timeoutSecs = timeoutSecs;
			addedOn = System.currentTimeMillis();
		}

		public PopupParams(int iconID, String title, String text, String details, Object relatedTo[], int timeoutSecs)
		{
			this(iconID, title, text, details, timeoutSecs);
			this.relatedTo = relatedTo;
		}
	}


	private static boolean USE_SWT32_BG_SET = true;
	private static final boolean DEBUG = false;
	private static final int EDGE_GAP = 0;
	private static final int SHELL_DEF_WIDTH = 280;
	private static final int SHELL_MIN_HEIGHT = 150;
	private static final int SHELL_MAX_HEIGHT = 330;
	private static final int DETAILS_WIDTH = 550;
	private static final int DETAILS_HEIGHT = 180;
	private static final AEMonitor monitor = new AEMonitor("slidey_mon");
	private static ArrayList historyList = new ArrayList();
	private static int currentPopupIndex = -1;
	private static int firstUnreadMessage = -1;
	private Shell shell;
	private Composite cShell;
	private Label lblCloseIn;
	private Button btnHideAll;
	private Button btnNext;
	private boolean bDelayPaused;
	private ArrayList disposeList;
	private String sDetails;
	private int idxHistory;
	private Image imgPopup;
	protected Color colorURL;
	private Color colorFG;
	private int shellWidth;

	public MessageSlideShell(Display display, int iconID, String keyPrefix, String details, String textParams[], int timeoutSecs)
	{
		this(display, iconID, MessageText.getString((new StringBuilder()).append(keyPrefix).append(".title").toString()), MessageText.getString((new StringBuilder()).append(keyPrefix).append(".text").toString(), textParams), details, timeoutSecs);
	}

	public MessageSlideShell(Display display, int iconID, String keyPrefix, String details, String textParams[], Object relatedObjects[], int timeoutSecs)
	{
		this(display, iconID, MessageText.getString((new StringBuilder()).append(keyPrefix).append(".title").toString()), MessageText.getString((new StringBuilder()).append(keyPrefix).append(".text").toString(), textParams), details, relatedObjects, timeoutSecs);
	}

	public MessageSlideShell(Display display, int iconID, String title, String text, String details, int timeoutSecs)
	{
		this(display, iconID, title, text, details, null, timeoutSecs);
	}

	public MessageSlideShell(Display display, int iconID, String title, String text, String details, Object relatedObjects[], int timeoutSecs)
	{
		bDelayPaused = false;
		disposeList = new ArrayList();
		monitor.enter();
		PopupParams popupParams = new PopupParams(iconID, title, text, details, relatedObjects, timeoutSecs);
		historyList.add(popupParams);
		if (currentPopupIndex < 0)
			create(display, popupParams, true);
		monitor.exit();
		break MISSING_BLOCK_LABEL_131;
		Exception e;
		e;
		Logger.log(new LogEvent(LogIDs.GUI, "Mr. Slidey Init", e));
		disposeShell(shell);
		Utils.disposeSWTObjects(disposeList);
		monitor.exit();
		break MISSING_BLOCK_LABEL_131;
		Exception exception;
		exception;
		monitor.exit();
		throw exception;
	}

	private MessageSlideShell(Display display, PopupParams popupParams, boolean bSlide)
	{
		bDelayPaused = false;
		disposeList = new ArrayList();
		create(display, popupParams, bSlide);
	}

	public static void displayLastMessage(Display display, boolean last_unread)
	{
		display.asyncExec(new AERunnable(last_unread, display) {

			final boolean val$last_unread;
			final Display val$display;

			public void runSupport()
			{
				if (MessageSlideShell.historyList.isEmpty())
					return;
				if (MessageSlideShell.currentPopupIndex >= 0)
					return;
				int msg_index = MessageSlideShell.firstUnreadMessage;
				if (!last_unread || msg_index == -1)
					msg_index = MessageSlideShell.historyList.size() - 1;
				new MessageSlideShell(display, (PopupParams)MessageSlideShell.historyList.get(msg_index), true);
			}

			
			{
				last_unread = flag;
				display = display1;
				super();
			}
		});
	}

	public static void recordMessage(int iconID, String title, String text, String details, Object relatedTo[], int timeoutSecs)
	{
		monitor.enter();
		historyList.add(new PopupParams(iconID, title, text, details, relatedTo, timeoutSecs));
		if (firstUnreadMessage == -1)
			firstUnreadMessage = historyList.size() - 1;
		monitor.exit();
		break MISSING_BLOCK_LABEL_66;
		Exception exception;
		exception;
		monitor.exit();
		throw exception;
	}

	private void create(final Display display, final PopupParams popupParams, boolean bSlide)
	{
		int style;
		boolean bDisableSliding;
		firstUnreadMessage = -1;
		style = 16384;
		bDisableSliding = COConfigurationManager.getBooleanParameter("GUI_SWT_DisableAlertSliding");
		if (bDisableSliding)
		{
			bSlide = false;
			style = 0;
		}
		idxHistory = historyList.indexOf(popupParams);
		if (idxHistory < 0)
		{
			System.err.println("Not in popup history list");
			return;
		}
		if (currentPopupIndex == idxHistory)
		{
			System.err.println((new StringBuilder()).append("Trying to open already opened!! ").append(idxHistory).toString());
			return;
		}
		monitor.enter();
		currentPopupIndex = idxHistory;
		monitor.exit();
		break MISSING_BLOCK_LABEL_125;
		Exception exception;
		exception;
		monitor.exit();
		throw exception;
		sDetails = popupParams.details;
		Image imgIcon = popupParams.iconID > 0 ? display.getSystemImage(popupParams.iconID) : null;
		bDelayPaused = popupParams.iconID != 2 || !bSlide;
		final MouseTrackAdapter mouseAdapter = bDelayPaused ? null : ((MouseTrackAdapter) (new MouseTrackAdapter() {

			final MessageSlideShell this$0;

			public void mouseEnter(MouseEvent e)
			{
				bDelayPaused = true;
			}

			public void mouseExit(MouseEvent e)
			{
				bDelayPaused = false;
			}

			
			{
				this$0 = MessageSlideShell.this;
				super();
			}
		}));
		if (bDisableSliding)
		{
			UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
			if (uiFunctions != null)
			{
				Shell mainShell = uiFunctions.getMainShell();
				if (mainShell != null)
					this.shell = new Shell(mainShell, style);
			}
		}
		if (this.shell == null)
			this.shell = new Shell(display, style);
		if (USE_SWT32_BG_SET)
			try
			{
				this.shell.setBackgroundMode(1);
			}
			catch (NoSuchMethodError e) { }
			catch (NoSuchFieldError e2) { }
		Utils.setShellIcon(this.shell);
		this.shell.setText(popupParams.title);
		if (imgPopup == null)
			if (Constants.isOSX && (SWT.getVersion() < 3221 || !USE_SWT32_BG_SET))
			{
				USE_SWT32_BG_SET = false;
				imgPopup = null;
			} else
			{
				imgPopup = ImageLoader.getInstance().getImage("popup");
				this.shell.addDisposeListener(new DisposeListener() {

					final MessageSlideShell this$0;

					public void widgetDisposed(DisposeEvent e)
					{
						ImageLoader.getInstance().releaseImage("popup");
					}

			
			{
				this$0 = MessageSlideShell.this;
				super();
			}
				});
			}
		Rectangle imgPopupBounds;
		if (imgPopup != null)
		{
			shellWidth = imgPopup.getBounds().width;
			if (Constants.isOSX)
				shellWidth += 30;
			imgPopupBounds = imgPopup.getBounds();
		} else
		{
			shellWidth = 280;
			imgPopupBounds = null;
		}
		UISkinnableSWTListener listeners[] = UISkinnableManagerSWT.getInstance().getSkinnableListeners(org/gudy/azureus2/ui/swt/shells/MessageSlideShell.toString());
		for (int i = 0; i < listeners.length; i++)
			try
			{
				listeners[i].skinBeforeComponents(this.shell, this, popupParams.relatedTo);
			}
			catch (Exception e)
			{
				Debug.out(e);
			}

		if (colorFG == null)
			colorFG = display.getSystemColor(2);
		FormLayout shellLayout = new FormLayout();
		this.shell.setLayout(shellLayout);
		cShell = new Composite(this.shell, 0);
		GridLayout layout = new GridLayout(3, false);
		cShell.setLayout(layout);
		FormData formData = new FormData();
		formData.left = new FormAttachment(0, 0);
		formData.right = new FormAttachment(100, 0);
		cShell.setLayoutData(formData);
		Label lblIcon = new Label(cShell, 0);
		lblIcon.setImage(imgIcon);
		lblIcon.setLayoutData(new GridData());
		Label lblTitle = new Label(cShell, SWT.getVersion() >= 3100 ? 64 : 0);
		GridData gridData = new GridData(768);
		if (SWT.getVersion() < 3100)
			gridData.widthHint = 140;
		lblTitle.setLayoutData(gridData);
		lblTitle.setForeground(colorFG);
		lblTitle.setText(popupParams.title);
		FontData fontData[] = lblTitle.getFont().getFontData();
		fontData[0].setStyle(1);
		fontData[0].setHeight((int)((double)fontData[0].getHeight() * 1.5D));
		Font boldFont = new Font(display, fontData);
		disposeList.add(boldFont);
		lblTitle.setFont(boldFont);
		final Button btnDetails = new Button(cShell, 2);
		btnDetails.setForeground(colorFG);
		Messages.setLanguageText(btnDetails, "popup.error.details");
		gridData = new GridData();
		btnDetails.setLayoutData(gridData);
		btnDetails.addListener(4, new Listener() {

			final Button val$btnDetails;
			final Display val$display;
			final MouseTrackAdapter val$mouseAdapter;
			final MessageSlideShell this$0;

			public void handleEvent(Event arg0)
			{
				try
				{
					boolean bShow = btnDetails.getSelection();
					if (bShow)
					{
						Shell detailsShell = new Shell(display, 18432);
						Utils.setShellIcon(detailsShell);
						detailsShell.setLayout(new FillLayout());
						StyledText textDetails = new StyledText(detailsShell, 2824);
						textDetails.setBackground(display.getSystemColor(25));
						textDetails.setForeground(display.getSystemColor(24));
						textDetails.setWordWrap(true);
						textDetails.setText(sDetails);
						detailsShell.layout();
						Rectangle shellBounds = shell.getBounds();
						detailsShell.setBounds((shellBounds.x + shellBounds.width) - 550, shellBounds.y - 180, 550, 180);
						detailsShell.open();
						shell.setData("detailsShell", detailsShell);
						shell.addDisposeListener(new DisposeListener() {

							final 4 this$1;

							public void widgetDisposed(DisposeEvent e)
							{
								Shell detailsShell = (Shell)shell.getData("detailsShell");
								if (detailsShell != null && !detailsShell.isDisposed())
									detailsShell.dispose();
							}

					
					{
						this$1 = 4.this;
						super();
					}
						});
						bDelayPaused = true;
						removeMouseTrackListener(shell, mouseAdapter);
					} else
					{
						Shell detailsShell = (Shell)shell.getData("detailsShell");
						if (detailsShell != null && !detailsShell.isDisposed())
							detailsShell.dispose();
					}
				}
				catch (Exception e)
				{
					Logger.log(new LogEvent(LogIDs.GUI, "Mr. Slidey DetailsButton", e));
				}
			}

			
			{
				this$0 = MessageSlideShell.this;
				btnDetails = button;
				display = display1;
				mouseAdapter = mousetrackadapter;
				super();
			}
		});
		createLinkLabel(cShell, popupParams);
		lblCloseIn = new Label(cShell, 0x20000);

⌨️ 快捷键说明

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