📄 faketablecell.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: FakeTableCell.java
package org.gudy.azureus2.ui.swt.views.table.impl;
import com.aelitis.azureus.ui.common.table.TableColumnCore;
import com.aelitis.azureus.ui.common.table.TableRowCore;
import com.aelitis.azureus.ui.swt.utils.ColorCache;
import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.swt.dnd.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.disk.DiskManagerFileInfo;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.peer.PEPeer;
import org.gudy.azureus2.core3.peer.PEPiece;
import org.gudy.azureus2.core3.tracker.host.TRHostTorrent;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.plugins.download.DownloadException;
import org.gudy.azureus2.plugins.ui.Graphic;
import org.gudy.azureus2.plugins.ui.tables.*;
import org.gudy.azureus2.pluginsimpl.local.disk.DiskManagerFileInfoImpl;
import org.gudy.azureus2.pluginsimpl.local.download.DownloadManagerImpl;
import org.gudy.azureus2.pluginsimpl.local.peers.PeerManagerImpl;
import org.gudy.azureus2.pluginsimpl.local.tracker.TrackerTorrentImpl;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.components.BufferedTableItem;
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
import org.gudy.azureus2.ui.swt.plugins.UISWTGraphic;
import org.gudy.azureus2.ui.swt.pluginsimpl.UISWTGraphicImpl;
import org.gudy.azureus2.ui.swt.shells.GCStringPrinter;
import org.gudy.azureus2.ui.swt.views.table.*;
import org.gudy.azureus2.ui.swt.views.table.utils.TableColumnSWTUtils;
public class FakeTableCell
implements TableCellSWT, PaintListener, MouseListener, MouseMoveListener, MouseTrackListener
{
private AEMonitor this_mon;
private ArrayList refreshListeners;
private ArrayList disposeListeners;
private ArrayList tooltipListeners;
private ArrayList cellMouseListeners;
private ArrayList cellMouseMoveListeners;
private ArrayList cellVisibilityListeners;
private Image image;
private Rectangle imageBounds;
private int marginHeight;
private int orientation;
private int marginWidth;
private Comparable sortValue;
private Object coreDataSource;
private Composite composite;
private final TableColumnCore tableColumn;
private Graphic graphic;
private String text;
private Object pluginDataSource;
private Object tooltip;
private Rectangle cellArea;
private boolean hadMore;
private ArrayList cellSWTPaintListeners;
private boolean valid;
private TableRow fakeRow;
public FakeTableCell(TableColumn column)
{
this_mon = new AEMonitor("FakeTableCell");
fakeRow = null;
valid = false;
tableColumn = (TableColumnCore)column;
setOrientationViaColumn();
}
public FakeTableCell(TableColumnCore column)
{
this_mon = new AEMonitor("FakeTableCell");
fakeRow = null;
valid = false;
tableColumn = column;
setOrientationViaColumn();
}
public void addRefreshListener(TableCellRefreshListener listener)
{
this_mon.enter();
if (refreshListeners == null)
refreshListeners = new ArrayList(1);
refreshListeners.add(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_55;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void removeRefreshListener(TableCellRefreshListener listener)
{
this_mon.enter();
if (refreshListeners == null)
{
this_mon.exit();
return;
}
refreshListeners.remove(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_51;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void addDisposeListener(TableCellDisposeListener listener)
{
this_mon.enter();
if (disposeListeners == null)
disposeListeners = new ArrayList(1);
disposeListeners.add(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_55;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void removeDisposeListener(TableCellDisposeListener listener)
{
this_mon.enter();
if (disposeListeners == null)
{
this_mon.exit();
return;
}
disposeListeners.remove(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_51;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void addToolTipListener(TableCellToolTipListener listener)
{
this_mon.enter();
if (tooltipListeners == null)
tooltipListeners = new ArrayList(1);
tooltipListeners.add(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_55;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void removeToolTipListener(TableCellToolTipListener listener)
{
this_mon.enter();
if (tooltipListeners == null)
{
this_mon.exit();
return;
}
tooltipListeners.remove(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_51;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void addMouseListener(TableCellMouseListener listener)
{
this_mon.enter();
if (cellMouseListeners == null)
cellMouseListeners = new ArrayList(1);
cellMouseListeners.add(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_55;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void removeMouseListener(TableCellMouseListener listener)
{
this_mon.enter();
if (cellMouseListeners == null)
{
this_mon.exit();
return;
}
cellMouseListeners.remove(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_51;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void addMouseMoveListener(TableCellMouseMoveListener listener)
{
this_mon.enter();
if (cellMouseMoveListeners == null)
cellMouseMoveListeners = new ArrayList(1);
cellMouseMoveListeners.add(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_55;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void removeMouseMoveListener(TableCellMouseMoveListener listener)
{
this_mon.enter();
if (cellMouseMoveListeners == null)
{
this_mon.exit();
return;
}
cellMouseMoveListeners.remove(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_51;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void addVisibilityListener(TableCellVisibilityListener listener)
{
this_mon.enter();
if (cellVisibilityListeners == null)
cellVisibilityListeners = new ArrayList(1);
cellVisibilityListeners.add(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_55;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void removeVisibilityListener(TableCellVisibilityListener listener)
{
this_mon.enter();
if (cellVisibilityListeners == null)
{
this_mon.exit();
return;
}
cellVisibilityListeners.remove(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_51;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
private void addSWTPaintListener(TableCellSWTPaintListener listener)
{
this_mon.enter();
if (cellSWTPaintListeners == null)
cellSWTPaintListeners = new ArrayList(1);
cellSWTPaintListeners.add(listener);
this_mon.exit();
break MISSING_BLOCK_LABEL_55;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
public void invokeSWTPaintListeners(GC gc)
{
if (getBounds().isEmpty())
return;
if (tableColumn != null)
{
Object swtPaintListeners[] = tableColumn.getCellOtherListeners("SWTPaint");
if (swtPaintListeners != null)
{
for (int i = 0; i < swtPaintListeners.length; i++)
try
{
TableCellSWTPaintListener l = (TableCellSWTPaintListener)swtPaintListeners[i];
l.cellPaint(gc, this);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
}
if (cellSWTPaintListeners == null)
return;
for (int i = 0; i < cellSWTPaintListeners.size(); i++)
try
{
TableCellSWTPaintListener l = (TableCellSWTPaintListener)(TableCellSWTPaintListener)cellSWTPaintListeners.get(i);
l.cellPaint(gc, this);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
public void addListeners(Object listenerObject)
{
if (listenerObject instanceof TableCellDisposeListener)
addDisposeListener((TableCellDisposeListener)listenerObject);
if (listenerObject instanceof TableCellRefreshListener)
addRefreshListener((TableCellRefreshListener)listenerObject);
if (listenerObject instanceof TableCellToolTipListener)
addToolTipListener((TableCellToolTipListener)listenerObject);
if (listenerObject instanceof TableCellMouseMoveListener)
addMouseMoveListener((TableCellMouseMoveListener)listenerObject);
if (listenerObject instanceof TableCellMouseListener)
addMouseListener((TableCellMouseListener)listenerObject);
if (listenerObject instanceof TableCellVisibilityListener)
addVisibilityListener((TableCellVisibilityListener)listenerObject);
if (listenerObject instanceof TableCellSWTPaintListener)
addSWTPaintListener((TableCellSWTPaintListener)listenerObject);
}
public void invokeMouseListeners(TableCellMouseEvent event)
{
if (event.cell != null && event.row == null)
event.row = event.cell.getTableRow();
try
{
tableColumn.invokeCellMouseListeners(event);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
ArrayList listeners = event.eventType != 3 ? cellMouseListeners : cellMouseMoveListeners;
if (listeners == null)
return;
for (int i = 0; i < listeners.size(); i++)
try
{
TableCellMouseListener l = (TableCellMouseListener)(TableCellMouseListener)listeners.get(i);
l.cellMouseTrigger(event);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
public Object getDataSource()
{
boolean bCoreObject = tableColumn.getUseCoreDataSource();
if (bCoreObject)
return coreDataSource;
if (pluginDataSource != null)
return pluginDataSource;
if (coreDataSource instanceof DownloadManager)
{
DownloadManager dm = (DownloadManager)coreDataSource;
if (dm != null)
try
{
pluginDataSource = DownloadManagerImpl.getDownloadStatic(dm);
}
catch (DownloadException e) { }
}
if (coreDataSource instanceof PEPeer)
{
PEPeer peer = (PEPeer)coreDataSource;
if (peer != null)
pluginDataSource = PeerManagerImpl.getPeerForPEPeer(peer);
}
if (coreDataSource instanceof PEPiece)
{
PEPiece piece = (PEPiece)coreDataSource;
if (piece != null)
pluginDataSource = null;
}
if (coreDataSource instanceof DiskManagerFileInfo)
{
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo)coreDataSource;
if (fileInfo != null)
try
{
pluginDataSource = new DiskManagerFileInfoImpl(DownloadManagerImpl.getDownloadStatic(fileInfo.getDownloadManager()), fileInfo);
}
catch (DownloadException e) { }
}
if (coreDataSource instanceof TRHostTorrent)
{
TRHostTorrent item = (TRHostTorrent)coreDataSource;
if (item != null)
pluginDataSource = new TrackerTorrentImpl(item);
}
return pluginDataSource;
}
public int[] getForeground()
{
if (composite == null || composite.isDisposed())
{
return null;
} else
{
Color fg = composite.getForeground();
return (new int[] {
fg.getRed(), fg.getGreen(), fg.getBlue()
});
}
}
public int[] getBackground()
{
return (new int[] {
0, 0, 0
});
}
public Graphic getBackgroundGraphic()
{
if (composite == null || composite.isDisposed())
return null;
Rectangle bounds = composite.getBounds();
if (bounds.isEmpty())
return null;
Image imgCap;
Control bgControl;
Image imgBG;
GC gc;
imgCap = new Image(composite.getDisplay(), bounds.width, bounds.height);
bgControl = Utils.findBackgroundImageControl(composite);
imgBG = composite.getBackgroundImage();
gc = new GC(imgCap);
if (imgBG == null)
{
gc.setBackground(composite.getBackground());
gc.fillRectangle(0, 0, bounds.width, bounds.height);
}
if (imgBG != null)
{
Point controlPos = new Point(0, 0);
if (bgControl instanceof Composite)
{
Rectangle compArea = ((Composite)bgControl).getClientArea();
controlPos.x = compArea.x;
controlPos.y = compArea.y;
}
Point absControlLoc = bgControl.toDisplay(controlPos.x, controlPos.y);
Rectangle shellClientArea = composite.getShell().getClientArea();
Point absShellLoc = composite.getParent().toDisplay(shellClientArea.x, shellClientArea.y);
Point ofs = new Point(absControlLoc.x - absShellLoc.x, absControlLoc.y - absShellLoc.y);
Rectangle imgBGBounds = imgBG.getBounds();
ofs.x = ofs.x % imgBGBounds.width;
ofs.y = ofs.y % imgBGBounds.height;
gc.drawImage(imgBG, ofs.x, ofs.y);
}
gc.dispose();
break MISSING_BLOCK_LABEL_325;
Exception exception;
exception;
gc.dispose();
throw exception;
return new UISWTGraphicImpl(imgCap);
Exception e;
e;
Debug.out(e);
return null;
}
public Graphic getGraphic()
{
return graphic;
}
public int getHeight()
{
if (composite != null && !composite.isDisposed())
return composite.getSize().y;
else
return 0;
}
public int getMaxLines()
{
return -1;
}
public Comparable getSortValue()
{
return sortValue;
}
public TableColumn getTableColumn()
{
return tableColumn;
}
public String getTableID()
{
return tableColumn != null ? tableColumn.getTableID() : null;
}
public TableRow getTableRow()
{
if (fakeRow == null)
fakeRow = new TableRow() {
final FakeTableCell this$0;
public void setForegroundToErrorColor()
{
}
public void setForeground(int ai[])
{
}
public void setForeground(int i, int j, int k)
{
}
public void removeMouseListener(TableRowMouseListener tablerowmouselistener)
{
}
public boolean isValid()
{
return FakeTableCell.this.isValid();
}
public boolean isSelected()
{
return false;
}
public String getTableID()
{
return FakeTableCell.this.getTableID();
}
public TableCell getTableCell(String columnName)
{
return null;
}
public Object getDataSource()
{
return FakeTableCell.this.getDataSource();
}
public void addMouseListener(TableRowMouseListener tablerowmouselistener)
{
}
{
this$0 = FakeTableCell.this;
super();
}
};
return fakeRow;
}
public String getText()
{
return text;
}
public Object getToolTip()
{
if (tooltip == null && hadMore)
return text;
else
return tooltip;
}
public int getWidth()
{
if (!isDisposed())
return composite.getSize().x;
else
return 0;
}
public void invalidate()
{
valid = false;
}
public boolean isDisposed()
{
return composite == null || composite.isDisposed();
}
public boolean isShown()
{
return true;
}
public boolean isValid()
{
return valid;
}
public void setFillCell(boolean flag)
{
}
public boolean setForeground(int red, int green, int blue)
{
if (isDisposed())
return false;
if (red < 0 || green < 0 || blue < 0)
composite.setForeground(null);
else
composite.setForeground(ColorCache.getColor(composite.getDisplay(), red, green, blue));
return true;
}
public boolean setForeground(int rgb[])
{
if (rgb == null || rgb.length < 3)
return setForeground(-1, -1, -1);
else
return setForeground(rgb[0], rgb[1], rgb[2]);
}
public boolean setForegroundToErrorColor()
{
if (isDisposed())
{
return false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -