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

📄 intlistparameter.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:   IntListParameter.java

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

import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.util.AERunnable;
import org.gudy.azureus2.ui.swt.Utils;

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

public class IntListParameter extends Parameter
{

	Combo list;
	private final int values[];
	private final String name;

	public IntListParameter(Composite composite, String name, String labels[], int values[])
	{
		this(composite, name, COConfigurationManager.getIntParameter(name), labels, values);
	}

	public IntListParameter(Composite composite, String name, int defaultValue, String labels[], int values[])
	{
		super(name);
		this.name = name;
		this.values = values;
		if (labels.length != values.length)
			return;
		int value = COConfigurationManager.getIntParameter(name, defaultValue);
		int index = findIndex(value, values);
		list = new Combo(composite, 12);
		for (int i = 0; i < labels.length; i++)
			list.add(labels[i]);

		setIndex(index);
		list.addListener(13, new Listener() {

			final IntListParameter this$0;

			public void handleEvent(Event e)
			{
				setIndex(list.getSelectionIndex());
			}

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

	protected void setIndex(final int index)
	{
		int selected_value = values[index];
		Utils.execSWTThread(new AERunnable() {

			final int val$index;
			final IntListParameter this$0;

			public void runSupport()
			{
				if (list == null || list.isDisposed())
					return;
				if (list.getSelectionIndex() != index)
					list.select(index);
			}

			
			{
				this$0 = IntListParameter.this;
				index = i;
				super();
			}
		});
		if (COConfigurationManager.getIntParameter(name) != selected_value)
			COConfigurationManager.setParameter(name, selected_value);
	}

	private int findIndex(int value, int values[])
	{
		for (int i = 0; i < values.length; i++)
			if (values[i] == value)
				return i;

		return 0;
	}

	public void setLayoutData(Object layoutData)
	{
		list.setLayoutData(layoutData);
	}

	public Control getControl()
	{
		return list;
	}

	public void setValue(Object value)
	{
		if (value instanceof Number)
		{
			int i = ((Number)value).intValue();
			setIndex(findIndex(i, values));
		}
	}

	public Object getValueObject()
	{
		return new Integer(COConfigurationManager.getIntParameter(name));
	}
}

⌨️ 快捷键说明

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