📄 columntc_nameinfo.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: ColumnTC_NameInfo.java
package org.gudy.azureus2.ui.swt.views.columnsetup;
import com.aelitis.azureus.ui.common.table.*;
import com.aelitis.azureus.ui.swt.utils.ColorCache;
import org.eclipse.swt.graphics.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.plugins.ui.tables.*;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
import org.gudy.azureus2.ui.swt.shells.GCStringPrinter;
import org.gudy.azureus2.ui.swt.views.table.TableCellSWT;
import org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener;
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;
import org.gudy.azureus2.ui.swt.views.table.utils.TableColumnManager;
// Referenced classes of package org.gudy.azureus2.ui.swt.views.columnsetup:
// TableColumnSetupWindow
public class ColumnTC_NameInfo extends CoreTableColumn
implements TableCellRefreshListener, TableCellSWTPaintListener, TableCellMouseMoveListener, TableCellToolTipListener
{
public static final String COLUMN_ID = "TableColumnNameInfo";
public static Font fontHeader = null;
private static String profText[] = {
"beginner", "intermediate", "advanced"
};
public ColumnTC_NameInfo(String tableID)
{
super("TableColumnNameInfo", tableID);
initialize(5, -1, 415, -3);
setType(2);
}
public void refresh(TableCell cell)
{
TableColumnCore column = (TableColumnCore)cell.getDataSource();
String key = column.getTitleLanguageKey();
cell.setSortValue(MessageText.getString(key, column.getName()));
}
public void cellPaint(GC gc, TableCellSWT cell)
{
TableColumnCore column = (TableColumnCore)cell.getDataSource();
String key = column.getTitleLanguageKey();
Rectangle bounds = cell.getBounds();
if (bounds == null || bounds.isEmpty())
return;
Font fontDefault = gc.getFont();
if (fontHeader == null)
{
FontData fontData[] = gc.getFont().getFontData();
fontData[0].setStyle(1);
fontData[0].setHeight(fontData[0].getHeight() + 1);
fontHeader = new Font(gc.getDevice(), fontData);
}
gc.setFont(fontHeader);
bounds.y += 3;
bounds.x += 7;
bounds.width -= 14;
String name = MessageText.getString(key, column.getName());
GCStringPrinter sp = new GCStringPrinter(gc, name, bounds, 1, 128);
sp.printString();
Point titleSize = sp.getCalculatedSize();
gc.setFont(fontDefault);
String info = MessageText.getString((new StringBuilder()).append(key).append(".info").toString(), "");
Rectangle infoBounds = new Rectangle(bounds.x + 10, bounds.y + titleSize.y + 5, bounds.width - 15, bounds.height - 20);
GCStringPrinter.printString(gc, info, infoBounds, true, false);
TableColumnInfo columnInfo = (TableColumnInfo)cell.getTableRowCore().getData("columninfo");
if (columnInfo == null)
{
TableColumnManager tcm = TableColumnManager.getInstance();
columnInfo = tcm.getColumnInfo(column.getForDataSourceType(), column.getTableID(), column.getName());
cell.getTableRowCore().setData("columninfo", columnInfo);
}
Rectangle profBounds = new Rectangle(bounds.width - 100, bounds.y - 2, 100, 20);
byte proficiency = columnInfo.getProficiency();
if (proficiency > 0 && proficiency < profText.length)
{
org.eclipse.swt.graphics.Color oldColor = gc.getForeground();
gc.setForeground(Colors.grey);
GCStringPrinter.printString(gc, MessageText.getString((new StringBuilder()).append("ConfigView.section.mode.").append(profText[proficiency]).toString()), profBounds, true, false, 0x20080);
gc.setForeground(oldColor);
}
TableColumnSetupWindow.TableViewColumnSetup tv = (TableColumnSetupWindow.TableViewColumnSetup)cell.getTableRowCore().getView();
Rectangle hitArea;
if (tv.isColumnAdded(column))
{
hitArea = Utils.EMPTY_RECT;
} else
{
int x = bounds.x + titleSize.x + 15;
int y = bounds.y - 1;
int h = 15;
String textAdd = MessageText.getString("Button.add");
GCStringPrinter sp2 = new GCStringPrinter(gc, textAdd, new Rectangle(x, y, 500, h), true, false, 0x1000000);
sp2.calculateMetrics();
int w = sp2.getCalculatedSize().x + 12;
gc.setAdvanced(true);
gc.setAntialias(1);
gc.setBackground(ColorCache.getColor(gc.getDevice(), 255, 255, 255));
gc.fillRoundRectangle(x, y, w, h, 15, h);
gc.setBackground(ColorCache.getColor(gc.getDevice(), 215, 215, 215));
gc.fillRoundRectangle(x + 2, y + 2, w, h, 15, h);
gc.setForeground(ColorCache.getColor(gc.getDevice(), 145, 145, 145));
gc.drawRoundRectangle(x, y, w, h, 15, h);
gc.setForeground(ColorCache.getColor(gc.getDevice(), 50, 50, 50));
hitArea = new Rectangle(x, y, w + 2, h);
sp2.printString(gc, hitArea, 0x1000000);
bounds = cell.getBounds();
hitArea.x -= bounds.x;
hitArea.y -= bounds.y;
}
cell.getTableRowCore().setData("AddHitArea", hitArea);
}
public void cellMouseTrigger(TableCellMouseEvent event)
{
if (event.button == 1 && event.eventType == 1 && (event.cell instanceof TableCellCore))
{
Object data = ((TableCellCore)event.cell).getTableRowCore().getData("AddHitArea");
if (data instanceof Rectangle)
{
Rectangle hitArea = (Rectangle)data;
if (hitArea.contains(event.x, event.y))
{
TableColumnSetupWindow.TableViewColumnSetup tv = (TableColumnSetupWindow.TableViewColumnSetup)((TableCellCore)event.cell).getTableRowCore().getView();
Object dataSource = event.cell.getDataSource();
if (dataSource instanceof TableColumnCore)
{
TableColumnCore column = (TableColumnCore)dataSource;
tv.chooseColumn(column);
}
}
}
} else
if (event.eventType == 3)
{
Object data = ((TableCellCore)event.cell).getTableRowCore().getData("AddHitArea");
if (data instanceof Rectangle)
{
Rectangle hitArea = (Rectangle)data;
if (hitArea.contains(event.x, event.y))
{
((TableCellSWT)event.cell).setCursorID(21);
return;
}
}
((TableCellSWT)event.cell).setCursorID(0);
}
}
public void cellHover(TableCell tablecell)
{
}
public void cellHoverComplete(TableCell tablecell)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -