AzureusTorrentPanel.java
| Index Score | ||
|---|---|---|
![]() |
![]() |
org.xnap.plugin.azureus |
![]() |
![]() |
XNap 3 |
View: Reasons, Metrics, Source Code
These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.
| Metric | Description | |
|---|---|---|
/*
* XNap - A P2P framework and client.
*
* See the file AUTHORS for copyright information.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.xnap.plugin.azureus;
import java.awt.BorderLayout;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.io.File;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import org.gudy.azureus2.core3.tracker.host.TRHostFactory;
import org.xnap.XNap;
import org.xnap.gui.ActionProvider;
import org.xnap.gui.component.XNapButton;
import org.xnap.gui.util.GUIHelper;
import org.xnap.gui.util.GridBagHelper;
import org.xnap.gui.util.IconHelper;
public class AzureusTorrentPanel extends JPanel implements ActionProvider {
// --- Data Field(s) ---
private Action openTorrentFileAction = new OpenTorrentFileAction();
private JFileChooser fileChooser = new JFileChooser();
private AzureusTrackerTableModel trackerTableModel;
// --- Constructor(s) ---
public AzureusTorrentPanel()
{
setLayout(new GridBagLayout());
JPanel trackerPanel = new JPanel(new BorderLayout());
trackerPanel.setBorder
(GUIHelper.createDefaultBorder(XNap.tr("Tracker")));
GridBagHelper.addPanel(this, trackerPanel);
trackerTableModel = new AzureusTrackerTableModel();
JTable trackerTable = trackerTableModel.createTable
(AzureusPlugin.getPreferences(), "connection");
trackerPanel.add(new JScrollPane(trackerTable), BorderLayout.CENTER);
TRHostFactory.create().addListener(trackerTableModel);
GridBagHelper.addVerticalSpacer(this);
// buttons
GridBagHelper.addComponent
(this, new XNapButton(openTorrentFileAction));
}
// --- Method(s) ---
public Action[] getActions()
{
return new Action[] { openTorrentFileAction, };
}
// --- Inner Class(es) ---
/**
* Connects to a servant.
*/
private class OpenTorrentFileAction extends AbstractAction {
public OpenTorrentFileAction()
{
putValue(Action.NAME, XNap.tr("Open Torrent File"));
putValue(IconHelper.XNAP_ICON, "fileopen.png");
putValue(Action.SHORT_DESCRIPTION,
XNap.tr("Downloads a torrent from a file."));
}
public void actionPerformed(ActionEvent event)
{
if (fileChooser.showOpenDialog(AzureusTorrentPanel.this)
== JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
AzureusPlugin.getGlobalManager().addDownloadManager
(file.getAbsolutePath(),
org.xnap.util.Preferences.getInstance().getIncompleteDir());
}
}
}
}
The table below shows all metrics for AzureusTorrentPanel.java.
| Metric | Value | Description | |
|---|---|---|---|



