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

📄 nameitem.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:   NameItem.java

package org.gudy.azureus2.ui.swt.views.tableitems.mytorrents;

import org.eclipse.swt.graphics.Image;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.config.ParameterListener;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.download.DownloadManagerState;
import org.gudy.azureus2.core3.torrent.TOTorrent;
import org.gudy.azureus2.plugins.download.Download;
import org.gudy.azureus2.plugins.ui.tables.*;
import org.gudy.azureus2.ui.swt.ImageRepository;
import org.gudy.azureus2.ui.swt.debug.ObfusticateCellText;
import org.gudy.azureus2.ui.swt.views.table.TableCellSWT;
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;

public class NameItem extends CoreTableColumn
	implements TableCellLightRefreshListener, ObfusticateCellText, TableCellDisposeListener
{

	public static final Class DATASOURCE_TYPE = org/gudy/azureus2/plugins/download/Download;
	public static final String COLUMN_ID = "name";
	private boolean showIcon;

	public void fillTableColumnInfo(TableColumnInfo info)
	{
		info.addCategories(new String[] {
			"essential", "content"
		});
	}

	public NameItem(String sTableID)
	{
		super(DATASOURCE_TYPE, "name", 1, 250, sTableID);
		setObfustication(true);
		setRefreshInterval(-2);
		setType(1);
		setMinWidth(100);
		COConfigurationManager.addAndFireParameterListener("NameColumn.showProgramIcon", new ParameterListener() {

			final NameItem this$0;

			public void parameterChanged(String parameterName)
			{
				setShowIcon(COConfigurationManager.getBooleanParameter("NameColumn.showProgramIcon"));
			}

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

	public void refresh(TableCell cell)
	{
		refresh(cell, false);
	}

	public void refresh(TableCell cell, boolean sortOnlyRefresh)
	{
		String name = null;
		DownloadManager dm = (DownloadManager)cell.getDataSource();
		if (dm != null)
			name = dm.getDisplayName();
		if (name == null)
			name = "";
		if ((cell.setText(name) || !cell.isValid()) && dm != null && isShowIcon() && !sortOnlyRefresh && (cell instanceof TableCellSWT))
		{
			String path = dm.getDownloadState().getPrimaryFile();
			if (path != null)
			{
				TOTorrent torrent = dm.getTorrent();
				Image icon = ImageRepository.getPathIcon(path, false, torrent != null && !torrent.isSimpleTorrent());
				((TableCellSWT)cell).setIcon(icon);
			}
		}
	}

	public String getObfusticatedText(TableCell cell)
	{
		String name = null;
		DownloadManager dm = (DownloadManager)cell.getDataSource();
		if (dm != null)
		{
			name = dm.toString();
			int i = name.indexOf('#');
			if (i > 0)
				name = name.substring(i + 1);
		}
		if (name == null)
			name = "";
		return name;
	}

	public void dispose(TableCell tablecell)
	{
	}

	private void disposeCellIcon(TableCell cell)
	{
		if (!(cell instanceof TableCellSWT))
			return;
		Image img = ((TableCellSWT)cell).getIcon();
		if (img != null)
		{
			((TableCellSWT)cell).setIcon(null);
			if (!img.isDisposed())
				img.dispose();
		}
	}

	public void setShowIcon(boolean showIcon)
	{
		this.showIcon = showIcon;
	}

	public boolean isShowIcon()
	{
		return showIcon;
	}

}

⌨️ 快捷键说明

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