[code:1:4846ae2db5]/*
package de.todesbaum.freemule.gui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.ByteArrayOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.StringTokenizer;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import de.todesbaum.freemule.application.AnnouncementListener;
import de.todesbaum.freemule.application.AnnouncementService;
import de.todesbaum.freemule.application.Client;
import de.todesbaum.freemule.application.ClientListener;
import de.todesbaum.freemule.application.ClientService;
import de.todesbaum.freemule.application.ClipboardListener;
import de.todesbaum.freemule.application.ClipboardService;
import de.todesbaum.freemule.application.DiscoveryListener;
import de.todesbaum.freemule.application.DiscoveryService;
import de.todesbaum.freemule.application.DownloadListener;
import de.todesbaum.freemule.application.DownloadService;
import de.todesbaum.freemule.application.FilelistCollectorListener;
import de.todesbaum.freemule.application.FilelistCollectorService;
import de.todesbaum.freemule.application.FilelistInsertListener;
import de.todesbaum.freemule.application.FilelistInsertService;
import de.todesbaum.freemule.application.FilelistListener;
import de.todesbaum.freemule.application.FilelistService;
import de.todesbaum.freemule.application.FreeMule;
import de.todesbaum.freemule.application.FreenetFile;
import de.todesbaum.freemule.application.Service;
import de.todesbaum.freemule.application.ServiceListener;
import de.todesbaum.freemule.application.ServiceThread;
import de.todesbaum.freemule.application.SharedFile;
import de.todesbaum.freemule.application.SharedFileListener;
import de.todesbaum.freemule.application.SharedFileService;
import de.todesbaum.freemule.application.UploadFile;
import de.todesbaum.freemule.application.UploadListener;
import de.todesbaum.freemule.application.UploadRequest;
import de.todesbaum.freemule.application.UploadRequestDiscoveryListener;
import de.todesbaum.freemule.application.UploadRequestDiscoveryService;
import de.todesbaum.freemule.application.UploadRequestInsertListener;
import de.todesbaum.freemule.application.UploadRequestInsertService;
import de.todesbaum.freemule.application.UploadRequestListener;
import de.todesbaum.freemule.application.UploadRequestService;
import de.todesbaum.freemule.application.UploadService;
import de.todesbaum.freemule.main.Configuration;
import de.todesbaum.freemule.main.LoggingPreferences;
import de.todesbaum.freemule.main.Version;
import de.todesbaum.freemule.messages.Messages;
import snoozesoft.systray4j.*;
/**
* @author
David Roden
* @version $Id:MainFrame.java 221 2006-03-06 14:46:49Z bombe $
*/
@SuppressWarnings("serial")
public class MainFrame extends JFrame implements ServiceListener, SharedFileListener, FilelistInsertListener, FilelistCollectorListener, DownloadListener, UploadRequestInsertListener, UploadRequestDiscoveryListener, DiscoveryListener, AnnouncementListener, ClientListener, ClipboardListener, FilelistListener, UploadListener, UploadRequestListener, SysTrayMenuListener {
private Configuration configuration;
private FreeMule freeMule;
private Action connectAction;
private Action disconnectAction;
private Action nodeAction;
private Action quitAction;
private Action preferencesAction;
private Action sharedDirectoriesAction;
private Action performanceAction;
private Action aboutAction;
private Action clearMessagesAction;
private Action isConnectedAction;
private boolean isConnected = true;
private JPanel mainPanel;
private CardLayout cardLayout;
private Border blackline, etched, raisedbevel, loweredbevel, empty;
private final String NUMMER1 = "1";
private final String NUMMER2 = "2";
private final String NUMMER3 = "3";
private final String NUMMER4 = "4";
private final String NUMMER5 = "5";
private final String NUMMER6 = "6";
private final String NUMMER7 = "7";
private JPanel ClientsPanel, DownPanel, UploadPanel, Search2Panel, SharedFPanel, LoggingPanel, ServicePanel;
private JButton KnownClientsPanelBtn, DownloadFilesPanelBtn, UploadFilesPanelBtn, SearchPanelBtn, SharedFilesPanelBtn, LoggingPreferencesPanelBtn, ServicePanelBtn;
//private StatusBar statusbar;
private LoggingPreferences loggingPreferences = new LoggingPreferences();
protected JList messageList;
protected DefaultListModel messageListModel = new DefaultListModel();
private DownloadFilesPanel downloadFilesPanel;
private UploadFilesPanel uploadFilesPanel;
private KnownClientsPanel knownClientsPanel;
private SharedFilesPanel sharedFilesPanel;
private LoggingPreferencesPanel loggingPreferencesPanel;
private SearchPanel searchPanel;
private ServicesPanel servicesPanel;
private SysTrayMenu menu;
private static final String[] toolTips =
{
"FreeMule",
};
// create icons
static final SysTrayMenuIcon[] icons =
{
// the extension can be omitted
new SysTrayMenuIcon("img/blueBunny")
};
public MainFrame(FreeMule freeMule) {
super("freeMule " + Version.getVersion());
// don´t forget to assign listeners to the icons
if( System.getProperty("os.name").startsWith("Windows") ) {
icons[0].addSysTrayMenuListener( this );
}
createComponents();
setFreeMule(freeMule);
getContentPane().setLayout(new BorderLayout());
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent) {
actionQuit();
}
});
setIconImage((new ImageIcon(getClass().getResource("/img/blueBunny.png"), "")).getImage());
createActions();
createToolbar();
createContent();
setJMenuBar(createMenuBar());
pack();
}
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu(Messages.getString("MainFrame.4")); //$NON-NLS-1$
menuBar.add(fileMenu);
fileMenu.add(connectAction);
fileMenu.add(disconnectAction);
fileMenu.addSeparator();
fileMenu.add(nodeAction);
fileMenu.add(performanceAction);
fileMenu.add(preferencesAction);
fileMenu.add(sharedDirectoriesAction);
fileMenu.addSeparator();
fileMenu.add(quitAction);
JMenu helpMenu = new JMenu(Messages.getString("MainFrame.5")); //$NON-NLS-1$
menuBar.add(helpMenu);
helpMenu.add(aboutAction);
return menuBar;
}
public void menuItemSelected( SysTrayMenuEvent e )
{
if( e.getActionCommand().equals( "exit" ) )
actionQuit();
else if( e.getActionCommand().equals( "about" ) )
{
JOptionPane.showMessageDialog( this, "freeMule " + Version.getVersion());
}
else JOptionPane.showMessageDialog( this, e.getActionCommand() );
}
public void iconLeftClicked( SysTrayMenuEvent e )
{
if( isVisible() ) setVisible(false);
else setVisible(true);
}
public void iconLeftDoubleClicked( SysTrayMenuEvent e )
{
if( isVisible() ) setVisible(false);
else setVisible(true);
}
private void createActions() {
connectAction = new AbstractAction(Messages.getString("MainFrame.6")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionConnect();
}
};
connectAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/connect_established.png"));
connectAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK));
connectAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.8")); //$NON-NLS-1$
disconnectAction = new AbstractAction(Messages.getString("MainFrame.9")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionDisconnect();
}
};
disconnectAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/connect_no.png"));
disconnectAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK));
disconnectAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.11")); //$NON-NLS-1$
disconnectAction.setEnabled(false);
preferencesAction = new AbstractAction(Messages.getString("MainFrame.12")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionPreferences();
}
};
preferencesAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/kservices.png"));
preferencesAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK));
preferencesAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.14")); //$NON-NLS-1$
sharedDirectoriesAction = new AbstractAction(Messages.getString("MainFrame.15")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionSharedDirectories();
}
};
sharedDirectoriesAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/kcontrol32.png"));
sharedDirectoriesAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
sharedDirectoriesAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.17")); //$NON-NLS-1$
nodeAction = new AbstractAction(Messages.getString("MainFrame.18")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionNode();
}
};
nodeAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/package_system.png"));
nodeAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));
nodeAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.20")); //$NON-NLS-1$
performanceAction = new AbstractAction(Messages.getString("MainFrame.21")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionPerformance();
}
};
performanceAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/konquest.png"));
performanceAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_MASK));
performanceAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.23")); //$NON-NLS-1$
quitAction = new AbstractAction(Messages.getString("MainFrame.24")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionQuit();
}
};
quitAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/exit.png"));
quitAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_MASK));
quitAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.26")); //$NON-NLS-1$
aboutAction = new AbstractAction(Messages.getString("MainFrame.27")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionAbout();
}
};
aboutAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/about.png"));
aboutAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK));
aboutAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.29")); //$NON-NLS-1$
clearMessagesAction = new AbstractAction(Messages.getString("MainFrame.30")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
actionClearMessages();
}
};
clearMessagesAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/history_clear.png"));
clearMessagesAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK));
clearMessagesAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.31")); //$NON-NLS-1$
isConnectedAction = new AbstractAction(Messages.getString("MainFrame.30")) { //$NON-NLS-1$
public void actionPerformed(ActionEvent actionEvent) {
if (isConnectedAction) {
isConnectedAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/connect_established.png"));
isConnectedAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK));
isConnectedAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.8")); //$NON-NLS-1$
isConnected = false;
}
else {
isConnectedAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/connect_no.png"));
isConnectedAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK));
isConnectedAction.putValue(Action.SHORT_DESCRIPTION, Messages.getString("MainFrame.11")); //$NON-NLS-1$
isConnectedAction = true;
}
}
}
private void createToolbar() {
JToolBar toolbar = new JToolBar();
toolbar.add(isConnected);
//toolbar.add(connectAction);
//toolbar.add(disconnectAction);
toolbar.addSeparator();
toolbar.add(KnownClientsPanelBtn);
toolbar.add(DownloadFilesPanelBtn);
toolbar.add(UploadFilesPanelBtn);
toolbar.add(SearchPanelBtn);
toolbar.add(SharedFilesPanelBtn);
toolbar.add(LoggingPreferencesPanelBtn);
toolbar.add(ServicePanelBtn);
toolbar.add(performanceAction);
toolbar.add(preferencesAction);
toolbar.add(nodeAction);
toolbar.add(sharedDirectoriesAction);
toolbar.add(clearMessagesAction);
toolbar.addSeparator();
toolbar.add(quitAction);
getContentPane().add(toolbar, BorderLayout.NORTH);
}
private void createComponents() {
downloadFilesPanel = new DownloadFilesPanel(this);
uploadFilesPanel = new UploadFilesPanel(this);
searchPanel = new SearchPanel(this);
knownClientsPanel = new KnownClientsPanel(this);
sharedFilesPanel = new SharedFilesPanel(this);
loggingPreferencesPanel = new LoggingPreferencesPanel(this);
servicesPanel = new ServicesPanel(this);
messageList = new JList(messageListModel);
KnownClientsPanelBtn = new JButton("");
DownloadFilesPanelBtn = new JButton("");
UploadFilesPanelBtn = new JButton("");
SearchPanelBtn = new JButton("");
SharedFilesPanelBtn = new JButton("");
LoggingPreferencesPanelBtn = new JButton("");
ServicePanelBtn = new JButton("");
KnownClientsPanelBtn.setToolTipText(Messages.getString("MainFrame.41"));
DownloadFilesPanelBtn.setToolTipText(Messages.getString("MainFrame.38"));
UploadFilesPanelBtn.setToolTipText(Messages.getString("MainFrame.39"));
SearchPanelBtn.setToolTipText(Messages.getString("MainFrame.40"));
SharedFilesPanelBtn.setToolTipText(Messages.getString("MainFrame.42"));
LoggingPreferencesPanelBtn.setToolTipText(Messages.getString("MainFrame.43"));
ServicePanelBtn.setToolTipText(Messages.getString("MainFrame.44"));
mainPanel = new JPanel();
}
private void createContent() {
if( System.getProperty("os.name").startsWith("Windows") ) {
// create an exit item
SysTrayMenuItem itemExit = new SysTrayMenuItem( "Exit", "exit" );
itemExit.addSysTrayMenuListener( this );
// create an about item
SysTrayMenuItem itemAbout = new SysTrayMenuItem( "About...", "about" );
itemAbout.addSysTrayMenuListener( this );
// create the main menu
menu = new SysTrayMenu( icons[0], toolTips[0] );
// insert items
menu.addItem( itemExit );
menu.addSeparator();
menu.addItem( itemAbout );
}
}
JPanel contentPanel = new JPanel(new BorderLayout(1, 1));
cardLayout = new CardLayout();
mainPanel.setLayout(cardLayout);
blackline = BorderFactory.createLineBorder(Color.black);
etched = BorderFactory.createEtchedBorder();
raisedbevel = BorderFactory.createRaisedBevelBorder();
loweredbevel = BorderFactory.createLoweredBevelBorder();
empty = BorderFactory.createEmptyBorder();
ClientsPanel = new JPanel(new BorderLayout(12, 12));
knownClientsPanel.setBorder(BorderFactory.createTitledBorder(empty, "Clients"));
mainPanel.add(knownClientsPanel, NUMMER1);
//DownLabel = new JLabel("Download", new ImageIcon("/img/down2.png"), SwingConstants.LEFT);
//Downlabel = new JLabel(Messages.getString("MainFrame.38"));
//Downlabel.setIcon(down);
DownPanel = new JPanel(new BorderLayout(12, 12));
//DownPanel.add(DownLabel, BorderLayout.NORTH);
downloadFilesPanel.setBorder(BorderFactory.createTitledBorder(empty, "Downloads"));
mainPanel.add(downloadFilesPanel, NUMMER2);
UploadPanel = new JPanel(new BorderLayout(12, 12));
uploadFilesPanel.setBorder(BorderFactory.createTitledBorder(empty, "Uploads"));
mainPanel.add(uploadFilesPanel, NUMMER3);
Search2Panel = new JPanel(new BorderLayout(12, 12));
searchPanel.setBorder(BorderFactory.createTitledBorder(empty, "Search"));
mainPanel.add(searchPanel, NUMMER4);
SharedFPanel = new JPanel(new BorderLayout(12, 12));
sharedFilesPanel.setBorder(BorderFactory.createTitledBorder(empty, "Shared Files"));
mainPanel.add(sharedFilesPanel, NUMMER5);
LoggingPanel = new JPanel(new BorderLayout(12, 12));
loggingPreferencesPanel.setBorder(BorderFactory.createTitledBorder(empty, "Logging"));
mainPanel.add(loggingPreferencesPanel, NUMMER6);
ServicePanel = new JPanel(new BorderLayout(12, 12));
servicesPanel.setBorder(BorderFactory.createTitledBorder(empty, "Service threads"));
mainPanel.add(servicesPanel, NUMMER7);
// split pane
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
splitPane.setDividerLocation(0.5);
contentPanel.add(splitPane, BorderLayout.CENTER);
// top frame: tabbed pane
//JTabbedPane topTabbed = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
splitPane.setTopComponent(mainPanel);
ImageIcon down = createImageIcon("/img/down2.png");
ImageIcon up = createImageIcon("/img/up.png");
ImageIcon search2 = createImageIcon("/img/xmag.png");
ImageIcon clients2 = createImageIcon("/img/www.png");
ImageIcon sharedfiles2 = createImageIcon("/img/folder_html.png");
ImageIcon logg = createImageIcon("/img/toggle_log.png");
ImageIcon clients = createImageIcon("/img/krfb.png");
ImageIcon downloads = createImageIcon("/img/downloads.png");
ImageIcon uploads = createImageIcon("/img/uploads.png");
ImageIcon search = createImageIcon("/img/kview.png");
ImageIcon sharedfiles = createImageIcon("/img/sharedfiles32.png");
ImageIcon logging = createImageIcon("/img/toggle_log32.png");
ImageIcon service = createImageIcon("/img/kcmsystem.png");
KnownClientsPanelBtn.setIcon(clients);
DownloadFilesPanelBtn.setIcon(downloads);
UploadFilesPanelBtn.setIcon(uploads);
SearchPanelBtn.setIcon(search);
SharedFilesPanelBtn.setIcon(sharedfiles);
LoggingPreferencesPanelBtn.setIcon(logging);
ServicePanelBtn.setIcon(service);
KnownClientsPanelBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
KnownClientsPanelBtnActionPerformed(evt);
}
});
DownloadFilesPanelBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
DownloadFilesPanelBtnActionPerformed(evt);
}
});
UploadFilesPanelBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
UploadFilesPanelBtnActionPerformed(evt);
}
});
SearchPanelBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
SearchPanelBtnActionPerformed(evt);
}
});
SharedFilesPanelBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
SharedFilesPanelBtnActionPerformed(evt);
}
});
LoggingPreferencesPanelBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
LoggingPreferencesPanelBtnActionPerformed(evt);
}
});
ServicePanelBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ServicePanelBtnActionPerformed(evt);
}
});
//topTabbed.addTab(Messages.getString("MainFrame.38"), down, downloadFilesPanel); //$NON-NLS-1$
//topTabbed.addTab(Messages.getString("MainFrame.39"), up, uploadFilesPanel); //$NON-NLS-1$
//topTabbed.addTab(Messages.getString("MainFrame.40"), search, searchPanel); //$NON-NLS-1$
//topTabbed.addTab(Messages.getString("MainFrame.41"), clients, knownClientsPanel); //$NON-NLS-1$
//topTabbed.addTab(Messages.getString("MainFrame.42"), sharedfiles, sharedFilesPanel); //$NON-NLS-1$
//topTabbed.addTab(Messages.getString("MainFrame.43"), logg, loggingPreferencesPanel); //$NON-NLS-1$
//topTabbed.add("Status", statusPanel);
//topTabbed.add(Messages.getString("MainFrame.44"), servicesPanel); //$NON-NLS-1$
// bottom frame: messages
splitPane.setBottomComponent(new JScrollPane(messageList));
splitPane.setResizeWeight(0.9);
// input line
JPanel keyInputPanel = new JPanel(new BorderLayout(5, 5));
contentPanel.add(keyInputPanel, BorderLayout.SOUTH);
getContentPane().add(contentPanel, BorderLayout.CENTER);
}
private void KnownClientsPanelBtnActionPerformed(ActionEvent evt) {
cardLayout.show(mainPanel, NUMMER1);
}
private void DownloadFilesPanelBtnActionPerformed(ActionEvent evt) {
cardLayout.show(mainPanel, NUMMER2);
}
private void UploadFilesPanelBtnActionPerformed(ActionEvent evt) {
cardLayout.show(mainPanel, NUMMER3);
}
private void SearchPanelBtnActionPerformed(ActionEvent evt) {
cardLayout.show(mainPanel, NUMMER4);
}
private void SharedFilesPanelBtnActionPerformed(ActionEvent evt) {
cardLayout.show(mainPanel, NUMMER5);
}
private void LoggingPreferencesPanelBtnActionPerformed(ActionEvent evt) {
cardLayout.show(mainPanel, NUMMER6);
}
private void ServicePanelBtnActionPerformed(ActionEvent evt) {
cardLayout.show(mainPanel, NUMMER7);
}
/** Returns an ImageIcon, or null if the path was invalid. */
protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = MainFrame.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println(Messages.getString("MainFrame.45") + path); //$NON-NLS-1$
return null;
}
}
/**
* @param configuration
* The configuration to set.
*/
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
loggingPreferences = configuration.getLoggingPreferences();
loggingPreferencesPanel.setLoggingPreferences(loggingPreferences);
Dimension d = getSize();
if (configuration.getWindowHeight() != 0) {
d.height = configuration.getWindowHeight();
}
if (configuration.getWindowWidth() != 0) {
d.width = configuration.getWindowWidth();
}
setSize(d);
setLocation(new Point(configuration.getWindowX(), configuration
.getWindowY()));
}
/**
* @param freeMule
* The freeMule to set.
*/
public void setFreeMule(FreeMule freeMule) {
this.freeMule = freeMule;
freeMule.addServiceListener(this);
freeMule.getAnnouncementService().addServiceListener(this);
freeMule.getClientService().addServiceListener(this);
freeMule.getClipboardService().addServiceListener(this);
freeMule.getDiscoveryService().addServiceListener(this);
freeMule.getDownloadService().addServiceListener(this);
freeMule.getEngineService().addServiceListener(this);
freeMule.getFilelistCollectorService().addServiceListener(this);
freeMule.getFilelistInsertService().addServiceListener(this);
freeMule.getFilelistService().addServiceListener(this);
freeMule.getSharedFileService().addServiceListener(this);
freeMule.getUploadRequestDiscoveryService().addServiceListener(this);
freeMule.getUploadRequestInsertService().addServiceListener(this);
freeMule.getUploadService().addServiceListener(this);
freeMule.getAnnouncementService().addAnnouncementListener(this);
freeMule.getClientService().addClientListener(this);
freeMule.getClipboardService().addClipboardListener(this);
freeMule.getDiscoveryService().addDiscoveryListener(this);
freeMule.getDownloadService().addDownloadListener(this);
freeMule.getFilelistCollectorService().addFilelistCollectorListener(this);
freeMule.getFilelistInsertService().addFilelistInsertListener(this);
freeMule.getFilelistService().addFilelistListener(this);
freeMule.getSharedFileService().addSharedFileListener(this);
freeMule.getUploadRequestDiscoveryService().addUploadRequestDiscoveryListener(this);
freeMule.getUploadRequestInsertService().addUploadRequestInsertListener(this);
freeMule.getUploadService().addUploadListener(this);
downloadFilesPanel.setDownloadService(freeMule.getDownloadService());
uploadFilesPanel.setUploadService(freeMule.getUploadService());
searchPanel.setDownloadService(freeMule.getDownloadService());
searchPanel.setFilelistService(freeMule.getFilelistService());
knownClientsPanel.setClientService(freeMule.getClientService());
knownClientsPanel.setFilelistService(freeMule.getFilelistService());
sharedFilesPanel.setSharedFileService(freeMule.getSharedFileService());
servicesPanel.setServices(freeMule.getServices());
}
public Client getThisClient() {
return freeMule.getThisClient();
}
public void actionConnect() {
connectAction.setEnabled(false);
nodeAction.setEnabled(true);
performanceAction.setEnabled(true);
preferencesAction.setEnabled(true);
sharedDirectoriesAction.setEnabled(true);
freeMule.start();
}
public void actionDisconnect() {
final FreeMule freeMuleCopy = freeMule;
new Thread(new Runnable() {
public void run() {
freeMuleCopy.stop();
}
}).start();
disconnectAction.setEnabled(false);
}
public void actionPreferences() {
PreferencesDialog dialog = new PreferencesDialog(this);
dialog.setUsername(configuration.getUsername());
dialog.setClientID(configuration.getPublicKey());
dialog.setIncomingDirectory(configuration.getIncomingDirectory());
dialog.setTempDirectory(configuration.getTempDirectory());
dialog.setNetworkName(configuration.getNetworkName());
dialog.setHopsToLive(configuration.getHopsToLive());
dialog.setVisible(true);
configuration.setUsername(dialog.getUsername());
configuration.setIncomingDirectory(dialog.getIncomingDirectory());
configuration.setTempDirectory(dialog.getTempDirectory());
configuration.setNetworkName(dialog.getNetworkName());
configuration.setHopsToLive(dialog.getHopsToLive());
freeMule.setUsername(dialog.getUsername());
freeMule.setIncomingDirectory(dialog.getIncomingDirectory());
freeMule.setTempDirectory(dialog.getTempDirectory());
freeMule.setNetworkName(dialog.getNetworkName());
freeMule.setHopsToLive(dialog.getHopsToLive());
}
protected void actionSharedDirectories() {
SharedDirectoriesDialog dialog = new SharedDirectoriesDialog(this);
dialog.setSharedDirectories(configuration.getSharedDirectories());
dialog.setVisible(true);
configuration.setSharedDirectories(dialog.getSharedDirectories());
freeMule.setSharedDirectories(dialog.getSharedDirectories());
}
public void actionNode() {
NodeDialog nodeDialog = new NodeDialog(this);
nodeDialog.setNodeAddress(configuration.getNodeAddress());
nodeDialog.setNodePort(configuration.getNodePort());
nodeDialog.setMaxUploadSpeed(configuration.getMaxUploadSpeed());
nodeDialog.setVisible(true);
configuration.setNodeAddress(nodeDialog.getNodeAddress());
configuration.setNodePort(nodeDialog.getNodePort());
configuration.setMaxUploadSpeed(nodeDialog.getMaxUploadSpeed());
freeMule.setNodeAddress(nodeDialog.getNodeAddress());
freeMule.setNodePort(nodeDialog.getNodePort());
freeMule.setMaxUploadSpeed(nodeDialog.getMaxUploadSpeed());
}
protected void actionPerformance() {
PerformanceDialog performanceDialog = new PerformanceDialog(this);
performanceDialog.setDiscoveryThreads(configuration.getDiscoveryThreads());
performanceDialog.setDownloadThreads(configuration.getDownloadThreads());
performanceDialog.setFilelistCollectingThreads(configuration.getFilelistCollectingThreads());
performanceDialog.setUploadThreads(configuration.getUploadThreads());
performanceDialog.setFilelistUploadThreads(configuration.getFilelistUploadThreads());
performanceDialog.setUploadRequestDiscoveryThreads(configuration.getUploadRequestDiscoveryThreads());
performanceDialog.setVisible(true);
configuration.setDiscoveryThreads(performanceDialog.getDiscoveryThreads());
configuration.setDownloadThreads(performanceDialog.getDownloadThreads());
configuration.setFilelistCollectingThreads(performanceDialog.getFilelistCollectingThreads());
configuration.setUploadThreads(performanceDialog.getUploadThreads());
configuration.setFilelistUploadThreads(performanceDialog.getFilelistUploadThreads());
configuration.setUploadRequestDiscoveryThreads(performanceDialog.getUploadRequestDiscoveryThreads());
freeMule.setDiscoveryThreads(performanceDialog.getDiscoveryThreads());
freeMule.setDownloadThreads(performanceDialog.getDownloadThreads());
freeMule.setFilelistCollectingThreads(performanceDialog.getFilelistCollectingThreads());
freeMule.setUploadThreads(performanceDialog.getUploadThreads());
freeMule.setFilelistUploadThreads(performanceDialog.getFilelistUploadThreads());
freeMule.setUploadRequestDiscoveryThreads(performanceDialog.getUploadRequestDiscoveryThreads());
}
public void actionQuit() {
if (!connectAction.isEnabled()) {
if (JOptionPane.showConfirmDialog(this, Messages.getString("MainFrame.46"), Messages.getString("MainFrame.47"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.CANCEL_OPTION) { //$NON-NLS-1$ //$NON-NLS-2$
return;
}
}
configuration.setWindowHeight(getSize().height);
configuration.setWindowWidth(getSize().width);
configuration.setWindowX(getLocation().x);
configuration.setWindowY(getLocation().y);
freeMule.destroy();
System.exit(0);
}
public void actionAbout() {
JOptionPane.showMessageDialog(this, "<html><big>freeMule " + Version.getVersion() + "</big>
by <a href=\"mailto:droden@gmail.com\">droden@gmail.com</a> ,ET and crypton</html>", Messages.getString("MainFrame.50"), JOptionPane.INFORMATION_MESSAGE); //$NON-NLS-3$
}
protected void actionClearMessages() {
synchronized (messageListModel) {
messageListModel.clear();
}
}
protected String getCurrentTimestamp() {
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
int millis = calendar.get(Calendar.MILLISECOND);
StringBuffer result = new StringBuffer(12);
if (hour < 10) {
result.append('0');
}
result.append(hour).append(':');
if (minute < 10) {
result.append('0');
}
result.append(minute).append(':');
if (second < 10) {
result.append('0');
}
result.append(second).append('.');
if (millis < 100) {
result.append('0');
if (millis < 10) {
result.append('0');
}
}
result.append(millis);
return result.toString();
}
private void addMessageToGUI(final String message) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
synchronized (messageListModel) {
messageListModel.addElement(Messages.getString("MainFrame.51") + getCurrentTimestamp() + Messages.getString("MainFrame.52") + message); //$NON-NLS-1$ //$NON-NLS-2$
messageList.ensureIndexIsVisible(messageListModel.getSize() - 1);
}
}
});
}
private void addMessageToFile(String message) {
String filename = loggingPreferences.getLogfile();
if (filename.equals("stdout")) {
System.out.println(message);
} else if (filename.equals("stderr")) {
System.err.println(message);
} else {
Writer writer = null;
try {
writer = new FileWriter(filename, true);
writer.write(message + "\n");
} catch (IOException e) {
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException ioe1) {
}
}
}
}
@SuppressWarnings("unused")
private String[] parseThrowable(Throwable throwable) {
ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
PrintStream bytePrinter = new PrintStream(byteOutput);
throwable.printStackTrace(bytePrinter);
bytePrinter.close();
try {
byteOutput.close();
} catch (IOException e) {
}
byte[] throwableBytes = byteOutput.toByteArray();
String throwableText = new String(throwableBytes);
StringTokenizer throwableTokens = new StringTokenizer(throwableText, "\n");
List<String> throwableLines = new ArrayList<String>();
while (throwableTokens.hasMoreTokens()) {
String throwableLine = throwableTokens.nextToken();
throwableLines.add(throwableLine);
}
return throwableLines.toArray(new String[throwableLines.size()]);
}
private void logMessage(String serviceName, String eventName) {
logMessage(serviceName, eventName, null);
}
private void logMessage(String serviceName, String eventName, String message) {
logMessage(serviceName, eventName, message, null);
}
private void logMessage(String serviceName, String eventName, String message, Throwable throwable) {
String eventMessage = serviceName + ": " + eventName;
if (message != null) {
eventMessage += ": " + message;
}
if (throwable != null) {
eventMessage += ": " + throwable.getClass().getName() + ": " + throwable.getMessage();
}
eventMessage += ".";
if (loggingPreferences.getGUILogging(serviceName, eventName)) {
addMessageToGUI(eventMessage);
if (throwable != null) {
throwable.printStackTrace(System.err);
}
}
if (loggingPreferences.getFileLogging(serviceName, eventName)) {
addMessageToFile(eventMessage);
}
}
//
// INTERFACE ServiceListener
//
/**
* {@inheritDoc}
*/
public void serviceStarted(Service service) {
logMessage(service.getName(), Messages.getString("MainFrame.3")); //$NON-NLS-1$
if (service == freeMule) {
disconnectAction.setEnabled(true);
}
}
/**
* {@inheritDoc}
*/
public void serviceAborted(Service service, Throwable throwable) {
logMessage(service.getName(), Messages.getString("MainFrame.2"), Messages.getString("MainFrame.65"), throwable); //$NON-NLS-1$ //$NON-NLS-2$
if (service.equals(freeMule)) {
disconnectAction.setEnabled(false);
connectAction.setEnabled(true);
//nodeAction.setEnabled(true);
//performanceAction.setEnabled(true);
//preferencesAction.setEnabled(true);
//sharedDirectoriesAction.setEnabled(true);
}
}
/**
* {@inheritDoc}
*/
public void serviceStopped(Service service) {
logMessage(service.getName(), Messages.getString("MainFrame.66")); //$NON-NLS-1$
if (service == freeMule) {
disconnectAction.setEnabled(false);
connectAction.setEnabled(true);
//nodeAction.setEnabled(false);
//performanceAction.setEnabled(false);
//preferencesAction.setEnabled(false);
//sharedDirectoriesAction.setEnabled(false);
}
}
/**
* {@inheritDoc}
*/
public void serviceThreadStarted(Service service, Thread thread) {
logMessage(service.getName(), Messages.getString("MainFrame.67"), thread.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void serviceThreadUpdated(Service service, Thread thread) {
logMessage(service.getName(), Messages.getString("MainFrame.68"), thread.getName() + ": " + ((ServiceThread) thread).getStatus()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void serviceThreadAborted(Service service, Thread thread, Throwable throwable) {
logMessage(service.getName(), Messages.getString("MainFrame.70"), Messages.getString("MainFrame.71"), throwable); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void serviceThreadStopped(Service service, Thread thread) {
logMessage(service.getName(), Messages.getString("MainFrame.72"), thread.getName()); //$NON-NLS-1$
}
//
// INTERFACE SharedFileListener
//
/**
* {@inheritDoc}
*/
public void sharedFileLoadingStarted(String filename) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.73")); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileLoadingFailed(String filename, Exception exception) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.74"), null, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileLoadingComplete(String filename) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.75")); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileUnsharedFile(String filename) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.76"), filename); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileUnsharedDirectory(String directory) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.77"), directory); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileSavingStarted(String filename) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.78"), filename); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileSavingFailed(String filename, Exception exception) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.79"), filename, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileSavingComplete(String filename) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.80"), filename); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileScanStarted() {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.81")); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileScanFailed(Exception exception) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.82"), null, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileScanComplete() {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.83")); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileDirectoryScanStarted(String directory) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.84"), directory); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileDirectoryScanFailed(String directory, Exception exception) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.85"), directory, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileDirectoryScanComplete(String directory) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.86"), directory); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileHashingStarted(String filename) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.87"), filename); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileHashingProgress(String filename, int blockIndex, int blockCount) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.88"), filename + ": " + ((blockIndex + 1) * 100 / blockCount) + "%"); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileHashingFailed(String filename, Exception exception) {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.91"), filename, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileHashingComplete(String filename, String key, long filelength, long duration) {
double rate = (filelength / 1024.0) / (duration / 1000.0);
double roundedRate = (int) (rate * 10) / 10.0;
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.92"), filename + " (" + (duration / 1000) + "s, " + roundedRate + " KiB/s)"); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void sharedFileListChanged() {
logMessage(SharedFileService.NAME, Messages.getString("MainFrame.96")); //$NON-NLS-1$
}
//
// INTERFACE FilelistCollectorListener
//
/**
* {@inheritDoc}
*/
public void filelistCollectingStarted(Client remoteClient, String key) {
logMessage(FilelistCollectorService.NAME, Messages.getString("MainFrame.97"), Messages.getString("MainFrame.98") + remoteClient.getName() + Messages.getString("MainFrame.99") + key); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/**
* {@inheritDoc}
*/
public void filelistCollectingFailed(Client remoteClient, String key, Exception exception) {
logMessage(FilelistCollectorService.NAME, Messages.getString("MainFrame.100"), Messages.getString("MainFrame.101") + remoteClient.getName() + Messages.getString("MainFrame.102") + key, exception); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
/**
* {@inheritDoc}
*/
public void filelistCollectingComplete(Client remoteClient, String key, SharedFile[] sharedFiles) {
logMessage(FilelistCollectorService.NAME, Messages.getString("MainFrame.103"), Messages.getString("MainFrame.104") + remoteClient.getName() + Messages.getString("MainFrame.105") + key + ", " + sharedFiles.length + Messages.getString("MainFrame.107")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-5$
}
//
// INTERFACE FilelistInsertListener
/**
* {@inheritDoc}
*/
public void filelistInsertStarted(String key, int index) {
logMessage(FilelistInsertService.NAME, Messages.getString("MainFrame.108"), Messages.getString("MainFrame.109") + index); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void filelistInsertFailed(String key, int index, Exception exception) {
logMessage(FilelistInsertService.NAME, Messages.getString("MainFrame.110"), Messages.getString("MainFrame.111") + index, exception); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void filelistInsertComplete(String key, int index) {
logMessage(FilelistInsertService.NAME, Messages.getString("MainFrame.112"), Messages.getString("MainFrame.113") + index); //$NON-NLS-1$ //$NON-NLS-2$
}
//
// INTERFACE DownloadListener
//
/**
* {@inheritDoc}
*/
public void downloadAdded(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.114"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void downloadRemoved(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.115"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void downloadStarted(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.116"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void downloadStopped(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.117"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void downloadCompleting(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.118"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void downloadCompletionFailed(FreenetFile download, Exception exception) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.119"), download.getName(), exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void downloadComplete(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.120"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void manifestDownloadStarted(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.121"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void manifestDownloadFailed(FreenetFile download, Exception exception) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.122"), download.getName(), exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void manifestDownloadComplete(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.123"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void blockDownloadStarted(FreenetFile download, int blockNumber) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.124"), download.getName() + Messages.getString("MainFrame.125") + blockNumber); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void blockDownloadFailed(FreenetFile download, int blockNumber, Exception exception) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.126"), download.getName() + Messages.getString("MainFrame.127") + blockNumber, exception); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void blockDownloadComplete(FreenetFile download, int blockNumber) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.128"), download.getName() + Messages.getString("MainFrame.129") + blockNumber); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void loadDownloadsStarted(String tempDir) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.130"), tempDir); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void loadDownloadsFailed(String tempDir, Exception exception) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.131"), tempDir, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void loadDownloadsComplete(String tempDir) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.132"), tempDir); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void loadDownloadStarted(String filename) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.133"), filename); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void loadDownloadFailed(String filename, Exception exception) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.134"), filename, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void loadDownloadComplete(String filename, FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.135"), filename + ", " + download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void saveDownloadsStarted(String tempDir) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.137"), tempDir); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void saveDownloadsFailed(String tempDir, Exception exception) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.138"), tempDir, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void saveDownloadsComplete(String tempDir) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.139"), tempDir); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void saveDownloadStarted(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.140"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void saveDownloadFailed(FreenetFile download, Exception exception) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.141"), download.getName(), exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void saveDownloadComplete(FreenetFile download) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.142"), download.getName()); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void saveBlockStarted(FreenetFile download, int blockNumber) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.143"), download.getName() + Messages.getString("MainFrame.144") + blockNumber); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void saveBlockFailed(FreenetFile download, int blockNumber, Exception exception) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.145"), download.getName() + Messages.getString("MainFrame.146") + blockNumber, exception); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void saveBlockComplete(FreenetFile download, int blockNumber) {
logMessage(DownloadService.NAME, Messages.getString("MainFrame.147"), download.getName() + Messages.getString("MainFrame.148") + blockNumber); //$NON-NLS-1$ //$NON-NLS-2$
}
//
// INTERFACE UploadRequestListener
//
/**
* {@inheritDoc}
*/
public void uploadRequestInsertStarted(String key) {
logMessage(UploadRequestInsertService.NAME, Messages.getString("MainFrame.149"), key); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void uploadRequestInsertFailed(String key, Exception exception) {
logMessage(UploadRequestInsertService.NAME, Messages.getString("MainFrame.150"), key, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void uploadRequestInsertComplete(String key) {
logMessage(UploadRequestInsertService.NAME, Messages.getString("MainFrame.151"), key); //$NON-NLS-1$
}
//
// INTERFACE UploadRequestDiscoveryListener
/**
* {@inheritDoc}
*/
public void uploadRequestDiscoveryStarted(String key) {
logMessage(UploadRequestDiscoveryService.NAME, Messages.getString("MainFrame.152"), key); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void uploadRequestDiscoveryFailed(String key, Exception exception) {
logMessage(UploadRequestDiscoveryService.NAME, Messages.getString("MainFrame.153"), key, exception); //$NON-NLS-1$
}
/**
* {@inheritDoc}
*/
public void uploadRequestDiscoveryComplete(String key, UploadRequest uploadRequest) {
logMessage(UploadRequestDiscoveryService.NAME, Messages.getString("MainFrame.154"), key + Messages.getString("MainFrame.155") + uploadRequest.size()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void uploadRequestDiscoverNewIndexFound(int index) {
}
//
// INTERFACE DiscoveryListener
//
/**
* {@inheritDoc}
*/
public void discoveryStarted(String key) {
logMessage(DiscoveryService.NAME, Messages.