📄 bufferedtableitemimpl.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: BufferedTableItemImpl.java
package org.gudy.azureus2.ui.swt.components;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.gudy.azureus2.core3.util.AERunnable;
import org.gudy.azureus2.ui.swt.Utils;
// Referenced classes of package org.gudy.azureus2.ui.swt.components:
// BufferedTableItem, BufferedTableRow
public abstract class BufferedTableItemImpl
implements BufferedTableItem
{
protected BufferedTableRow row;
private int position;
private Color ourFGColor;
private String text;
private Image icon;
public BufferedTableItemImpl(BufferedTableRow row, int position)
{
ourFGColor = null;
text = "";
icon = null;
this.row = row;
this.position = position;
}
public String getText()
{
if (Utils.SWT32_TABLEPAINT)
return text;
if (position != -1)
return row.getText(position);
else
return "";
}
public boolean setText(String text)
{
if (Utils.SWT32_TABLEPAINT)
{
if (this.text.equals(text))
return false;
this.text = text != null ? text : "";
Rectangle bounds = getBounds();
if (bounds != null)
{
Table table = row.getTable();
Rectangle dirty = table.getClientArea().intersection(bounds);
table.redraw(dirty.x, dirty.y, dirty.width, dirty.height, false);
}
return true;
}
if (position != -1)
return row.setText(position, text);
else
return false;
}
public void setIcon(Image img)
{
if (position != -1)
{
row.setImage(position, img);
icon = img;
}
}
public Image getIcon()
{
if (position != -1)
{
Image image = row.getImage(position);
return image == null ? icon : image;
} else
{
return null;
}
}
public void setRowForeground(Color color)
{
row.setForeground(color);
}
public boolean setForeground(Color color)
{
if (position == -1)
return false;
boolean ok = row.setForeground(position, color);
if (ok && ourFGColor != null)
{
if (!ourFGColor.isDisposed())
ourFGColor.dispose();
ourFGColor = null;
}
return ok;
}
public Color getForeground()
{
if (position == -1)
return null;
else
return row.getForeground(position);
}
public boolean setForeground(int red, int green, int blue)
{
if (position == -1)
return false;
if (red == -1 && green == -1 && blue == -1)
return setForeground(null);
Color oldColor = row.getForeground(position);
RGB newRGB = new RGB(red, green, blue);
if (oldColor != null && oldColor.getRGB().equals(newRGB))
return false;
Color newColor = new Color(row.getTable().getDisplay(), newRGB);
boolean ok = row.setForeground(position, newColor);
if (ok)
{
if (ourFGColor != null && !ourFGColor.isDisposed())
ourFGColor.dispose();
ourFGColor = newColor;
} else
if (!newColor.isDisposed())
newColor.dispose();
return ok;
}
public Color getBackground()
{
return row.getBackground();
}
public Rectangle getBounds()
{
if (position != -1)
return row.getBounds(position);
else
return null;
}
public Table getTable()
{
return row.getTable();
}
public void dispose()
{
if (ourFGColor != null && !ourFGColor.isDisposed())
ourFGColor.dispose();
}
public boolean isShown()
{
return true;
}
public boolean needsPainting()
{
return false;
}
public void doPaint(GC gc1)
{
}
public void locationChanged()
{
}
public int getPosition()
{
return position;
}
public Image getBackgroundImage()
{
Table table = row.getTable();
Rectangle bounds = getBounds();
if (bounds.isEmpty())
{
return null;
} else
{
Image image = new Image(table.getDisplay(), bounds.width, bounds.height);
GC gc = new GC(image);
gc.setForeground(getBackground());
gc.setBackground(getBackground());
gc.fillRectangle(0, 0, bounds.width, bounds.height);
gc.dispose();
return image;
}
}
public void redraw()
{
Utils.execSWTThread(new AERunnable() {
final BufferedTableItemImpl this$0;
public void runSupport()
{
Rectangle bounds = getBounds();
if (bounds != null)
{
Table table = row.getTable();
Rectangle dirty = table.getClientArea().intersection(bounds);
if (!dirty.isEmpty())
table.redraw(dirty.x, dirty.y, dirty.width, dirty.height, false);
}
}
{
this$0 = BufferedTableItemImpl.this;
AERunnable();
}
});
}
public int getMaxLines()
{
return 1;
}
public void setCursor(final int cursorID)
{
Utils.execSWTThread(new AERunnable() {
final int val$cursorID;
final BufferedTableItemImpl this$0;
public void runSupport()
{
if (row == null)
return;
Table table = row.getTable();
if (table == null || table.isDisposed())
{
return;
} else
{
table.setCursor(table.getDisplay().getSystemCursor(cursorID));
return;
}
}
{
this$0 = BufferedTableItemImpl.this;
cursorID = i;
AERunnable();
}
});
}
public boolean isMouseOver()
{
Table table = row.getTable();
org.eclipse.swt.graphics.Point pt = table.getDisplay().getCursorLocation();
pt = table.toControl(pt);
Rectangle bounds = getBounds();
return bounds != null ? bounds.contains(pt) : false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -