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

📄 tablecolumnsetupwindow.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:   TableColumnSetupWindow.java

package org.gudy.azureus2.ui.swt.views.columnsetup;

import com.aelitis.azureus.ui.common.table.*;
import com.aelitis.azureus.ui.common.updater.UIUpdatable;
import com.aelitis.azureus.ui.common.updater.UIUpdater;
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
import com.aelitis.azureus.ui.swt.uiupdater.UIUpdaterSWT;
import java.util.*;
import org.eclipse.swt.dnd.*;
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.util.AERunnable;
import org.gudy.azureus2.core3.util.Constants;
import org.gudy.azureus2.plugins.ui.tables.*;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;
import org.gudy.azureus2.ui.swt.shells.GCStringPrinter;
import org.gudy.azureus2.ui.swt.views.table.TableRowSWT;
import org.gudy.azureus2.ui.swt.views.table.impl.TableViewSWTImpl;
import org.gudy.azureus2.ui.swt.views.table.utils.TableColumnManager;

public class TableColumnSetupWindow
	implements UIUpdatable
{
	public class TableViewColumnSetup extends TableViewSWTImpl
	{

		private TableRow sampleRow;
		private final TableColumnSetupWindow setupWindow;
		final TableColumnSetupWindow this$0;

		public TableRow getSampleRow()
		{
			return sampleRow;
		}

		public void setSampleRow(TableRow sampleRow)
		{
			this.sampleRow = sampleRow;
		}

		public void chooseColumn(TableColumnCore column)
		{
			setupWindow.chooseColumn(column, null, false);
			TableRowCore row = tvAvail.getRow(column);
			if (row != null)
				row.redraw();
		}

		public boolean isColumnAdded(TableColumnCore column)
		{
			TableRowCore row = tvChosen.getRow(column);
			return row != null;
		}

		public TableViewColumnSetup(TableColumnSetupWindow setupWindow, String tableID, TableColumnCore items[], String defaultSortOn, boolean multi)
		{
			this$0 = TableColumnSetupWindow.this;
			super(tableID, tableID, items, defaultSortOn, 0x10010000 | (multi ? 2 : 4));
			sampleRow = null;
			this.setupWindow = setupWindow;
		}
	}


	private static final String TABLEID_AVAIL = "ColumnSetupAvail";
	private static final String TABLEID_CHOSEN = "ColumnSetupChosen";
	private static final boolean CAT_BUTTONS = true;
	private Shell shell;
	private TableViewColumnSetup tvAvail;
	private final String forTableID;
	private final Class forDataSourceType;
	private Composite cTableAvail;
	private Composite cCategories;
	private TableViewColumnSetup tvChosen;
	private Composite cTableChosen;
	private TableColumnCore columnsChosen[];
	private final TableRow sampleRow;
	private DragSourceListener dragSourceListener;
	private final TableStructureModificationListener listener;
	private TableColumnCore columnsOriginalOrder[];
	protected boolean apply;
	private Button radProficiency[];
	private Map mapNewVisibility;
	private ArrayList listColumnsNoCat;
	private ArrayList listCats;
	private Combo comboFilter;
	private Group cPickArea;

	public TableColumnSetupWindow(Class forDataSourceType, String _tableID, TableRow sampleRow, TableStructureModificationListener _listener)
	{
		apply = false;
		radProficiency = new Button[3];
		mapNewVisibility = new HashMap();
		this.sampleRow = sampleRow;
		listener = _listener;
		this.forDataSourceType = forDataSourceType;
		forTableID = _tableID;
		dragSourceListener = new DragSourceListener() {

			private TableColumnCore tableColumn;
			final TableColumnSetupWindow this$0;

			public void dragStart(DragSourceEvent event)
			{
				event.doit = true;
				Table table = (Table)((DragSource)event.widget).getControl();
				TableView tv = (TableView)table.getData("TableView");
				TableRowCore row = tv.getFocusedRow();
				if (row == null)
				{
					event.doit = false;
					return;
				}
				tableColumn = (TableColumnCore)row.getDataSource();
				if (event.image == null || Constants.isLinux)
					break MISSING_BLOCK_LABEL_227;
				GC gc = new GC(event.image);
				org.eclipse.swt.graphics.Rectangle bounds = event.image.getBounds();
				gc.fillRectangle(bounds);
				String title = MessageText.getString(tableColumn.getTitleLanguageKey(), tableColumn.getName());
				String s = (new StringBuilder()).append(title).append(" Column will be placed at the location you drop it, shifting other columns down").toString();
				GCStringPrinter sp = new GCStringPrinter(gc, s, bounds, false, false, 0x1000040);
				sp.calculateMetrics();
				if (sp.isCutoff())
					GCStringPrinter.printString(gc, title, bounds, false, false, 0x1000040);
				else
					sp.printString();
				gc.dispose();
				break MISSING_BLOCK_LABEL_227;
				Exception exception;
				exception;
				gc.dispose();
				throw exception;
				Throwable t;
				t;
			}

			public void dragSetData(DragSourceEvent event)
			{
				Table table = (Table)((DragSource)event.widget).getControl();
				TableView tv = (TableView)table.getData("TableView");
				event.data = (new StringBuilder()).append("").append(tv != tvChosen ? "a" : "c").toString();
			}

			public void dragFinished(DragSourceEvent dragsourceevent)
			{
			}

			
			{
				this$0 = TableColumnSetupWindow.this;
				super();
			}
		};
		String tableName = MessageText.getString((new StringBuilder()).append(_tableID).append("View.header").toString(), (String)null);
		if (tableName == null)
		{
			tableName = MessageText.getString((new StringBuilder()).append(_tableID).append("View.title.full").toString(), (String)null);
			if (tableName == null)
				tableName = _tableID;
		}
		shell = ShellFactory.createShell(Utils.findAnyShell(), 1264);
		Utils.setShellIcon(shell);
		FormLayout formLayout = new FormLayout();
		shell.setText(MessageText.getString("ColumnSetup.title", new String[] {
			tableName
		}));
		shell.setLayout(formLayout);
		shell.setSize(780, 550);
		shell.addDisposeListener(new DisposeListener() {

			final TableColumnSetupWindow this$0;

			public void widgetDisposed(DisposeEvent e)
			{
				close();
			}

			
			{
				this$0 = TableColumnSetupWindow.this;
				super();
			}
		});
		Label topInfo = new Label(shell, 64);
		Messages.setLanguageText(topInfo, "ColumnSetup.explain");
		FormData fd = Utils.getFilledFormData();
		fd.left.offset = 5;
		fd.top.offset = 5;
		fd.bottom = null;
		topInfo.setLayoutData(fd);
		Button btnOk = new Button(shell, 8);
		Messages.setLanguageText(btnOk, "Button.ok");
		btnOk.addSelectionListener(new SelectionAdapter() {

			final TableColumnSetupWindow this$0;

			public void widgetSelected(SelectionEvent e)
			{
				apply = true;
				shell.dispose();
			}

			
			{
				this$0 = TableColumnSetupWindow.this;
				super();
			}
		});
		cPickArea = new Group(shell, 0);
		cPickArea.setLayout(new FormLayout());
		final ExpandBar expandFilters = new ExpandBar(cPickArea, 0);
		expandFilters.setSpacing(1);
		final Composite cFilterArea = new Composite(expandFilters, 0);
		cFilterArea.setLayout(new FormLayout());
		TableColumnManager tcm = TableColumnManager.getInstance();
		Group cResultArea = new Group(shell, 0);
		Messages.setLanguageText(cResultArea, "ColumnSetup.chosencolumns");
		cResultArea.setLayout(new FormLayout());
		fd = new FormData();
		fd.top = new FormAttachment(topInfo, 5);
		fd.right = new FormAttachment(100, -3);
		fd.bottom = new FormAttachment(btnOk, -5);
		fd.width = 200;
		cResultArea.setLayoutData(fd);
		tvAvail = createTVAvail();
		cTableAvail = new Composite(cPickArea, 0x80000);
		GridLayout gridLayout = new GridLayout();
		gridLayout.marginWidth = gridLayout.marginHeight = 0;
		cTableAvail.setLayout(gridLayout);
		tvAvail.initialize(cTableAvail);
		TableColumnCore datasources[] = tcm.getAllTableColumnCoreAsArray(forDataSourceType, forTableID);
		listColumnsNoCat = new ArrayList(Arrays.asList(datasources));
		listCats = new ArrayList();
		for (int i = 0; i < datasources.length; i++)
		{
			TableColumnCore column = datasources[i];
			TableColumnInfo info = tcm.getColumnInfo(forDataSourceType, forTableID, column.getName());
			if (info == null)
				continue;
			String categories[] = info.getCategories();
			if (categories == null || categories.length <= 0)
				continue;
			for (int j = 0; j < categories.length; j++)
			{
				String cat = categories[j];
				if (!listCats.contains(cat))
					listCats.add(cat);
			}

			listColumnsNoCat.remove(column);
		}

		Listener radListener = new Listener() {

			final TableColumnSetupWindow this$0;

			public void handleEvent(Event event)
			{
				fillAvail();
			}

			
			{
				this$0 = TableColumnSetupWindow.this;
				super();
			}
		};
		Composite cProficiency = new Composite(cFilterArea, 0);
		cProficiency.setBackgroundMode(2);
		cProficiency.setLayout(new FormLayout());
		Label lblProficiency = new Label(cProficiency, 0);
		Messages.setLanguageText(lblProficiency, "ColumnSetup.proficiency");
		radProficiency[0] = new Button(cProficiency, 16);
		Messages.setLanguageText(radProficiency[0], "ConfigView.section.mode.beginner");
		fd = new FormData();
		fd.left = new FormAttachment(lblProficiency, 5);
		radProficiency[0].setLayoutData(fd);
		radProficiency[0].addListener(13, radListener);
		radProficiency[1] = new Button(cProficiency, 16);
		Messages.setLanguageText(radProficiency[1], "ConfigView.section.mode.intermediate");
		fd = new FormData();
		fd.left = new FormAttachment(radProficiency[0], 5);
		radProficiency[1].setLayoutData(fd);
		radProficiency[1].addListener(13, radListener);
		radProficiency[2] = new Button(cProficiency, 16);
		Messages.setLanguageText(radProficiency[2], "ConfigView.section.mode.advanced");
		fd = new FormData();
		fd.left = new FormAttachment(radProficiency[1], 5);
		radProficiency[2].setLayoutData(fd);
		radProficiency[2].addListener(13, radListener);
		int userMode = COConfigurationManager.getIntParameter("User Mode");
		if (userMode < 0)
			userMode = 0;
		else
		if (userMode >= radProficiency.length)
			userMode = radProficiency.length - 1;
		radProficiency[userMode].setSelection(true);
		Listener buttonListener = new Listener() {

			final TableColumnSetupWindow this$0;

			public void handleEvent(Event event)
			{
				Control children[] = cCategories.getChildren();
				for (int i = 0; i < children.length; i++)
				{
					Control child = children[i];
					if (child != event.widget && (child instanceof Button))
					{
						Button btn = (Button)child;
						btn.setSelection(false);
					}
				}

				fillAvail();
			}

			
			{
				this$0 = TableColumnSetupWindow.this;
				super();
			}
		};
		Label lblCat = new Label(cFilterArea, 0);
		Messages.setLanguageText(lblCat, "ColumnSetup.categories");
		cCategories = new Composite(cFilterArea, 0);
		cCategories.setLayout(new RowLayout());
		Button button = new Button(cCategories, 2);
		Messages.setLanguageText(button, "Categories.all");
		button.addListener(13, buttonListener);
		button.setSelection(true);
		for (Iterator i$ = listCats.iterator(); i$.hasNext(); button.addListener(13, buttonListener))
		{
			String cat = (String)i$.next();
			button = new Button(cCategories, 2);
			button.setData("cat", cat);
			if (MessageText.keyExists((new StringBuilder()).append("ColumnCategory.").append(cat).toString()))
				button.setText(MessageText.getString((new StringBuilder()).append("ColumnCategory.").append(cat).toString()));
			else
				button.setText(cat);
		}

		if (listColumnsNoCat.size() > 0)
		{
			button = new Button(cCategories, 2);
			if (MessageText.keyExists("ColumnCategory.uncat"))
				button.setText(MessageText.getString("ColumnCategory.uncat"));
			else
				button.setText("?");
			button.setText("?");
			button.setData("cat", "uncat");
			button.addListener(13, buttonListener);
		}
		final ExpandItem expandItemFilters = new ExpandItem(expandFilters, 0);
		expandItemFilters.setText(MessageText.getString("ColumnSetup.filters"));
		expandItemFilters.setControl(cFilterArea);
		expandFilters.addListener(11, new Listener() {

			final ExpandItem val$expandItemFilters;
			final Composite val$cFilterArea;
			final ExpandBar val$expandFilters;
			final TableColumnSetupWindow this$0;

			public void handleEvent(Event event)
			{
				expandItemFilters.setHeight(cFilterArea.computeSize(expandFilters.getSize().x, -1).y + 3);
			}

			
			{
				this$0 = TableColumnSetupWindow.this;
				expandItemFilters = expanditem;
				cFilterArea = composite;
				expandFilters = expandbar;
				super();
			}
		});
		expandFilters.addListener(17, new Listener() {

			final TableColumnSetupWindow this$0;

			public void handleEvent(Event event)
			{
				Utils.execSWTThreadLater(Constants.isLinux ? 250 : 0, new AERunnable() {

					final 7 this$1;

					public void runSupport()
					{
						shell.layout(true, true);
					}

					
					{
						this$1 = 7.this;
						super();
					}
				});
			}

			
			{
				this$0 = TableColumnSetupWindow.this;
				super();
			}
		});
		expandFilters.addListener(18, new Listener() {

			final TableColumnSetupWindow this$0;

			public void handleEvent(Event event)
			{
				Utils.execSWTThreadLater(Constants.isLinux ? 250 : 0, new AERunnable() {

					final 8 this$1;

					public void runSupport()
					{
						shell.layout(true, true);

⌨️ 快捷键说明

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