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

📄 tablecolumncreator.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:   TableColumnCreator.java

package org.gudy.azureus2.ui.swt.views.table.utils;

import com.aelitis.azureus.ui.common.table.TableColumnCore;
import java.lang.reflect.Constructor;
import java.util.*;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.core3.util.LightHashMap;
import org.gudy.azureus2.plugins.download.DownloadTypeComplete;
import org.gudy.azureus2.plugins.download.DownloadTypeIncomplete;
import org.gudy.azureus2.plugins.ui.tables.TableColumn;
import org.gudy.azureus2.ui.swt.views.columnsetup.*;
import org.gudy.azureus2.ui.swt.views.table.TableColumnCoreCreationListener;
import org.gudy.azureus2.ui.swt.views.tableitems.mytorrents.*;

// Referenced classes of package org.gudy.azureus2.ui.swt.views.table.utils:
//			TableColumnManager

public class TableColumnCreator
{
	private static class cInfo
	{

		public Class cla;
		public Class forDataSourceType;

		public cInfo(Class cla, Class forDataSourceType)
		{
			this.cla = cla;
			this.forDataSourceType = forDataSourceType;
		}
	}


	public static int DATE_COLUMN_WIDTH = 110;

	public TableColumnCreator()
	{
	}

	public static TableColumnCore[] createIncompleteDM(String tableID)
	{
		String defaultVisibleOrder[] = {
			"health", "#", "name", "azsubs.ui.column.subs", "Info", "commenticon", "size", "down", "done", "status", 
			"seeds", "peers", "downspeed", "upspeed", "eta", "shareRatio", "tracker"
		};
		TableColumnManager tcManager = TableColumnManager.getInstance();
		Map mapTCs = tcManager.getTableColumnsAsMap(org/gudy/azureus2/plugins/download/DownloadTypeIncomplete, tableID);
		if (!tcManager.loadTableColumnSettings(org/gudy/azureus2/plugins/download/DownloadTypeIncomplete, tableID) || areNoneVisible(mapTCs))
		{
			setVisibility(mapTCs, defaultVisibleOrder);
			RankItem tc = (RankItem)mapTCs.get("#");
			if (tc != null)
			{
				tcManager.setDefaultSortColumnName(tableID, "#");
				tc.setSortAscending(true);
			}
		}
		return (TableColumnCore[])(TableColumnCore[])mapTCs.values().toArray(new TableColumnCore[0]);
	}

	public static TableColumnCore[] createCompleteDM(String tableID)
	{
		String defaultVisibleOrder[] = {
			"health", "#", "SeedingRank", "name", "azsubs.ui.column.subs", "Info", "RateIt", "commenticon", "size", "status", 
			"seeds", "peers", "upspeed", "shareRatio", "up", "tracker"
		};
		TableColumnManager tcManager = TableColumnManager.getInstance();
		Map mapTCs = tcManager.getTableColumnsAsMap(org/gudy/azureus2/plugins/download/DownloadTypeComplete, tableID);
		if (!tcManager.loadTableColumnSettings(org/gudy/azureus2/plugins/download/DownloadTypeComplete, tableID) || areNoneVisible(mapTCs))
		{
			setVisibility(mapTCs, defaultVisibleOrder);
			RankItem tc = (RankItem)mapTCs.get("#");
			if (tc != null)
			{
				tcManager.setDefaultSortColumnName(tableID, "#");
				tc.setSortAscending(true);
			}
		}
		return (TableColumnCore[])(TableColumnCore[])mapTCs.values().toArray(new TableColumnCore[0]);
	}

	private static boolean areNoneVisible(Map mapTCs)
	{
		boolean noneVisible = true;
		Iterator iter = mapTCs.values().iterator();
		do
		{
			if (!iter.hasNext())
				break;
			TableColumn tc = (TableColumn)iter.next();
			if (!tc.isVisible())
				continue;
			noneVisible = false;
			break;
		} while (true);
		return noneVisible;
	}

	private static void setVisibility(Map mapTCs, String defaultVisibleOrder[])
	{
		TableColumnCore tc;
		for (Iterator iter = mapTCs.values().iterator(); iter.hasNext(); tc.setVisible(false))
			tc = (TableColumnCore)iter.next();

		for (int i = 0; i < defaultVisibleOrder.length; i++)
		{
			String id = defaultVisibleOrder[i];
			TableColumnCore tc = (TableColumnCore)mapTCs.get(id);
			if (tc != null)
			{
				tc.setVisible(true);
				tc.setPositionNoShift(i);
			}
		}

	}

	public static void initCoreColumns()
	{
		Map c = new LightHashMap(50);
		Class tc = org/gudy/azureus2/plugins/ui/tables/TableColumn;
		c.put("#", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/RankItem, RankItem.DATASOURCE_TYPE));
		c.put("name", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/NameItem, NameItem.DATASOURCE_TYPE));
		c.put("size", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/SizeItem, SizeItem.DATASOURCE_TYPE));
		c.put("done", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/DoneItem, DoneItem.DATASOURCE_TYPE));
		c.put("status", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/StatusItem, StatusItem.DATASOURCE_TYPE));
		c.put("eta", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/ETAItem, ETAItem.DATASOURCE_TYPE));
		c.put("health", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/HealthItem, HealthItem.DATASOURCE_TYPE));
		c.put("commenticon", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/CommentIconItem, CommentIconItem.DATASOURCE_TYPE));
		c.put("down", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/DownItem, DownItem.DATASOURCE_TYPE));
		c.put("seeds", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/SeedsItem, SeedsItem.DATASOURCE_TYPE));
		c.put("peers", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/PeersItem, PeersItem.DATASOURCE_TYPE));
		c.put("downspeed", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/DownSpeedItem, DownSpeedItem.DATASOURCE_TYPE));
		c.put("upspeed", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/UpSpeedItem, UpSpeedItem.DATASOURCE_TYPE));
		c.put("maxupspeed", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/UpSpeedLimitItem, UpSpeedLimitItem.DATASOURCE_TYPE));
		c.put("tracker", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/TrackerStatusItem, TrackerStatusItem.DATASOURCE_TYPE));
		c.put("completed", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/CompletedItem, CompletedItem.DATASOURCE_TYPE));
		c.put("shareRatio", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/ShareRatioItem, ShareRatioItem.DATASOURCE_TYPE));
		c.put("up", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/UpItem, UpItem.DATASOURCE_TYPE));
		c.put("remaining", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/RemainingItem, RemainingItem.DATASOURCE_TYPE));
		c.put("pieces", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/PiecesItem, PiecesItem.DATASOURCE_TYPE));
		c.put("completion", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/CompletionItem, CompletionItem.DATASOURCE_TYPE));
		c.put("comment", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/CommentItem, CommentItem.DATASOURCE_TYPE));
		c.put("maxuploads", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/MaxUploadsItem, MaxUploadsItem.DATASOURCE_TYPE));
		c.put("totalspeed", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/TotalSpeedItem, TotalSpeedItem.DATASOURCE_TYPE));
		c.put("filesdone", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/FilesDoneItem, FilesDoneItem.DATASOURCE_TYPE));
		c.put("savepath", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/SavePathItem, SavePathItem.DATASOURCE_TYPE));
		c.put("torrentpath", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/TorrentPathItem, TorrentPathItem.DATASOURCE_TYPE));
		c.put("category", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/CategoryItem, CategoryItem.DATASOURCE_TYPE));
		c.put("networks", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/NetworksItem, NetworksItem.DATASOURCE_TYPE));
		c.put("peersources", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/PeerSourcesItem, PeerSourcesItem.DATASOURCE_TYPE));
		c.put("availability", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/AvailabilityItem, AvailabilityItem.DATASOURCE_TYPE));
		c.put("AvgAvail", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/AvgAvailItem, AvgAvailItem.DATASOURCE_TYPE));
		c.put("secondsseeding", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/SecondsSeedingItem, SecondsSeedingItem.DATASOURCE_TYPE));
		c.put("secondsdownloading", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/SecondsDownloadingItem, SecondsDownloadingItem.DATASOURCE_TYPE));
		c.put("timesincedownload", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/TimeSinceDownloadItem, TimeSinceDownloadItem.DATASOURCE_TYPE));
		c.put("timesinceupload", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/TimeSinceUploadItem, TimeSinceUploadItem.DATASOURCE_TYPE));
		c.put("OnlyCDing4", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/OnlyCDing4Item, OnlyCDing4Item.DATASOURCE_TYPE));
		c.put("trackernextaccess", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/TrackerNextAccessItem, TrackerNextAccessItem.DATASOURCE_TYPE));
		c.put("trackername", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/TrackerNameItem, TrackerNameItem.DATASOURCE_TYPE));
		c.put("seed_to_peer_ratio", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/SeedToPeerRatioItem, SeedToPeerRatioItem.DATASOURCE_TYPE));
		c.put("maxdownspeed", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/DownSpeedLimitItem, DownSpeedLimitItem.DATASOURCE_TYPE));
		c.put("swarm_average_speed", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/SwarmAverageSpeed, SwarmAverageSpeed.DATASOURCE_TYPE));
		c.put("swarm_average_completion", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/SwarmAverageCompletion, SwarmAverageCompletion.DATASOURCE_TYPE));
		c.put("bad_avail_time", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/BadAvailTimeItem, BadAvailTimeItem.DATASOURCE_TYPE));
		c.put("DateCompleted", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/DateCompletedItem, DateCompletedItem.DATASOURCE_TYPE));
		c.put("date_added", new cInfo(org/gudy/azureus2/ui/swt/views/tableitems/mytorrents/DateAddedItem, DateAddedItem.DATASOURCE_TYPE));
		c.put("TableColumnNameInfo", new cInfo(org/gudy/azureus2/ui/swt/views/columnsetup/ColumnTC_NameInfo, tc));
		c.put("TableColumnSample", new cInfo(org/gudy/azureus2/ui/swt/views/columnsetup/ColumnTC_Sample, tc));
		c.put("TableColumnChosenColumn", new cInfo(org/gudy/azureus2/ui/swt/views/columnsetup/ColumnTC_ChosenColumn, tc));
		TableColumnManager tcManager = TableColumnManager.getInstance();
		TableColumnCoreCreationListener tcCreator = new TableColumnCoreCreationListener(c) {

			final Map val$c;

			public TableColumnCore createTableColumnCore(Class forDataSourceType, String tableID, String columnID)
			{
				cInfo info = (cInfo)c.get(columnID);
				TableColumnCore column;
				Constructor constructor = info.cla.getDeclaredConstructor(new Class[] {
					java/lang/String
				});
				column = (TableColumnCore)constructor.newInstance(new Object[] {
					tableID
				});
				return column;
				Exception e;
				e;
				Debug.out(e);
				return null;
			}

			public void tableColumnCreated(TableColumn tablecolumn)
			{
			}

			
			{
				c = map;
				super();
			}
		};
		String id;
		cInfo info;
		for (Iterator iter = c.keySet().iterator(); iter.hasNext(); tcManager.registerColumn(info.forDataSourceType, id, tcCreator))
		{
			id = (String)iter.next();
			info = (cInfo)c.get(id);
		}

	}

}

⌨️ 快捷键说明

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