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

📄 tablerowimpl.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:   TableRowImpl.java

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

import com.aelitis.azureus.ui.common.table.*;
import java.io.PrintStream;
import java.util.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.Table;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.plugins.ui.tables.*;
import org.gudy.azureus2.pluginsimpl.local.PluginCoreUtils;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.components.BufferedTableRow;
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
import org.gudy.azureus2.ui.swt.views.table.*;

// Referenced classes of package org.gudy.azureus2.ui.swt.views.table.impl:
//			TableCellImpl, TableViewSWTImpl

public class TableRowImpl extends BufferedTableRow
	implements TableRowSWT
{

	private Map mTableCells;
	private String sTableID;
	private Object coreDataSource;
	private Object pluginDataSource;
	private boolean bDisposed;
	private boolean bSetNotUpToDateLastRefresh;
	private TableView tableView;
	private static AEMonitor this_mon = new AEMonitor("TableRowImpl");
	private ArrayList mouseListeners;
	private boolean wasShown;
	private Map dataList;
	private int lastIndex;
	private int fontStyle;
	private int alpha;
	private static final boolean DEBUG_SET_FOREGROUND = System.getProperty("debug.setforeground") != null;

	public TableRowImpl(TableView tv, Table table, String sTableID, TableColumnCore columnsSorted[], Object dataSource, boolean bSkipFirstColumn)
	{
		super(table);
		bSetNotUpToDateLastRefresh = false;
		wasShown = false;
		lastIndex = -1;
		alpha = 255;
		tableView = tv;
		this.sTableID = sTableID;
		coreDataSource = dataSource;
		mTableCells = new LightHashMap();
		bDisposed = false;
		for (int i = 0; i < columnsSorted.length; i++)
			if (columnsSorted[i] != null)
			{
				TableCellImpl cell = new TableCellImpl(this, columnsSorted[i], bSkipFirstColumn ? i + 1 : i);
				mTableCells.put(columnsSorted[i].getName(), cell);
			}

	}

	public boolean isValid()
	{
		if (bDisposed)
			return true;
		boolean valid = true;
		Iterator iter = mTableCells.values().iterator();
		do
		{
			if (!iter.hasNext())
				break;
			TableCellSWT cell = (TableCellSWT)iter.next();
			if (cell != null)
				valid &= cell.isValid();
		} while (true);
		return valid;
	}

	public Object getDataSource()
	{
		return getDataSource(false);
	}

	public String getTableID()
	{
		return sTableID;
	}

	public TableCell getTableCell(String field)
	{
		if (bDisposed)
			return null;
		else
			return (TableCell)mTableCells.get(field);
	}

	public void addMouseListener(TableRowMouseListener listener)
	{
		this_mon.enter();
		if (mouseListeners == null)
			mouseListeners = new ArrayList(1);
		mouseListeners.add(listener);
		this_mon.exit();
		break MISSING_BLOCK_LABEL_52;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public void removeMouseListener(TableRowMouseListener listener)
	{
		this_mon.enter();
		if (mouseListeners == null)
		{
			this_mon.exit();
			return;
		}
		mouseListeners.remove(listener);
		this_mon.exit();
		break MISSING_BLOCK_LABEL_47;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public void invokeMouseListeners(TableRowMouseEvent event)
	{
		ArrayList listeners = mouseListeners;
		if (listeners == null)
			return;
		for (int i = 0; i < listeners.size(); i++)
			try
			{
				TableRowMouseListener l = (TableRowMouseListener)(TableRowMouseListener)listeners.get(i);
				l.rowMouseTrigger(event);
			}
			catch (Throwable e)
			{
				Debug.printStackTrace(e);
			}

	}

	public void delete()
	{
		this_mon.enter();
		if (bDisposed)
		{
			this_mon.exit();
			return;
		}
		if (TableViewSWT.DEBUGADDREMOVE)
			System.out.println((new StringBuilder()).append(table.isDisposed() ? "" : table.getData("Name")).append(" row delete; index=").append(getIndex()).toString());
		TableCellSWT item;
		for (Iterator iter = mTableCells.values().iterator(); iter.hasNext(); item.dispose())
			item = (TableCellSWT)iter.next();

		setForeground((Color)null);
		bDisposed = true;
		this_mon.exit();
		break MISSING_BLOCK_LABEL_155;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public List refresh(boolean bDoGraphics)
	{
		if (bDisposed)
		{
			return Collections.EMPTY_LIST;
		} else
		{
			boolean bVisible = isVisible();
			return refresh(bDoGraphics, bVisible);
		}
	}

	public List refresh(boolean bDoGraphics, boolean bVisible)
	{
		List list = Collections.EMPTY_LIST;
		if (bDisposed)
			return list;
		if (!bVisible)
		{
			if (!bSetNotUpToDateLastRefresh)
			{
				setUpToDate(false);
				bSetNotUpToDateLastRefresh = true;
			}
			return list;
		}
		bSetNotUpToDateLastRefresh = false;
		((TableViewSWTImpl)tableView).invokeRefreshListeners(this);
		Iterator iter = mTableCells.values().iterator();
		do
		{
			if (!iter.hasNext())
				break;
			TableCellSWT item = (TableCellSWT)iter.next();
			TableColumn column = item.getTableColumn();
			if (column == tableView.getSortColumn() || tableView.isColumnVisible(column))
			{
				boolean changed = item.refresh(bDoGraphics, bVisible);
				if (changed)
				{
					if (list == Collections.EMPTY_LIST)
						list = new ArrayList(mTableCells.size());
					list.add(item);
				}
			}
		} while (true);
		return list;
	}

	public void setAlternatingBGColor(boolean bEvenIfNotVisible)
	{
		super.setAlternatingBGColor(bEvenIfNotVisible);
	}

	public void locationChanged(int iStartColumn)
	{
		if (bDisposed || !isVisible())
			return;
		Iterator iter = mTableCells.values().iterator();
		do
		{
			if (!iter.hasNext())
				break;
			TableCellSWT item = (TableCellSWT)iter.next();
			if (item.getTableColumn().getPosition() > iStartColumn)
				item.locationChanged();
		} while (true);
	}

	public void doPaint(GC gc)
	{
		doPaint(gc, isVisible());
	}

	public void doPaint(GC gc, boolean bVisible)
	{
		if (bDisposed || !bVisible)
			return;
		Iterator iter = mTableCells.values().iterator();
		do
		{
			if (!iter.hasNext())
				break;
			TableCellSWT cell = (TableCellSWT)iter.next();
			if (cell != null && cell.needsPainting())
				cell.doPaint(gc);
		} while (true);
	}

	public TableCellCore getTableCellCore(String field)
	{
		if (bDisposed)
			return null;
		else
			return (TableCellCore)mTableCells.get(field);
	}

	public TableCellSWT getTableCellSWT(String name)
	{
		if (bDisposed)
			return null;
		else
			return (TableCellSWT)mTableCells.get(name);
	}

	public Object getDataSource(boolean bCoreObject)
	{
		if (bDisposed)
			return null;
		if (bCoreObject)
			return coreDataSource;
		if (pluginDataSource != null)
		{
			return pluginDataSource;
		} else
		{
			pluginDataSource = PluginCoreUtils.convert(coreDataSource, bCoreObject);
			return pluginDataSource;
		}
	}

	public boolean isRowDisposed()
	{
		return bDisposed;
	}

	public int getIndex()
	{
		if (bDisposed)
			return -1;
		if (lastIndex >= 0)
		{
			com.aelitis.azureus.ui.common.table.TableRowCore row = ((TableViewSWTImpl)tableView).getRowQuick(lastIndex);
			if (row == this)
				return lastIndex;
		}
		lastIndex = ((TableViewSWTImpl)tableView).indexOf(this);
		return lastIndex;
	}

	public int getRealIndex()
	{
		return super.getIndex();
	}

	public boolean setTableItem(int newIndex, boolean isVisible)
	{
		if (bDisposed)
		{
			System.out.println((new StringBuilder()).append("XXX setTI: bDisposed from ").append(Debug.getCompressedStackTrace()).toString());
			return false;
		}
		boolean changed = super.setTableItem(newIndex, false, isVisible);
		if (lastIndex != newIndex)
			lastIndex = newIndex;
		setShown(tableView.isRowVisible(this), changed);
		return changed;
	}

	public boolean setTableItem(int newIndex)
	{
		return setTableItem(newIndex, true);
	}

	private static void setForegroundDebug(String method_sig, Color c)
	{
		if (DEBUG_SET_FOREGROUND && c != null)
			Debug.out((new StringBuilder()).append("BufferedTableRow ").append(method_sig).append(" -> ").append(c).toString());
	}

	private static void setForegroundDebug(String method_sig, int r, int g, int b)
	{
		if (DEBUG_SET_FOREGROUND && (r != 0 || g != 0 || b != 0))
			Debug.out((new StringBuilder()).append("BufferedTableRow ").append(method_sig).append(" -> ").append(r).append(",").append(g).append(",").append(b).toString());
	}

	public void setForeground(int r, int g, int b)
	{
		setForegroundDebug("setForeground(r, g, b)", r, g, b);
		if (!isVisible())
		{
			return;
		} else
		{
			super.setForeground(r, g, b);
			return;
		}
	}

	public void setForeground(final Color c)
	{
		setForegroundDebug("setForeground(Color)", c);
		if (!isVisible())
		{
			return;
		} else
		{
			Utils.execSWTThread(new AERunnable() {

				final Color val$c;
				final TableRowImpl this$0;

				public void runSupport()
				{
					setForegroundInSWTThread(c);
				}

			
			{
				this$0 = TableRowImpl.this;
				c = color;
				super();
			}
			});
			return;
		}
	}

	private void setForegroundInSWTThread(Color c)
	{
		setForegroundDebug("setForegroundInSWTThread(Color)", c);
		if (!isVisible())
		{
			return;
		} else
		{
			super.setForeground(c);
			return;
		}
	}

	public void setForeground(int rgb[])
	{
		if (rgb == null || rgb.length < 3)
		{
			setForeground((Color)null);
			return;
		} else
		{
			setForeground(rgb[0], rgb[1], rgb[2]);
			return;
		}
	}

	public void setForegroundToErrorColor()
	{
		setForeground(Colors.colorError);
	}

	public void invalidate()
	{
		super.invalidate();
		if (bDisposed)
			return;
		Iterator iter = mTableCells.values().iterator();
		do
		{
			if (!iter.hasNext())
				break;
			TableCellSWT cell = (TableCellSWT)iter.next();
			if (cell != null)
				cell.invalidate(true);
		} while (true);
	}

	public void setUpToDate(boolean upToDate)
	{
		if (bDisposed)
			return;
		Iterator iter = mTableCells.values().iterator();
		do
		{
			if (!iter.hasNext())
				break;
			TableCellSWT cell = (TableCellSWT)iter.next();
			if (cell != null)
				cell.setUpToDate(upToDate);
		} while (true);
	}

	public void redraw()
	{
		Rectangle bounds = getBounds();
		table.redraw(bounds.x, bounds.y, bounds.width, bounds.height, false);
	}

	public String toString()
	{
		String result = (new StringBuilder()).append("TableRowImpl@").append(Integer.toHexString(hashCode())).append("/#").append(lastIndex).toString();
		return result;
	}

	public TableView getView()
	{
		return tableView;
	}

	public void setShown(boolean b, boolean force)
	{
		if (bDisposed)
			return;
		if (b == wasShown && !force)
			return;
		wasShown = b;
		Iterator iter = mTableCells.values().iterator();
		do
		{
			if (!iter.hasNext())
				break;
			TableCellSWT cell = (TableCellSWT)iter.next();
			if (cell != null)
				cell.invokeVisibilityListeners(b ? 0 : 1, true);
		} while (true);
	}

	public boolean isMouseOver()
	{
		return tableView.getTableRowWithCursor() == this;
	}

	public void setData(String id, Object data)
	{
		if (dataList == null)
			dataList = new HashMap(1);
		if (data == null)
			dataList.remove("id");
		else
			dataList.put(id, data);
	}

	public Object getData(String id)
	{
		return dataList != null ? dataList.get(id) : null;
	}

	public boolean setDrawableHeight(int height)
	{
		return setHeight(height);
	}

	public Rectangle getBounds()
	{
		Rectangle bounds = getBounds(1);
		if (bounds == null)
		{
			return new Rectangle(0, 0, 0, 0);
		} else
		{
			bounds.x = 0;
			bounds.width = table.getSize().x;
			return bounds;
		}
	}

	public boolean setFontStyle(int style)
	{
		if (fontStyle == style)
		{
			return false;
		} else
		{
			fontStyle = style;
			invalidate();
			return true;
		}
	}

	public boolean setAlpha(int alpha)
	{
		if (this.alpha == alpha)
		{
			return false;
		} else
		{
			this.alpha = alpha;
			invalidate();
			return true;
		}
	}

	public int getAlpha()
	{
		return alpha;
	}

	public int getFontStyle()
	{
		return fontStyle;
	}

	public boolean isVisible()
	{
		return Utils.execSWTThreadWithBool("isVisible", new AERunnableBoolean() {

			final TableRowImpl this$0;

			public boolean runSupport()
			{
				return isVisible();
			}

			
			{
				this$0 = TableRowImpl.this;
				super();
			}
		}, 1000L);
	}

	public void setSelected(boolean selected)
	{
		super.setSelected(selected);
		if (tableView instanceof TableViewSWTImpl)
			((TableViewSWTImpl)tableView).updateSelectedRowIndexes();
	}

	public boolean isSelected()
	{
		return Utils.execSWTThreadWithBool("isSelected", new AERunnableBoolean() {

			final TableRowImpl this$0;

			public boolean runSupport()
			{
				return isSelected();
			}

			
			{
				this$0 = TableRowImpl.this;
				super();
			}
		}, 1000L);
	}




}

⌨️ 快捷键说明

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