1 /*
2 * XNap - A P2P framework and client.
3 *
4 * See the file AUTHORS for copyright information.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 package org.xnap.plugin.stats;
21
22 import org.apache.log4j.Logger;
23 import org.xnap.gui.XNapFrame;
24 import org.xnap.gui.util.IconHelper;
25 import org.xnap.plugin.AbstractPlugin;
26
27 /***
28 * Provides a plugin displaying various application statistics
29 */
30 public class StatsPlugin extends AbstractPlugin
31 {
32 //--- Constant(s) ---
33
34 public static String ICON_FILENAME = "list.png";
35
36 //--- Data field(s) ---
37
38 private static Logger logger = Logger.getLogger(StatsPlugin.class);
39 // private static Preferences prefs = Preferences.getInstance();
40 private static StatsPlugin instance;
41 private StatsPanel statsPanel;
42
43 //--- Constructor(s) ---
44
45 public StatsPlugin()
46 {
47
48 }
49
50 //--- Method(s) ---
51
52 public static StatsPlugin getInstance()
53 {
54 return instance;
55 }
56
57 /***
58 * Starts the plugin.
59 */
60 public void start()
61 {
62 instance = this;
63 }
64
65 /***
66 * Starts the GUI of the plugin.
67 */
68 public void startGUI()
69 {
70 statsPanel = new StatsPanel();
71 XNapFrame.getInstance().insertTab
72 (getInfo().getName(), IconHelper.getListIcon(ICON_FILENAME),
73 statsPanel);
74
75 // pdl = new PreferencesDialogListener();
76 // PreferencesDialog.addDialogListener(pdl);
77 }
78
79 /***
80 * Stops the plugin. Disposes all singletons.
81 */
82 public void stop()
83 {
84 }
85
86 /***
87 * Stops the GUI of the plugin.
88 */
89 public void stopGUI()
90 {
91 // pdl.dispose();
92 // PreferencesDialog.removeDialogListener(pdl);
93 // pdl = null;
94
95 statsPanel.stop();
96
97 // dispose gui
98 XNapFrame.getInstance().removeTab(statsPanel);
99 statsPanel = null;
100 }
101
102 // --- Inner Class(es) ---
103
104 // private class PreferencesDialogListener
105 // extends AbstractPreferencesDialogListener
106 // {
107
108 // public void addPanels(PreferencesDialog dialog, List panels)
109 // {
110 // LimeWirePreferencesPanel jpp = new LimeWirePreferencesPanel();
111 // panels.add(jpp);
112 // panels.add(dialog.addPanel(jpp, ICON_FILENAME));
113 // }
114
115 // }
116
117 }
118
119
120