📄 upspeeditem.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: UpSpeedItem.java
package org.gudy.azureus2.ui.swt.views.tableitems.mytorrents;
import com.aelitis.azureus.plugins.startstoprules.defaultplugin.DefaultRankCalculator;
import com.aelitis.azureus.plugins.startstoprules.defaultplugin.StartStopRulesDefaultPlugin;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.plugins.download.*;
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.views.table.utils.CoreTableColumn;
public class UpSpeedItem extends CoreTableColumn
implements TableCellAddedListener
{
public class RefreshListener
implements TableCellRefreshListener
{
private int iLastState;
private int loop;
final UpSpeedItem this$0;
public void refresh(TableCell cell)
{
Download dm = (Download)cell.getDataSource();
long value;
int iState;
if (dm == null)
{
iState = -1;
value = 0L;
} else
{
iState = dm.getState();
value = dm.getStats().getUploadAverage();
}
boolean bChangeColor = ++loop % 10 == 0;
if (cell.setSortValue(value) || !cell.isValid() || iState != iLastState)
{
cell.setText(StringInterner.intern(DisplayFormatters.formatByteCountToKiBEtcPerSec(value)));
bChangeColor = true;
}
if (bChangeColor)
{
changeColor(cell, dm, iState);
loop = 0;
}
}
private void changeColor(TableCell cell, Download dl, int iState)
{
try
{
DefaultRankCalculator calc = StartStopRulesDefaultPlugin.getRankCalculator(dl);
org.eclipse.swt.graphics.Color newFG = null;
if (calc != null && dl.getState() == 5 && !calc.getActivelySeeding())
newFG = Colors.colorWarning;
cell.setForeground(Utils.colorToIntArray(newFG));
iLastState = iState;
}
catch (Exception e)
{
Debug.printStackTrace(e);
}
}
public RefreshListener()
{
this$0 = UpSpeedItem.this;
super();
loop = 0;
}
}
public static final Class DATASOURCE_TYPE = org/gudy/azureus2/plugins/download/Download;
public static final String COLUMN_ID = "upspeed";
public UpSpeedItem(String sTableID)
{
super(DATASOURCE_TYPE, "upspeed", 2, 70, sTableID);
setType(1);
setRefreshInterval(-2);
setUseCoreDataSource(false);
setMinWidthAuto(true);
}
public void fillTableColumnInfo(TableColumnInfo info)
{
info.addCategories(new String[] {
"sharing", "bytes"
});
Class dsType = info.getColumn().getForDataSourceType();
if (org/gudy/azureus2/plugins/download/DownloadTypeComplete == dsType)
info.addCategories(new String[] {
"essential"
});
}
public void cellAdded(TableCell cell)
{
cell.addRefreshListener(new RefreshListener());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -