📄 configsectionstats.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: ConfigSectionStats.java
package org.gudy.azureus2.ui.swt.views.configsections;
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.config.*;
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
import org.gudy.azureus2.ui.swt.mainwindow.Cursors;
import org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection;
public class ConfigSectionStats
implements UISWTConfigSection
{
private static final int defaultStatsPeriod = 30;
private static final int statsPeriods[] = {
1, 2, 3, 4, 5, 10, 15, 20, 25, 30,
40, 50, 60, 120, 180, 240, 300, 360, 420, 480,
540, 600, 900, 1200, 1800, 2400, 3000, 3600, 7200, 10800,
14400, 21600, 43200, 0x15180
};
public ConfigSectionStats()
{
}
public String configSectionGetParentSection()
{
return "root";
}
public String configSectionGetName()
{
return "stats";
}
public void configSectionSave()
{
}
public void configSectionDelete()
{
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.releaseImage("openFolderButton");
}
public int maxUserMode()
{
return 0;
}
public Composite configSectionCreate(final Composite parent)
{
ImageLoader imageLoader = ImageLoader.getInstance();
Image imgOpenFolder = imageLoader.getImage("openFolderButton");
Composite gStats = new Composite(parent, 0);
GridData gridData = new GridData(272);
gStats.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
gStats.setLayout(layout);
gridData = new GridData();
gridData.horizontalSpan = 3;
BooleanParameter enableStats = new BooleanParameter(gStats, "Stats Enable", "ConfigView.section.stats.enable");
enableStats.setLayoutData(gridData);
Control controls[] = new Control[14];
Label lStatsPath = new Label(gStats, 0);
Messages.setLanguageText(lStatsPath, "ConfigView.section.stats.defaultsavepath");
gridData = new GridData();
gridData.widthHint = 150;
final StringParameter pathParameter = new StringParameter(gStats, "Stats Dir", "");
pathParameter.setLayoutData(gridData);
controls[0] = lStatsPath;
controls[1] = pathParameter.getControl();
Button browse = new Button(gStats, 8);
browse.setImage(imgOpenFolder);
imgOpenFolder.setBackground(browse.getBackground());
browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
controls[2] = browse;
browse.addListener(13, new Listener() {
final Composite val$parent;
final StringParameter val$pathParameter;
final ConfigSectionStats this$0;
public void handleEvent(Event event)
{
DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), 0x10000);
dialog.setFilterPath(pathParameter.getValue());
dialog.setText(MessageText.getString("ConfigView.section.stats.choosedefaultsavepath"));
String path = dialog.open();
if (path != null)
pathParameter.setValue(path);
}
{
this$0 = ConfigSectionStats.this;
parent = composite;
pathParameter = stringparameter;
super();
}
});
Label lSaveFile = new Label(gStats, 0);
Messages.setLanguageText(lSaveFile, "ConfigView.section.stats.savefile");
controls[3] = lSaveFile;
gridData = new GridData();
gridData.widthHint = 150;
StringParameter fileParameter = new StringParameter(gStats, "Stats File", "Azureus_Stats.xml");
fileParameter.setLayoutData(gridData);
controls[4] = fileParameter.getControl();
new Label(gStats, 0);
Label lxslFile = new Label(gStats, 0);
Messages.setLanguageText(lxslFile, "ConfigView.section.stats.xslfile");
controls[5] = lxslFile;
gridData = new GridData();
gridData.widthHint = 150;
StringParameter xslParameter = new StringParameter(gStats, "Stats XSL File", "");
xslParameter.setLayoutData(gridData);
controls[6] = xslParameter.getControl();
Label lxslDetails = new Label(gStats, 0);
Messages.setLanguageText(lxslDetails, "ConfigView.section.stats.xslfiledetails");
String linkFAQ = "http://azureus.sourceforge.net/faq.php#20";
lxslDetails.setCursor(Cursors.handCursor);
lxslDetails.setForeground(Colors.blue);
lxslDetails.addMouseListener(new MouseAdapter() {
final ConfigSectionStats this$0;
public void mouseDoubleClick(MouseEvent arg0)
{
Utils.launch("http://azureus.sourceforge.net/faq.php#20");
}
public void mouseDown(MouseEvent arg0)
{
Utils.launch("http://azureus.sourceforge.net/faq.php#20");
}
{
this$0 = ConfigSectionStats.this;
super();
}
});
controls[7] = lxslDetails;
Label lSaveFreq = new Label(gStats, 0);
Messages.setLanguageText(lSaveFreq, "ConfigView.section.stats.savefreq");
controls[8] = lSaveFreq;
String spLabels[] = new String[statsPeriods.length];
int spValues[] = new int[statsPeriods.length];
for (int i = 0; i < statsPeriods.length; i++)
{
int num = statsPeriods[i];
if (num % 3600 == 0)
spLabels[i] = (new StringBuilder()).append(" ").append(statsPeriods[i] / 3600).append(" ").append(MessageText.getString("ConfigView.section.stats.hours")).toString();
else
if (num % 60 == 0)
spLabels[i] = (new StringBuilder()).append(" ").append(statsPeriods[i] / 60).append(" ").append(MessageText.getString("ConfigView.section.stats.minutes")).toString();
else
spLabels[i] = (new StringBuilder()).append(" ").append(statsPeriods[i]).append(" ").append(MessageText.getString("ConfigView.section.stats.seconds")).toString();
spValues[i] = statsPeriods[i];
}
controls[9] = lSaveFreq;
controls[10] = (new IntListParameter(gStats, "Stats Period", 30, spLabels, spValues)).getControl();
new Label(gStats, 0);
gridData = new GridData();
gridData.horizontalSpan = 3;
BooleanParameter exportPeers = new BooleanParameter(gStats, "Stats Export Peer Details", "ConfigView.section.stats.exportpeers");
exportPeers.setLayoutData(gridData);
controls[11] = exportPeers.getControl();
gridData = new GridData();
gridData.horizontalSpan = 3;
BooleanParameter exportFiles = new BooleanParameter(gStats, "Stats Export File Details", "ConfigView.section.stats.exportfiles");
exportFiles.setLayoutData(gridData);
controls[12] = exportFiles.getControl();
gridData = new GridData();
gridData.horizontalSpan = 3;
BooleanParameter graph_dividers = new BooleanParameter(gStats, "Stats Graph Dividers", "ConfigView.section.stats.graph_update_dividers");
graph_dividers.setLayoutData(gridData);
controls[13] = graph_dividers.getControl();
enableStats.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(controls));
return gStats;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -