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

📄 uiswtviewimpl.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:   UISWTViewImpl.java

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

import com.aelitis.azureus.ui.swt.UIFunctionsManagerSWT;
import com.aelitis.azureus.ui.swt.UIFunctionsSWT;
import java.awt.Frame;
import java.awt.Panel;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.logging.*;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.plugins.ui.UIRuntimeException;
import org.gudy.azureus2.pluginsimpl.local.PluginCoreUtils;
import org.gudy.azureus2.ui.swt.plugins.UISWTView;
import org.gudy.azureus2.ui.swt.plugins.UISWTViewEventListener;
import org.gudy.azureus2.ui.swt.views.AbstractIView;

// Referenced classes of package org.gudy.azureus2.ui.swt.pluginsimpl:
//			UISWTViewCoreEventListener, UISWTViewEventCancelledException, UISWTViewEventImpl

public class UISWTViewImpl extends AbstractIView
	implements UISWTView
{

	public static final String CFG_PREFIX = "Views.plugins.";
	private Object dataSource;
	private boolean useCoreDataSource;
	private final UISWTViewEventListener eventListener;
	private Composite composite;
	private final String sViewID;
	private int iControlType;
	private boolean bFirstGetCompositeCall;
	private final String sParentID;
	private String sTitle;

	public UISWTViewEventListener getEventListener()
	{
		return eventListener;
	}

	public UISWTViewImpl(String sParentID, String sViewID, UISWTViewEventListener eventListener)
		throws Exception
	{
		this(sParentID, sViewID, eventListener, null);
	}

	public UISWTViewImpl(String sParentID, String sViewID, UISWTViewEventListener eventListener, Object datasource)
		throws Exception
	{
		dataSource = null;
		useCoreDataSource = false;
		iControlType = 0;
		bFirstGetCompositeCall = true;
		sTitle = null;
		this.sParentID = sParentID;
		this.sViewID = sViewID;
		this.eventListener = eventListener;
		dataSource = datasource;
		if (eventListener instanceof UISWTViewCoreEventListener)
			useCoreDataSource = true;
		if (!eventListener.eventOccurred(new UISWTViewEventImpl(this, 0, this)))
			throw new UISWTViewEventCancelledException();
		else
			return;
	}

	public Object getDataSource()
	{
		return dataSource;
	}

	public String getViewID()
	{
		return sViewID;
	}

	public void closeView()
	{
		try
		{
			UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
			if (uiFunctions != null)
				uiFunctions.closePluginView(this);
		}
		catch (Exception e)
		{
			Debug.out(e);
		}
	}

	public void setControlType(int iControlType)
	{
		if (iControlType == 1 || iControlType == 0)
			this.iControlType = iControlType;
	}

	public void triggerEvent(int eventType, Object data)
	{
		try
		{
			eventListener.eventOccurred(new UISWTViewEventImpl(this, eventType, data));
		}
		catch (Throwable t)
		{
			throw new UIRuntimeException((new StringBuilder()).append("UISWTView.triggerEvent:: ViewID=").append(sViewID).append("; EventID=").append(eventType).append("; data=").append(data).toString(), t);
		}
	}

	private boolean triggerEvent2(int eventType, Object data)
	{
		return eventListener.eventOccurred(new UISWTViewEventImpl(this, eventType, data));
		Throwable t;
		t;
		throw new UIRuntimeException((new StringBuilder()).append("UISWTView.triggerEvent:: ViewID=").append(sViewID).append("; EventID=").append(eventType).append("; data=").append(data).toString(), t);
	}

	public void setTitle(String title)
	{
		sTitle = title;
	}

	public void dataSourceChanged(Object newDataSource)
	{
		dataSource = PluginCoreUtils.convert(newDataSource, useCoreDataSource);
		triggerEvent(1, dataSource);
	}

	public void delete()
	{
		triggerEvent(7, null);
		super.delete();
	}

	public Composite getComposite()
	{
		if (bFirstGetCompositeCall)
			bFirstGetCompositeCall = false;
		return composite;
	}

	public String getData()
	{
		String key = (new StringBuilder()).append("Views.plugins.").append(sViewID).append(".title").toString();
		if (MessageText.keyExists(key))
			return key;
		else
			return sViewID;
	}

	public String getFullTitle()
	{
		if (sTitle != null)
			return sTitle;
		else
			return super.getFullTitle();
	}

	public void initialize(Composite parent)
	{
		if (iControlType == 0)
		{
			org.eclipse.swt.widgets.Layout parentLayout = parent.getLayout();
			if (parentLayout instanceof FormLayout)
			{
				composite = parent;
			} else
			{
				composite = new Composite(parent, 0);
				GridLayout layout = new GridLayout(1, false);
				layout.marginHeight = 0;
				layout.marginWidth = 0;
				composite.setLayout(layout);
				GridData gridData = new GridData(1808);
				composite.setLayoutData(gridData);
			}
			triggerEvent(2, composite);
			if (composite.getLayout() instanceof GridLayout)
			{
				Control children[] = composite.getChildren();
				for (int i = 0; i < children.length; i++)
				{
					Control control = children[i];
					Object layoutData = control.getLayoutData();
					if (layoutData == null || !(layoutData instanceof GridData))
					{
						if (layoutData != null)
							Logger.log(new LogEvent(LogIDs.PLUGIN, 1, (new StringBuilder()).append("Plugin View '").append(sViewID).append("' tried to setLayoutData of ").append(control).append(" to a ").append(layoutData.getClass().getName()).toString()));
						GridData gridData;
						if (children.length == 1)
							gridData = new GridData(4, 4, true, true);
						else
							gridData = new GridData();
						control.setLayoutData(gridData);
					}
				}

			}
		} else
		{
			composite = new Composite(parent, 0x1000000);
			FillLayout layout = new FillLayout();
			layout.marginHeight = 0;
			layout.marginWidth = 0;
			composite.setLayout(layout);
			GridData gridData = new GridData(1808);
			composite.setLayoutData(gridData);
			Frame f = SWT_AWT.new_Frame(composite);
			Panel pan = new Panel();
			f.add(pan);
			triggerEvent(2, pan);
		}
		if (composite != null)
		{
			composite.addListener(26, new Listener() {

				final UISWTViewImpl this$0;

				public void handleEvent(Event event)
				{
					triggerEvent(3, null);
				}

			
			{
				this$0 = UISWTViewImpl.this;
				super();
			}
			});
			composite.addListener(27, new Listener() {

				final UISWTViewImpl this$0;

				public void handleEvent(Event event)
				{
					triggerEvent(4, null);
				}

			
			{
				this$0 = UISWTViewImpl.this;
				super();
			}
			});
		}
	}

	public void refresh()
	{
		triggerEvent(5, null);
	}

	public void updateLanguage()
	{
		super.updateLanguage();
		triggerEvent(6, null);
	}

	public String getParentID()
	{
		return sParentID;
	}

	public boolean requestClose()
	{
		return triggerEvent2(8, null);
	}

	public boolean useCoreDataSource()
	{
		return useCoreDataSource;
	}

	public void setUseCoreDataSource(boolean useCoreDataSource)
	{
		if (this.useCoreDataSource == useCoreDataSource)
		{
			return;
		} else
		{
			this.useCoreDataSource = useCoreDataSource;
			dataSourceChanged(dataSource);
			return;
		}
	}
}

⌨️ 快捷键说明

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