KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SnowMailClient > view > actions > ViewServerLog


1 package SnowMailClient.view.actions;
2
3 import SnowMailClient.MailEngine.*;
4 import SnowMailClient.*;
5 import SnowMailClient.model.*;
6 import SnowMailClient.model.accounts.*;
7 import SnowMailClient.view.*;
8 import snow.utils.gui.*;
9
10 import SnowMailClient.view.dialogs.*;
11 import SnowMailClient.Language.Language;
12 import snow.lookandfeel.*;
13
14 import java.awt.*;
15 import java.awt.event.*;
16 import javax.swing.*;
17
18
19 /**
20 */

21 public class ViewServerLog extends AbstractAction
22 {
23    MailAccount account;
24    JDialog ref;
25
26    public ViewServerLog(JDialog ref, MailAccount account)
27    {
28        super(Language.translate("View server log"));
29        this.account = account;
30        this.ref= ref;
31
32        putValue(AbstractAction.SMALL_ICON, SnowMailClientApp.loadImageIcon("pics/log.PNG"));
33        putValue(AbstractAction.ACCELERATOR_KEY,
34                  KeyStroke.getKeyStroke( KeyEvent.VK_E,
35                                          KeyEvent.CTRL_MASK ) );
36    }
37
38    public void actionPerformed(ActionEvent actionEvent)
39    {
40       JDialog dialog = new JDialog( ref,
41         Language.translate("Log of server %",account.getAddress()), false);
42       dialog.getContentPane().setLayout(new BorderLayout());
43       JTextPane textPane= new JTextPane();
44       final AccountLog log = new AccountLog();
45       textPane.setDocument(log.doc);
46       dialog.getContentPane().add(new JScrollPane(textPane), BorderLayout.CENTER);
47
48       try
49       {
50         account.getCheckedPopConnection().getServerLogFile(log);
51       }
52       catch(Exception JavaDoc e)
53       {
54         log.appendError(Language.translate("Error")+":\n "+e.getMessage());
55       }
56
57
58       CloseControlPanel ccp = new CloseControlPanel(dialog, false, true, Language.translate("Close"));
59       dialog.getContentPane().add(ccp, BorderLayout.SOUTH);
60
61       dialog.setSize(ThemesManager.getLabelFontSize()*40, ThemesManager.getLabelFontSize()*35);
62       SnowMailClientApp.centerComponentOnMainFrame(dialog);
63
64       dialog.setVisible(true);
65    }
66
67 } // ViewServerLog
Popular Tags