瀏覽代碼

Even more UI Abstraction

git-svn-id: http://svn.dmdirc.com/trunk@1764 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5
Gregory Holmes 17 年之前
父節點
當前提交
322260d4d1
共有 33 個檔案被更改,包括 310 行新增202 行删除
  1. 2
    1
      src/com/dmdirc/ui/ChannelFrame.java
  2. 12
    34
      src/com/dmdirc/ui/MainFrame.java
  3. 23
    6
      src/com/dmdirc/ui/SwingController.java
  4. 2
    2
      src/com/dmdirc/ui/components/ColourPickerDialog.java
  5. 9
    9
      src/com/dmdirc/ui/components/Frame.java
  6. 3
    3
      src/com/dmdirc/ui/components/SearchBar.java
  7. 3
    4
      src/com/dmdirc/ui/components/SwingPreferencesPanel.java
  8. 16
    54
      src/com/dmdirc/ui/components/SwingStatusBar.java
  9. 3
    3
      src/com/dmdirc/ui/dialogs/ActionsManagerDialog.java
  10. 6
    5
      src/com/dmdirc/ui/dialogs/NewServerDialog.java
  11. 4
    3
      src/com/dmdirc/ui/dialogs/PasteDialog.java
  12. 3
    3
      src/com/dmdirc/ui/dialogs/PluginDialog.java
  13. 3
    3
      src/com/dmdirc/ui/dialogs/ProfileEditorDialog.java
  14. 21
    18
      src/com/dmdirc/ui/dialogs/SwingUpdaterDialog.java
  15. 3
    3
      src/com/dmdirc/ui/dialogs/about/AboutDialog.java
  16. 3
    3
      src/com/dmdirc/ui/dialogs/actionseditor/ActionsEditorDialog.java
  17. 3
    3
      src/com/dmdirc/ui/dialogs/actionseditor/ConditionEditorDialog.java
  18. 3
    3
      src/com/dmdirc/ui/dialogs/channelsetting/ChannelSettingsDialog.java
  19. 2
    2
      src/com/dmdirc/ui/dialogs/error/ErrorListDialog.java
  20. 2
    2
      src/com/dmdirc/ui/dialogs/error/FatalErrorDialog.java
  21. 3
    3
      src/com/dmdirc/ui/dialogs/serversetting/ServerSettingsDialog.java
  22. 3
    3
      src/com/dmdirc/ui/dialogs/wizard/WizardDialog.java
  23. 14
    13
      src/com/dmdirc/ui/framemanager/DummyFrameManager.java
  24. 1
    0
      src/com/dmdirc/ui/framemanager/MainFrameManager.java
  25. 4
    4
      src/com/dmdirc/ui/framemanager/buttonbar/ButtonBar.java
  26. 1
    1
      src/com/dmdirc/ui/framemanager/tree/TreeFrameManager.java
  27. 4
    3
      src/com/dmdirc/ui/framemanager/windowmenu/WindowMenuFrameManager.java
  28. 1
    1
      src/com/dmdirc/ui/interfaces/FrameManager.java
  29. 1
    1
      src/com/dmdirc/ui/interfaces/FramemanagerPosition.java
  30. 104
    0
      src/com/dmdirc/ui/interfaces/StatusBar.java
  31. 11
    2
      src/com/dmdirc/ui/interfaces/UIController.java
  32. 32
    0
      src/com/dmdirc/ui/interfaces/UpdaterDialog.java
  33. 5
    7
      src/com/dmdirc/updater/UpdateChecker.java

+ 2
- 1
src/com/dmdirc/ui/ChannelFrame.java 查看文件

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.ui;
24 24
 
25 25
 import com.dmdirc.Channel;
26
+import com.dmdirc.Main;
26 27
 import com.dmdirc.commandparser.ChannelCommand;
27 28
 import com.dmdirc.commandparser.ChannelCommandParser;
28 29
 import com.dmdirc.commandparser.Command;
@@ -209,7 +210,7 @@ public final class ChannelFrame extends InputFrame implements MouseListener,
209 210
         nickScrollPane.setViewportView(nickList);
210 211
         
211 212
         nickScrollPane.setMinimumSize(new Dimension(150, 10));
212
-        getTextPane().setPreferredSize(new Dimension(MainFrame.getMainFrame().getWidth(), 10));
213
+        getTextPane().setPreferredSize(new Dimension(Main.getUI().getMainWindow().getWidth(), 10));
213 214
         
214 215
         panel.add(getSearchBar(), BorderLayout.PAGE_START);
215 216
         panel.add(inputPanel, BorderLayout.PAGE_END);

+ 12
- 34
src/com/dmdirc/ui/MainFrame.java 查看文件

@@ -32,19 +32,20 @@ import com.dmdirc.actions.CoreActionType;
32 32
 import com.dmdirc.logger.ErrorLevel;
33 33
 import com.dmdirc.logger.Logger;
34 34
 import com.dmdirc.ui.components.Frame;
35
-import com.dmdirc.ui.components.StatusBar;
35
+import com.dmdirc.ui.components.SwingStatusBar;
36 36
 import com.dmdirc.ui.dialogs.ActionsManagerDialog;
37 37
 import com.dmdirc.ui.dialogs.NewServerDialog;
38 38
 import com.dmdirc.ui.dialogs.PluginDialog;
39 39
 import com.dmdirc.ui.dialogs.PreferencesDialog;
40 40
 import com.dmdirc.ui.dialogs.ProfileEditorDialog;
41 41
 import com.dmdirc.ui.dialogs.about.AboutDialog;
42
-import com.dmdirc.ui.framemanager.FrameManager;
43
-import com.dmdirc.ui.framemanager.FramemanagerPosition;
42
+import com.dmdirc.ui.interfaces.FrameManager;
43
+import com.dmdirc.ui.interfaces.FramemanagerPosition;
44 44
 import com.dmdirc.ui.framemanager.MainFrameManager;
45 45
 import com.dmdirc.ui.framemanager.windowmenu.WindowMenuFrameManager;
46 46
 import com.dmdirc.ui.interfaces.Window;
47 47
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
48
+import com.dmdirc.ui.interfaces.StatusBar;
48 49
 
49 50
 import java.awt.BorderLayout;
50 51
 import java.awt.Color;
@@ -100,10 +101,6 @@ public final class MainFrame extends JFrame implements WindowListener,
100 101
      */
101 102
     private static final int FRAME_OPENING_OFFSET = 30;
102 103
     
103
-    /**
104
-     * Singleton instance of MainFrame.
105
-     */
106
-    private static MainFrame me;
107 104
     /**
108 105
      * Whether the internal frames are maximised or not.
109 106
      */
@@ -153,7 +150,7 @@ public final class MainFrame extends JFrame implements WindowListener,
153 150
     private JMenuItem toggleStateMenuItem;
154 151
     
155 152
     /** status bar. */
156
-    private StatusBar statusBar;
153
+    private SwingStatusBar statusBar;
157 154
     
158 155
     /** Frame manager position. */
159 156
     private FramemanagerPosition position;
@@ -161,7 +158,7 @@ public final class MainFrame extends JFrame implements WindowListener,
161 158
     /**
162 159
      * Creates new form MainFrame.
163 160
      */
164
-    private MainFrame() {
161
+    protected MainFrame() {
165 162
         super();
166 163
         
167 164
         windowListFrameManager = new WindowMenuFrameManager();
@@ -223,25 +220,6 @@ public final class MainFrame extends JFrame implements WindowListener,
223 220
         checkWindowState();
224 221
     }
225 222
     
226
-    /**
227
-     * Returns the singleton instance of MainFrame.
228
-     * @return MainFrame instance
229
-     */
230
-    public static synchronized MainFrame getMainFrame() {
231
-        if (me == null) {
232
-            me = new MainFrame();
233
-        }
234
-        return me;
235
-    }
236
-    
237
-    /**
238
-     * Indicates whether the main frame has been initialised or not.
239
-     * @return True iff the main frame exists
240
-     */
241
-    public static boolean hasMainFrame() {
242
-        return me != null;
243
-    }
244
-    
245 223
     /**
246 224
      * Adds the specified window as a child of the main frame.
247 225
      *
@@ -443,8 +421,8 @@ public final class MainFrame extends JFrame implements WindowListener,
443 421
     
444 422
     /**
445 423
      * Returns the status bar instance.
446
-     *
447
-     * @return StatusBar instance
424
+     * 
425
+     * @return SwingStatusBar instance
448 426
      */
449 427
     public StatusBar getStatusBar() {
450 428
         return statusBar;
@@ -499,7 +477,7 @@ public final class MainFrame extends JFrame implements WindowListener,
499 477
         frameManagerPanel = new JPanel();
500 478
         desktopPane = new JDesktopPane();
501 479
         desktopPane.setBackground(new Color(238, 238, 238));
502
-        statusBar = new StatusBar();
480
+        statusBar = new SwingStatusBar();
503 481
         
504 482
         initSplitPane(mainSplitPane);
505 483
         
@@ -792,7 +770,7 @@ public final class MainFrame extends JFrame implements WindowListener,
792 770
     /** Quits the client. */
793 771
     public void quit() {
794 772
         Config.setOption("ui", "frameManagerSize",
795
-                String.valueOf(MainFrame.getMainFrame().getFrameManagerSize()));
773
+                String.valueOf(this.getFrameManagerSize()));
796 774
         Main.quit();
797 775
     }
798 776
     
@@ -811,9 +789,9 @@ public final class MainFrame extends JFrame implements WindowListener,
811 789
         } else if (e.getActionCommand().equals("Actions")) {
812 790
             ActionsManagerDialog.showActionsManagerDialog();
813 791
         } else if (e.getActionCommand().equals("Minimise")) {
814
-            ((Frame) MainFrame.getMainFrame().getActiveFrame()).minimise();
792
+            ((Frame) Main.getUI().getMainWindow().getActiveFrame()).minimise();
815 793
         } else if (e.getActionCommand().equals("Close")) {
816
-            ((Frame) MainFrame.getMainFrame().getActiveFrame()).close();
794
+            ((Frame) Main.getUI().getMainWindow().getActiveFrame()).close();
817 795
         }
818 796
     }
819 797
 }

+ 23
- 6
src/com/dmdirc/ui/SwingController.java 查看文件

@@ -32,20 +32,24 @@ import com.dmdirc.commandparser.CommandParser;
32 32
 import com.dmdirc.logger.ErrorLevel;
33 33
 import com.dmdirc.logger.Logger;
34 34
 import com.dmdirc.ui.components.SwingPreferencesPanel;
35
-import com.dmdirc.ui.components.StatusBar;
36
-import com.dmdirc.ui.framemanager.FrameManager;
35
+import com.dmdirc.ui.dialogs.SwingUpdaterDialog;
36
+import com.dmdirc.ui.interfaces.FrameManager;
37 37
 import com.dmdirc.ui.interfaces.ChannelWindow;
38 38
 import com.dmdirc.ui.interfaces.InputWindow;
39 39
 import com.dmdirc.ui.interfaces.PreferencesInterface;
40 40
 import com.dmdirc.ui.interfaces.PreferencesPanel;
41 41
 import com.dmdirc.ui.interfaces.QueryWindow;
42 42
 import com.dmdirc.ui.interfaces.ServerWindow;
43
+import com.dmdirc.ui.interfaces.StatusBar;
43 44
 import com.dmdirc.ui.interfaces.UIController;
45
+import com.dmdirc.ui.interfaces.UpdaterDialog;
46
+import com.dmdirc.updater.Update;
44 47
 
45 48
 import java.awt.Color;
46 49
 import java.awt.Font;
47 50
 import java.awt.Insets;
48 51
 import java.awt.Toolkit;
52
+import java.util.List;
49 53
 import javax.swing.BorderFactory;
50 54
 import javax.swing.UIManager;
51 55
 import javax.swing.UIManager.LookAndFeelInfo;
@@ -59,19 +63,27 @@ import javax.swing.plaf.FontUIResource;
59 63
  */
60 64
 public class SwingController implements UIController {
61 65
     
66
+    /**
67
+     * Singleton instance of MainFrame.
68
+     */
69
+    private static MainFrame me;
70
+    
62 71
     /** {@inheritDoc} */
63
-    public MainFrame getMainWindow() {
64
-        return MainFrame.getMainFrame();
72
+    public synchronized MainFrame getMainWindow() {
73
+        if (me == null) {
74
+            me = new MainFrame();
75
+        }
76
+        return me;
65 77
     }
66 78
     
67 79
     /** {@inheritDoc} */
68 80
     public StatusBar getStatusBar() {
69
-        return MainFrame.getMainFrame().getStatusBar();
81
+        return getMainWindow().getStatusBar();
70 82
     }
71 83
     
72 84
     /** {@inheritDoc} */
73 85
     public FrameManager getFrameManager() {
74
-        return MainFrame.getMainFrame().getFrameManager();
86
+        return getMainWindow().getFrameManager();
75 87
     }
76 88
     
77 89
     /** {@inheritDoc} */
@@ -101,6 +113,11 @@ public class SwingController implements UIController {
101 113
         return new SwingPreferencesPanel(parent, title);
102 114
     }
103 115
     
116
+    /** {@inheritDoc} */
117
+    public UpdaterDialog getUpdaterDialog(final List<Update> updates) {
118
+        return new SwingUpdaterDialog(updates);
119
+    }
120
+    
104 121
     /** {@inheritDoc} */
105 122
     public void initUISettings() {
106 123
         // For this to work it *HAS* to be before anything else UI related.

+ 2
- 2
src/com/dmdirc/ui/components/ColourPickerDialog.java 查看文件

@@ -22,7 +22,7 @@
22 22
 
23 23
 package com.dmdirc.ui.components;
24 24
 
25
-import com.dmdirc.ui.MainFrame;
25
+import com.dmdirc.Main;
26 26
 
27 27
 import java.awt.event.ActionListener;
28 28
 
@@ -56,7 +56,7 @@ public final class ColourPickerDialog extends StandardDialog {
56 56
      * @param showHex show hex colours
57 57
      */
58 58
     public ColourPickerDialog(final boolean showIRC, final boolean showHex) {
59
-        super(MainFrame.getMainFrame(), false);
59
+        super(Main.getUI().getMainWindow(), false);
60 60
         
61 61
         colourChooser = new ColourPickerPanel(showIRC, showHex);
62 62
         this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

+ 9
- 9
src/com/dmdirc/ui/components/Frame.java 查看文件

@@ -25,11 +25,11 @@ package com.dmdirc.ui.components;
25 25
 import com.dmdirc.BrowserLauncher;
26 26
 import com.dmdirc.Config;
27 27
 import com.dmdirc.FrameContainer;
28
+import com.dmdirc.Main;
28 29
 import com.dmdirc.config.ConfigChangeListener;
29 30
 import com.dmdirc.config.ConfigManager;
30 31
 import com.dmdirc.logger.ErrorLevel;
31 32
 import com.dmdirc.logger.Logger;
32
-import com.dmdirc.ui.MainFrame;
33 33
 import com.dmdirc.ui.interfaces.Window;
34 34
 import com.dmdirc.ui.messages.Formatter;
35 35
 import com.dmdirc.ui.messages.Styliser;
@@ -112,15 +112,15 @@ public abstract class Frame extends JInternalFrame implements Window,
112 112
         super();
113 113
         parent = owner;
114 114
         
115
-        setFrameIcon(MainFrame.getMainFrame().getIcon());
115
+        setFrameIcon(Main.getUI().getMainWindow().getIcon());
116 116
         
117 117
         initComponents();
118 118
         setMaximizable(true);
119 119
         setClosable(true);
120 120
         setResizable(true);
121 121
         setIconifiable(true);
122
-        setPreferredSize(new Dimension(MainFrame.getMainFrame().getWidth() / 2,
123
-                MainFrame.getMainFrame().getHeight() / 3));
122
+        setPreferredSize(new Dimension(Main.getUI().getMainWindow().getWidth() / 2,
123
+                Main.getUI().getMainWindow().getHeight() / 3));
124 124
         
125 125
         addPropertyChangeListener("maximum", this);
126 126
         addInternalFrameListener(this);
@@ -134,7 +134,7 @@ public abstract class Frame extends JInternalFrame implements Window,
134 134
         config.addChangeListener("ui", "backgroundcolour", this);
135 135
         
136 136
         final Boolean pref = Config.getOptionBool("ui", "maximisewindows");
137
-        if (pref || MainFrame.getMainFrame().getMaximised()) {
137
+        if (pref || Main.getUI().getMainWindow().getMaximised()) {
138 138
             hideTitlebar();
139 139
         }
140 140
     }
@@ -221,12 +221,12 @@ public abstract class Frame extends JInternalFrame implements Window,
221 221
     public final void propertyChange(final PropertyChangeEvent event) {
222 222
         if (event.getNewValue().equals(Boolean.TRUE)) {
223 223
             hideTitlebar();
224
-            MainFrame.getMainFrame().setMaximised(true);
224
+            Main.getUI().getMainWindow().setMaximised(true);
225 225
         } else {
226 226
             showTitlebar();
227 227
             
228
-            MainFrame.getMainFrame().setMaximised(false);
229
-            MainFrame.getMainFrame().setActiveFrame(this);
228
+            Main.getUI().getMainWindow().setMaximised(false);
229
+            Main.getUI().getMainWindow().setActiveFrame(this);
230 230
         }
231 231
     }
232 232
     
@@ -507,7 +507,7 @@ public abstract class Frame extends JInternalFrame implements Window,
507 507
     
508 508
     /** {@inheritDoc} */
509 509
     public void hyperlinkClicked(final String url) {
510
-        MainFrame.getMainFrame().getStatusBar().setMessage("Opening: " + url);
510
+        Main.getUI().getMainWindow().getStatusBar().setMessage("Opening: " + url);
511 511
         BrowserLauncher.openURL(url);
512 512
     }
513 513
     

+ 3
- 3
src/com/dmdirc/ui/components/SearchBar.java 查看文件

@@ -23,7 +23,7 @@
23 23
 package com.dmdirc.ui.components;
24 24
 
25 25
 import com.dmdirc.IconManager;
26
-import com.dmdirc.ui.MainFrame;
26
+import com.dmdirc.Main;
27 27
 import com.dmdirc.ui.messages.ColourManager;
28 28
 import com.dmdirc.ui.textpane.TextPane;
29 29
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
@@ -297,7 +297,7 @@ public final class SearchBar extends JPanel implements ActionListener,
297 297
         }
298 298
         
299 299
         //want to continue?
300
-        if (JOptionPane.showConfirmDialog(MainFrame.getMainFrame(),
300
+        if (JOptionPane.showConfirmDialog(Main.getUI().getMainWindow(),
301 301
                 "Do you want to continue searching from the end?",
302 302
                 "Beginning reached", JOptionPane.OK_CANCEL_OPTION,
303 303
                 JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
@@ -363,7 +363,7 @@ public final class SearchBar extends JPanel implements ActionListener,
363 363
         }
364 364
         
365 365
         //want to continue?
366
-        if (JOptionPane.showConfirmDialog(MainFrame.getMainFrame(),
366
+        if (JOptionPane.showConfirmDialog(Main.getUI().getMainWindow(),
367 367
                 "Do you want to continue searching from the beginning?",
368 368
                 "End reached", JOptionPane.OK_CANCEL_OPTION,
369 369
                 JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {

+ 3
- 4
src/com/dmdirc/ui/components/SwingPreferencesPanel.java 查看文件

@@ -23,12 +23,12 @@
23 23
 package com.dmdirc.ui.components;
24 24
 
25 25
 import com.dmdirc.Config;
26
+import com.dmdirc.Main;
26 27
 import com.dmdirc.logger.ErrorLevel;
27 28
 import com.dmdirc.logger.Logger;
28 29
 import com.dmdirc.ui.interfaces.PreferencesInterface;
29 30
 import com.dmdirc.ui.interfaces.PreferencesPanel;
30 31
 import com.dmdirc.ui.interfaces.PreferencesPanel.OptionType;
31
-import com.dmdirc.ui.MainFrame;
32 32
 import static com.dmdirc.ui.UIUtilities.LARGE_BORDER;
33 33
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
34 34
 import static com.dmdirc.ui.UIUtilities.layoutGrid;
@@ -66,7 +66,6 @@ import javax.swing.event.TreeSelectionEvent;
66 66
 import javax.swing.event.TreeSelectionListener;
67 67
 import javax.swing.text.Position;
68 68
 import javax.swing.tree.DefaultMutableTreeNode;
69
-import javax.swing.tree.DefaultTreeCellRenderer;
70 69
 import javax.swing.tree.DefaultTreeModel;
71 70
 import javax.swing.tree.TreeCellRenderer;
72 71
 import javax.swing.tree.TreePath;
@@ -144,7 +143,7 @@ public final class SwingPreferencesPanel extends StandardDialog implements
144 143
      */
145 144
     public SwingPreferencesPanel(final PreferencesInterface preferencesOwner,
146 145
             final String title) {
147
-        super(MainFrame.getMainFrame(), false);
146
+        super(Main.getUI().getMainWindow(), false);
148 147
         
149 148
         windowTitle = title;
150 149
         
@@ -533,7 +532,7 @@ public final class SwingPreferencesPanel extends StandardDialog implements
533 532
                     tabName, 0, Position.Bias.Forward));
534 533
         }
535 534
         pack();
536
-        setLocationRelativeTo(MainFrame.getMainFrame());
535
+        setLocationRelativeTo(Main.getUI().getMainWindow());
537 536
         this.setVisible(true);
538 537
     }
539 538
     

src/com/dmdirc/ui/components/StatusBar.java → src/com/dmdirc/ui/components/SwingStatusBar.java 查看文件

@@ -31,6 +31,7 @@ import com.dmdirc.ui.dialogs.error.ErrorListDialog;
31 31
 import com.dmdirc.ui.interfaces.StatusErrorNotifier;
32 32
 import com.dmdirc.ui.interfaces.StatusMessageNotifier;
33 33
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
34
+import com.dmdirc.ui.interfaces.StatusBar;
34 35
 
35 36
 import java.awt.Component;
36 37
 import java.awt.Dimension;
@@ -50,8 +51,8 @@ import javax.swing.SpringLayout;
50 51
 /**
51 52
  * Status bar, shows message and info on the gui.
52 53
  */
53
-public final class StatusBar extends JPanel implements MouseListener,
54
-        ErrorListener {
54
+public final class SwingStatusBar extends JPanel implements MouseListener,
55
+        ErrorListener, StatusBar {
55 56
     
56 57
     /**
57 58
      * A version number for this class. It should be changed whenever the class
@@ -81,8 +82,10 @@ public final class StatusBar extends JPanel implements MouseListener,
81 82
     /** Timer to clear the message. */
82 83
     private transient TimerTask messageTimer;
83 84
     
84
-    /** Creates a new instance of StatusBar. */
85
-    public StatusBar() {
85
+    /**
86
+     * Creates a new instance of SwingStatusBar.
87
+     */
88
+    public SwingStatusBar() {
86 89
         super();
87 90
         final SpringLayout layout = new SpringLayout();
88 91
         
@@ -115,29 +118,14 @@ public final class StatusBar extends JPanel implements MouseListener,
115 118
         layoutBar();
116 119
     }
117 120
     
118
-    /**
119
-     * Sets the message in the status bar with a specified callback event
120
-     * using the default timeout.
121
-     *
122
-     * @param newMessage Message to display
123
-     * @param newNotifier status message notifier to be notified for events on
124
-     * this message
125
-     */
121
+    /** {@inheritDoc} */
126 122
     public void setMessage(final String newMessage,
127 123
             final StatusMessageNotifier newNotifier) {
128 124
         final int timeout = Config.getOptionInt("statusBar", "messageDisplayLength", 5);
129 125
         setMessage(newMessage, newNotifier, timeout);
130 126
     }
131 127
     
132
-    /**
133
-     * Sets the message in the status bar with a specified callback event for
134
-     * a specified time.
135
-     *
136
-     * @param newMessage Message to display
137
-     * @param newNotifier status message notifier to be notified for events on
138
-     * this message
139
-     * @param timeout message timeout in seconds
140
-     */
128
+    /** {@inheritDoc} */
141 129
     public synchronized void setMessage(final String newMessage,
142 130
             final StatusMessageNotifier newNotifier, final int timeout) {
143 131
         messageLabel.setText(newMessage);
@@ -156,29 +144,17 @@ public final class StatusBar extends JPanel implements MouseListener,
156 144
                 new Date(System.currentTimeMillis() + 250 + timeout * 1000L));
157 145
     }
158 146
     
159
-    /**
160
-     * sets the message in the status bar.
161
-     *
162
-     * @param newMessage Message to display
163
-     */
147
+    /** {@inheritDoc} */
164 148
     public void setMessage(final String newMessage) {
165 149
         setMessage(newMessage, null);
166 150
     }
167 151
     
168
-    /**
169
-     * Removes the message from the status bar.
170
-     */
152
+    /** {@inheritDoc} */
171 153
     public void clearMessage() {
172 154
         setMessage("Ready.");
173 155
     }
174 156
     
175
-    /**
176
-     * sets the icon in the status bar with a specified callback event.
177
-     *
178
-     * @param newIcon Icon to display
179
-     * @param newNotifier status error notifier to be notified for events on
180
-     * this error
181
-     */
157
+    /** {@inheritDoc} */
182 158
     public synchronized void setError(final Icon newIcon,
183 159
             final StatusErrorNotifier newNotifier) {
184 160
         //Add to list
@@ -200,18 +176,12 @@ public final class StatusBar extends JPanel implements MouseListener,
200 176
                 new Date(System.currentTimeMillis() + 250  + displayLength));
201 177
     }
202 178
     
203
-    /**
204
-     * sets the icon in the status bar.
205
-     *
206
-     * @param newIcon Icon to display
207
-     */
179
+    /** {@inheritDoc} */
208 180
     public void setError(final Icon newIcon) {
209 181
         setError(newIcon, null);
210 182
     }
211 183
     
212
-    /**
213
-     * Removes the error state from the status bar.
214
-     */
184
+    /** {@inheritDoc} */
215 185
     public void clearError() {
216 186
         setError(normalIcon);
217 187
     }
@@ -279,11 +249,7 @@ public final class StatusBar extends JPanel implements MouseListener,
279 249
         }
280 250
     }
281 251
     
282
-    /**
283
-     * Adds a component to the status bar.
284
-     *
285
-     * @param component component to add
286
-     */
252
+    /** {@inheritDoc} */
287 253
     public void addComponent(final Component component) {
288 254
         remove(iconLabel);
289 255
         add(component);
@@ -291,11 +257,7 @@ public final class StatusBar extends JPanel implements MouseListener,
291 257
         layoutBar();
292 258
     }
293 259
     
294
-    /**
295
-     * Removes a component to the status bar.
296
-     *
297
-     * @param component component to add
298
-     */
260
+    /** {@inheritDoc} */
299 261
     public void removeComponent(final Component component) {
300 262
         remove(component);
301 263
         layoutBar();

+ 3
- 3
src/com/dmdirc/ui/dialogs/ActionsManagerDialog.java 查看文件

@@ -22,9 +22,9 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs;
24 24
 
25
+import com.dmdirc.Main;
25 26
 import com.dmdirc.actions.Action;
26 27
 import com.dmdirc.actions.ActionManager;
27
-import com.dmdirc.ui.MainFrame;
28 28
 import com.dmdirc.ui.components.ActionsGroupPanel;
29 29
 import com.dmdirc.ui.components.StandardDialog;
30 30
 import com.dmdirc.ui.dialogs.actionseditor.ActionsEditorDialog;
@@ -87,14 +87,14 @@ public final class ActionsManagerDialog extends StandardDialog
87 87
     
88 88
     /** Creates a new instance of ActionsManagerDialog. */
89 89
     private ActionsManagerDialog() {
90
-        super(MainFrame.getMainFrame(), false);
90
+        super(Main.getUI().getMainWindow(), false);
91 91
         
92 92
         initComponents();
93 93
         
94 94
         setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
95 95
         setTitle("Action Manager");
96 96
         setResizable(false);
97
-        setLocationRelativeTo(MainFrame.getMainFrame());
97
+        setLocationRelativeTo(Main.getUI().getMainWindow());
98 98
         setVisible(true);
99 99
     }
100 100
     

+ 6
- 5
src/com/dmdirc/ui/dialogs/NewServerDialog.java 查看文件

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.ui.dialogs;
24 24
 
25 25
 import com.dmdirc.Config;
26
+import com.dmdirc.Main;
26 27
 import com.dmdirc.Server;
27 28
 import com.dmdirc.ServerManager;
28 29
 import com.dmdirc.config.Identity;
@@ -122,7 +123,7 @@ public final class NewServerDialog extends StandardDialog {
122 123
      * Creates a new instance of the dialog.
123 124
      */
124 125
     private NewServerDialog() {
125
-        super(MainFrame.getMainFrame(), false);
126
+        super(Main.getUI().getMainWindow(), false);
126 127
         
127 128
         initComponents();
128 129
         
@@ -147,7 +148,7 @@ public final class NewServerDialog extends StandardDialog {
147 148
         me.serverField.requestFocus();
148 149
         
149 150
         if (ServerManager.getServerManager().numServers() == 0
150
-                || MainFrame.getMainFrame().getActiveFrame() == null) {
151
+                || Main.getUI().getMainWindow().getActiveFrame() == null) {
151 152
             me.newServerWindowCheck.setSelected(true);
152 153
             me.newServerWindowCheck.setEnabled(false);
153 154
         } else {
@@ -156,7 +157,7 @@ public final class NewServerDialog extends StandardDialog {
156 157
         
157 158
         me.populateProfiles();
158 159
         
159
-        me.setLocationRelativeTo(MainFrame.getMainFrame());
160
+        me.setLocationRelativeTo(Main.getUI().getMainWindow());
160 161
         me.setVisible(true);
161 162
         me.requestFocus();
162 163
     }
@@ -201,11 +202,11 @@ public final class NewServerDialog extends StandardDialog {
201 202
                 // Open in a new window?
202 203
                 if (newServerWindowCheck.isSelected()
203 204
                 || ServerManager.getServerManager().numServers() == 0
204
-                        || MainFrame.getMainFrame().getActiveFrame() == null) {
205
+                        || Main.getUI().getMainWindow().getActiveFrame() == null) {
205 206
                     new Server(host, port, pass, sslCheck.isSelected(), profile);
206 207
                 } else {
207 208
                     final Window active =
208
-                            MainFrame.getMainFrame().getActiveFrame();
209
+                            Main.getUI().getMainWindow().getActiveFrame();
209 210
                     final Server server = ServerManager.getServerManager().
210 211
                             getServerFromFrame(active);
211 212
                     if (server == null) {

+ 4
- 3
src/com/dmdirc/ui/dialogs/PasteDialog.java 查看文件

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs;
24 24
 
25
+import com.dmdirc.Main;
25 26
 import com.dmdirc.ui.MainFrame;
26 27
 import com.dmdirc.ui.components.InputFrame;
27 28
 import com.dmdirc.ui.components.StandardDialog;
@@ -80,7 +81,7 @@ public final class PasteDialog extends StandardDialog implements ActionListener,
80 81
      * @param text text to show in the paste dialog
81 82
      */
82 83
     public PasteDialog(final InputFrame newParent, final String text) {
83
-        super(MainFrame.getMainFrame(), false);
84
+        super(Main.getUI().getMainWindow(), false);
84 85
         
85 86
         this.parent = newParent;
86 87
         
@@ -91,7 +92,7 @@ public final class PasteDialog extends StandardDialog implements ActionListener,
91 92
         getOkButton().requestFocus();
92 93
         getOkButton().setSelected(true);
93 94
         
94
-        setLocationRelativeTo(MainFrame.getMainFrame());
95
+        setLocationRelativeTo(Main.getUI().getMainWindow());
95 96
     }
96 97
     
97 98
     /**
@@ -241,7 +242,7 @@ public final class PasteDialog extends StandardDialog implements ActionListener,
241 242
                     + parent.getContainer().getNumLines(textField.getText())
242 243
                     + " lines.");
243 244
             pack();
244
-            setLocationRelativeTo(MainFrame.getMainFrame());
245
+            setLocationRelativeTo(Main.getUI().getMainWindow());
245 246
         } else if (getCancelButton().equals(actionEvent.getSource())) {
246 247
             this.dispose();
247 248
         }

+ 3
- 3
src/com/dmdirc/ui/dialogs/PluginDialog.java 查看文件

@@ -23,9 +23,9 @@
23 23
 package com.dmdirc.ui.dialogs;
24 24
 
25 25
 import com.dmdirc.BrowserLauncher;
26
+import com.dmdirc.Main;
26 27
 import com.dmdirc.plugins.Plugin;
27 28
 import com.dmdirc.plugins.PluginManager;
28
-import com.dmdirc.ui.MainFrame;
29 29
 import com.dmdirc.ui.components.PluginCellRenderer;
30 30
 import com.dmdirc.ui.components.StandardDialog;
31 31
 import static com.dmdirc.ui.UIUtilities.LARGE_BORDER;
@@ -94,7 +94,7 @@ public final class PluginDialog extends StandardDialog implements
94 94
     
95 95
     /** Creates a new instance of PluginDialog. */
96 96
     private PluginDialog() {
97
-        super(MainFrame.getMainFrame(), false);
97
+        super(Main.getUI().getMainWindow(), false);
98 98
         setResizable(false);
99 99
         initComponents();
100 100
         addListeners();
@@ -103,7 +103,7 @@ public final class PluginDialog extends StandardDialog implements
103 103
         pluginList.setSelectedIndex(0);
104 104
         selectedPlugin = 0;
105 105
         
106
-        this.setLocationRelativeTo(MainFrame.getMainFrame());
106
+        this.setLocationRelativeTo(Main.getUI().getMainWindow());
107 107
         this.setVisible(true);
108 108
     }
109 109
     

+ 3
- 3
src/com/dmdirc/ui/dialogs/ProfileEditorDialog.java 查看文件

@@ -22,9 +22,9 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs;
24 24
 
25
+import com.dmdirc.Main;
25 26
 import com.dmdirc.config.Identity;
26 27
 import com.dmdirc.config.IdentityManager;
27
-import com.dmdirc.ui.MainFrame;
28 28
 import com.dmdirc.ui.components.StandardDialog;
29 29
 import static com.dmdirc.ui.UIUtilities.LARGE_BORDER;
30 30
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
@@ -118,7 +118,7 @@ public final class ProfileEditorDialog extends StandardDialog implements
118 118
     
119 119
     /** Creates a new instance of ProfileEditorDialog. */
120 120
     private ProfileEditorDialog() {
121
-        super(MainFrame.getMainFrame(), false);
121
+        super(Main.getUI().getMainWindow(), false);
122 122
         
123 123
         profiles = IdentityManager.getProfiles();
124 124
         
@@ -128,7 +128,7 @@ public final class ProfileEditorDialog extends StandardDialog implements
128 128
         
129 129
         addCallbacks();
130 130
         
131
-        this.setLocationRelativeTo(MainFrame.getMainFrame());
131
+        this.setLocationRelativeTo(Main.getUI().getMainWindow());
132 132
         this.setVisible(true);
133 133
     }
134 134
     

src/com/dmdirc/ui/dialogs/UpdaterDialog.java → src/com/dmdirc/ui/dialogs/SwingUpdaterDialog.java 查看文件

@@ -22,11 +22,12 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs;
24 24
 
25
-import com.dmdirc.ui.MainFrame;
25
+import com.dmdirc.Main;
26 26
 import com.dmdirc.ui.components.StandardDialog;
27 27
 import com.dmdirc.updater.Update;
28 28
 import static com.dmdirc.ui.UIUtilities.LARGE_BORDER;
29 29
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
30
+import com.dmdirc.ui.interfaces.UpdaterDialog;
30 31
 
31 32
 import java.awt.BorderLayout;
32 33
 import java.awt.Dimension;
@@ -47,7 +48,8 @@ import javax.swing.WindowConstants;
47 48
  * and walks them through the process of downloading the update.
48 49
  * @author chris
49 50
  */
50
-public final class UpdaterDialog extends StandardDialog implements ActionListener {
51
+public final class SwingUpdaterDialog extends StandardDialog implements
52
+        ActionListener, UpdaterDialog {
51 53
     
52 54
     /**
53 55
      * A version number for this class. It should be changed whenever the class
@@ -57,17 +59,14 @@ public final class UpdaterDialog extends StandardDialog implements ActionListene
57 59
     private static final long serialVersionUID = 1;
58 60
     
59 61
     /** List of updates. */
60
-    private List<Update> updates;
61
-    
62
-    /** Update info header. */
63
-    private JLabel header;
62
+    private final List<Update> updates;
64 63
     
65 64
     /**
66 65
      * Creates a new instance of the updater dialog.
67 66
      * @param updates A list of updates that are available.
68 67
      */
69
-    public UpdaterDialog(final List<Update> updates) {
70
-        super(MainFrame.getMainFrame(), false);
68
+    public SwingUpdaterDialog(final List<Update> updates) {
69
+        super(Main.getUI().getMainWindow(), false);
71 70
         
72 71
         this.updates = updates;
73 72
         
@@ -77,8 +76,6 @@ public final class UpdaterDialog extends StandardDialog implements ActionListene
77 76
         getCancelButton().addActionListener(this);
78 77
         
79 78
         setTitle("Update available");
80
-        setLocationRelativeTo(MainFrame.getMainFrame());
81
-        setVisible(true);
82 79
     }
83 80
     
84 81
     /** Initialises the components. */
@@ -87,10 +84,10 @@ public final class UpdaterDialog extends StandardDialog implements ActionListene
87 84
         
88 85
         setLayout(new BorderLayout());
89 86
         
90
-        header = new JLabel("<html><big>Update Available</big><br><br>"
87
+        JLabel header = new JLabel("<html><big>Update Available</big><br><br>"
91 88
                 + "An update is available for one or more "
92 89
                 + "components of DMDirc:</html>");
93
-        header.setBorder(BorderFactory.createEmptyBorder(LARGE_BORDER, 
90
+        header.setBorder(BorderFactory.createEmptyBorder(LARGE_BORDER,
94 91
                 LARGE_BORDER, SMALL_BORDER, LARGE_BORDER));
95 92
         add(header, BorderLayout.NORTH);
96 93
         
@@ -114,7 +111,7 @@ public final class UpdaterDialog extends StandardDialog implements ActionListene
114 111
         
115 112
         final JScrollPane pane = new JScrollPane(table);
116 113
         pane.setBorder(BorderFactory.createCompoundBorder(
117
-                BorderFactory.createEmptyBorder(SMALL_BORDER, LARGE_BORDER, 
114
+                BorderFactory.createEmptyBorder(SMALL_BORDER, LARGE_BORDER,
118 115
                 SMALL_BORDER, LARGE_BORDER),
119 116
                 BorderFactory.createEtchedBorder()));
120 117
         pane.setPreferredSize(new Dimension(400, 150));
@@ -122,7 +119,7 @@ public final class UpdaterDialog extends StandardDialog implements ActionListene
122 119
         
123 120
         final JPanel buttonContainer = new JPanel();
124 121
         buttonContainer.setLayout(new BorderLayout());
125
-        buttonContainer.setBorder(BorderFactory.createEmptyBorder(SMALL_BORDER, 
122
+        buttonContainer.setBorder(BorderFactory.createEmptyBorder(SMALL_BORDER,
126 123
                 LARGE_BORDER, LARGE_BORDER, LARGE_BORDER));
127 124
         
128 125
         final JButton lButton = new JButton();
@@ -131,7 +128,7 @@ public final class UpdaterDialog extends StandardDialog implements ActionListene
131 128
         rButton.setPreferredSize(new Dimension(100, 30));
132 129
         buttonContainer.add(lButton, BorderLayout.WEST);
133 130
         buttonContainer.add(rButton, BorderLayout.EAST);
134
-                
131
+        
135 132
         orderButtons(lButton, rButton);
136 133
         //getOkButton().setText("Update");
137 134
         
@@ -139,16 +136,22 @@ public final class UpdaterDialog extends StandardDialog implements ActionListene
139 136
         
140 137
         pack();
141 138
     }
142
-
139
+    
140
+    /** {@inheritDoc} */
141
+    public void display() {
142
+        setLocationRelativeTo(Main.getUI().getMainWindow());
143
+        setVisible(true);
144
+    }
145
+    
143 146
     /** {@inheritDoc} */
144 147
     public void actionPerformed(final ActionEvent e) {
145 148
         /*if (e.getSource().equals(getOkButton())) {
146 149
             getOkButton().setEnabled(false);
147
-            
150
+         
148 151
             header.setText("<html><big>Updating...</big><br><br>"
149 152
                 + "DMDirc is updating the following components:</html>");
150 153
         } else if (e.getSource().equals(getCancelButton())) {*/
151
-            dispose();
154
+        dispose();
152 155
         //}
153 156
     }
154 157
 }

+ 3
- 3
src/com/dmdirc/ui/dialogs/about/AboutDialog.java 查看文件

@@ -22,7 +22,7 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs.about;
24 24
 
25
-import com.dmdirc.ui.MainFrame;
25
+import com.dmdirc.Main;
26 26
 import com.dmdirc.ui.components.StandardDialog;
27 27
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
28 28
 
@@ -55,9 +55,9 @@ public final class AboutDialog extends StandardDialog implements
55 55
     
56 56
     /** Creates a new instance of AboutDialog. */
57 57
     private AboutDialog() {
58
-        super(MainFrame.getMainFrame(), false);
58
+        super(Main.getUI().getMainWindow(), false);
59 59
         initComponents();
60
-        setLocationRelativeTo(MainFrame.getMainFrame());
60
+        setLocationRelativeTo(Main.getUI().getMainWindow());
61 61
         this.setVisible(true);
62 62
     }
63 63
     

+ 3
- 3
src/com/dmdirc/ui/dialogs/actionseditor/ActionsEditorDialog.java 查看文件

@@ -22,9 +22,9 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs.actionseditor;
24 24
 
25
+import com.dmdirc.Main;
25 26
 import com.dmdirc.actions.Action;
26 27
 import com.dmdirc.actions.ActionType;
27
-import com.dmdirc.ui.MainFrame;
28 28
 import com.dmdirc.ui.components.StandardDialog;
29 29
 import com.dmdirc.ui.dialogs.ActionsManagerDialog;
30 30
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
@@ -74,7 +74,7 @@ public final class ActionsEditorDialog extends StandardDialog implements
74 74
      */
75 75
     private ActionsEditorDialog(final ActionsManagerDialog parent,
76 76
             final Action action) {
77
-        super(MainFrame.getMainFrame(), false);
77
+        super(Main.getUI().getMainWindow(), false);
78 78
         
79 79
         this.parent = parent;
80 80
         this.action = action;
@@ -85,7 +85,7 @@ public final class ActionsEditorDialog extends StandardDialog implements
85 85
         addListeners();
86 86
         layoutComponents();
87 87
         
88
-        this.setLocationRelativeTo(MainFrame.getMainFrame());
88
+        this.setLocationRelativeTo(Main.getUI().getMainWindow());
89 89
         
90 90
         this.setVisible(true);
91 91
     }

+ 3
- 3
src/com/dmdirc/ui/dialogs/actionseditor/ConditionEditorDialog.java 查看文件

@@ -22,12 +22,12 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs.actionseditor;
24 24
 
25
+import com.dmdirc.Main;
25 26
 import com.dmdirc.actions.ActionComparison;
26 27
 import com.dmdirc.actions.ActionComponent;
27 28
 import com.dmdirc.actions.ActionCondition;
28 29
 import com.dmdirc.actions.ActionManager;
29 30
 import com.dmdirc.actions.ActionType;
30
-import com.dmdirc.ui.MainFrame;
31 31
 import com.dmdirc.ui.components.StandardDialog;
32 32
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
33 33
 import static com.dmdirc.ui.UIUtilities.layoutGrid;
@@ -101,7 +101,7 @@ public final class ConditionEditorDialog extends StandardDialog implements
101 101
      */
102 102
     private ConditionEditorDialog(final ConditionsTabPanel parent,
103 103
             final ActionType trigger, final ActionCondition condition) {
104
-        super(MainFrame.getMainFrame(), false);
104
+        super(Main.getUI().getMainWindow(), false);
105 105
         
106 106
         this.trigger = trigger;
107 107
         this.parent = parent;
@@ -126,7 +126,7 @@ public final class ConditionEditorDialog extends StandardDialog implements
126 126
         addListeners();
127 127
         layoutComponents();
128 128
         
129
-        this.setLocationRelativeTo(MainFrame.getMainFrame());
129
+        this.setLocationRelativeTo(Main.getUI().getMainWindow());
130 130
         
131 131
         this.setVisible(true);
132 132
     }

+ 3
- 3
src/com/dmdirc/ui/dialogs/channelsetting/ChannelSettingsDialog.java 查看文件

@@ -23,9 +23,9 @@
23 23
 package com.dmdirc.ui.dialogs.channelsetting;
24 24
 
25 25
 import com.dmdirc.Channel;
26
+import com.dmdirc.Main;
26 27
 import com.dmdirc.config.Identity;
27 28
 import com.dmdirc.config.IdentityManager;
28
-import com.dmdirc.ui.MainFrame;
29 29
 import com.dmdirc.ui.components.StandardDialog;
30 30
 import com.dmdirc.ui.components.expandingsettings.SettingsPanel;
31 31
 import com.dmdirc.ui.components.expandingsettings.SettingsPanel.OptionType;
@@ -88,7 +88,7 @@ public final class ChannelSettingsDialog extends StandardDialog implements Actio
88 88
      * @param newChannel The channel object that we're editing settings for
89 89
      */
90 90
     private ChannelSettingsDialog(final Channel newChannel) {
91
-        super(MainFrame.getMainFrame(), false);
91
+        super(Main.getUI().getMainWindow(), false);
92 92
 
93 93
         channel = newChannel;
94 94
         identity =
@@ -99,7 +99,7 @@ public final class ChannelSettingsDialog extends StandardDialog implements Actio
99 99
         initListeners();
100 100
 
101 101
         pack();
102
-        setLocationRelativeTo(MainFrame.getMainFrame());
102
+        setLocationRelativeTo(Main.getUI().getMainWindow());
103 103
     }
104 104
 
105 105
     /**

+ 2
- 2
src/com/dmdirc/ui/dialogs/error/ErrorListDialog.java 查看文件

@@ -22,11 +22,11 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs.error;
24 24
 
25
+import com.dmdirc.Main;
25 26
 import com.dmdirc.logger.ErrorListener;
26 27
 import com.dmdirc.logger.ErrorManager;
27 28
 import com.dmdirc.logger.ErrorStatus;
28 29
 import com.dmdirc.logger.ProgramError;
29
-import com.dmdirc.ui.MainFrame;
30 30
 import com.dmdirc.ui.components.PackingTable;
31 31
 import com.dmdirc.ui.components.StandardDialog;
32 32
 import static com.dmdirc.ui.UIUtilities.LARGE_BORDER;
@@ -95,7 +95,7 @@ public final class ErrorListDialog extends StandardDialog implements
95 95
     
96 96
     /** Creates a new instance of ErrorListDialog. */
97 97
     private ErrorListDialog() {
98
-        super(MainFrame.getMainFrame(), false);
98
+        super(Main.getUI().getMainWindow(), false);
99 99
         
100 100
         setTitle("DMDirc: Error list");
101 101
         

+ 2
- 2
src/com/dmdirc/ui/dialogs/error/FatalErrorDialog.java 查看文件

@@ -23,9 +23,9 @@
23 23
 package com.dmdirc.ui.dialogs.error;
24 24
 
25 25
 import com.dmdirc.IconManager;
26
+import com.dmdirc.Main;
26 27
 import com.dmdirc.logger.ErrorStatus;
27 28
 import com.dmdirc.logger.ProgramError;
28
-import com.dmdirc.ui.MainFrame;
29 29
 import static com.dmdirc.ui.UIUtilities.LARGE_BORDER;
30 30
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
31 31
 
@@ -239,7 +239,7 @@ public final class FatalErrorDialog extends JDialog implements ActionListener,
239 239
         setVisible(false);
240 240
         new Timer().schedule(new TimerTask() {
241 241
             public void run() {
242
-                MainFrame.getMainFrame().setVisible(false);
242
+                Main.getUI().getMainWindow().setVisible(false);
243 243
                 while (error.getStatus() != ErrorStatus.FINISHED) {
244 244
                     try {
245 245
                         Thread.sleep(1000);

+ 3
- 3
src/com/dmdirc/ui/dialogs/serversetting/ServerSettingsDialog.java 查看文件

@@ -22,9 +22,9 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs.serversetting;
24 24
 
25
+import com.dmdirc.Main;
25 26
 import com.dmdirc.Server;
26 27
 import com.dmdirc.config.IdentityManager;
27
-import com.dmdirc.ui.MainFrame;
28 28
 import com.dmdirc.ui.components.StandardDialog;
29 29
 import com.dmdirc.ui.components.expandingsettings.SettingsPanel;
30 30
 import com.dmdirc.ui.components.expandingsettings.SettingsPanel.OptionType;
@@ -72,7 +72,7 @@ public final class ServerSettingsDialog extends StandardDialog
72 72
      * @param server The server object that we're editing settings for
73 73
      */
74 74
     public ServerSettingsDialog(final Server server) {
75
-        super(MainFrame.getMainFrame(), false);
75
+        super(Main.getUI().getMainWindow(), false);
76 76
         
77 77
         this.server = server;
78 78
         
@@ -83,7 +83,7 @@ public final class ServerSettingsDialog extends StandardDialog
83 83
         initComponents();
84 84
         initListeners();
85 85
         pack();
86
-        setLocationRelativeTo(MainFrame.getMainFrame());
86
+        setLocationRelativeTo(Main.getUI().getMainWindow());
87 87
     }
88 88
     
89 89
     /** Initialises the main UI components. */

+ 3
- 3
src/com/dmdirc/ui/dialogs/wizard/WizardDialog.java 查看文件

@@ -22,7 +22,7 @@
22 22
 
23 23
 package com.dmdirc.ui.dialogs.wizard;
24 24
 
25
-import com.dmdirc.ui.MainFrame;
25
+import com.dmdirc.Main;
26 26
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
27 27
 
28 28
 import java.awt.BorderLayout;
@@ -87,7 +87,7 @@ public final class WizardDialog extends JDialog implements ActionListener,
87 87
      */
88 88
     public WizardDialog(final String title, final List<Step> steps,
89 89
             final Wizard wizard, final boolean modal) {
90
-        super(MainFrame.getMainFrame(), modal);
90
+        super(Main.getUI().getMainWindow(), modal);
91 91
         
92 92
         this.title = title;
93 93
         this.steps = new ArrayList<Step>(steps);
@@ -178,7 +178,7 @@ public final class WizardDialog extends JDialog implements ActionListener,
178 178
             setTitle(title);
179 179
             setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
180 180
             pack();
181
-            setLocationRelativeTo(MainFrame.getMainFrame());
181
+            setLocationRelativeTo(Main.getUI().getMainWindow());
182 182
             setResizable(false);
183 183
             setVisible(true);
184 184
         }

+ 14
- 13
src/com/dmdirc/ui/framemanager/DummyFrameManager.java 查看文件

@@ -24,9 +24,10 @@ package com.dmdirc.ui.framemanager;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.FrameContainer;
27
+import com.dmdirc.Main;
27 28
 import com.dmdirc.Query;
28 29
 import com.dmdirc.Server;
29
-import com.dmdirc.ui.MainFrame;
30
+import com.dmdirc.ui.interfaces.FrameManager;
30 31
 
31 32
 import java.awt.Color;
32 33
 
@@ -50,49 +51,49 @@ public final class DummyFrameManager implements FrameManager {
50 51
     
51 52
     /** {@inheritDoc} */
52 53
     public void addServer(final Server server) {
53
-        MainFrame.getMainFrame().getStatusBar()
54
+        Main.getUI().getMainWindow().getStatusBar()
54 55
                 .setMessage("DummyFrameManager: addServer: " + server);
55 56
     }
56 57
     
57 58
     /** {@inheritDoc} */
58 59
     public void delServer(final Server server) {
59
-        MainFrame.getMainFrame().getStatusBar()
60
+        Main.getUI().getMainWindow().getStatusBar()
60 61
                 .setMessage("DummyFrameManager: delServer: " + server);
61 62
     }
62 63
     
63 64
     /** {@inheritDoc} */
64 65
     public void addChannel(final Server server, final Channel channel) {
65
-        MainFrame.getMainFrame().getStatusBar()
66
+        Main.getUI().getMainWindow().getStatusBar()
66 67
                 .setMessage("DummyFrameManager: addChannel: " + channel + "@" + server);
67 68
     }
68 69
     
69 70
     /** {@inheritDoc} */
70 71
     public void delChannel(final Server server, final Channel channel) {
71
-        MainFrame.getMainFrame().getStatusBar()
72
+        Main.getUI().getMainWindow().getStatusBar()
72 73
                 .setMessage("DummyFrameManager: delChannel: " + channel + "@" + server);
73 74
     }
74 75
     
75 76
     /** {@inheritDoc} */
76 77
     public void addQuery(final Server server, final Query query) {
77
-        MainFrame.getMainFrame().getStatusBar()
78
+        Main.getUI().getMainWindow().getStatusBar()
78 79
                 .setMessage("DummyFrameManager: addQuery: " + query + "@" + server);
79 80
     }
80 81
     
81 82
     /** {@inheritDoc} */
82 83
     public void delQuery(final Server server, final Query query) {
83
-        MainFrame.getMainFrame().getStatusBar()
84
+        Main.getUI().getMainWindow().getStatusBar()
84 85
                 .setMessage("DummyFrameManager: delQuery: " + query + "@" + server);
85 86
     }
86 87
     
87 88
     /** {@inheritDoc} */
88 89
     public void addCustom(final Server server, final FrameContainer window) {
89
-        MainFrame.getMainFrame().getStatusBar()
90
+        Main.getUI().getMainWindow().getStatusBar()
90 91
                 .setMessage("DummyFrameManager: addCustom: " + window + "@" + server);
91 92
     }
92 93
     
93 94
     /** {@inheritDoc} */
94 95
     public void delCustom(final Server server, final FrameContainer window) {
95
-        MainFrame.getMainFrame().getStatusBar()
96
+        Main.getUI().getMainWindow().getStatusBar()
96 97
                 .setMessage("DummyFrameManager: delCustom: " + window + "@" + server);
97 98
     }
98 99
     
@@ -108,25 +109,25 @@ public final class DummyFrameManager implements FrameManager {
108 109
     
109 110
     /** {@inheritDoc} */
110 111
     public void showNotification(final FrameContainer source, final Color colour) {
111
-        MainFrame.getMainFrame().getStatusBar()
112
+        Main.getUI().getMainWindow().getStatusBar()
112 113
                 .setMessage("DummyFrameManager: Notifcation for " + source);
113 114
     }
114 115
     
115 116
     /** {@inheritDoc} */
116 117
     public void clearNotification(final FrameContainer source) {
117
-        MainFrame.getMainFrame().getStatusBar()
118
+        Main.getUI().getMainWindow().getStatusBar()
118 119
                 .setMessage("DummyFrameManager: Clear notification for " + source);
119 120
     }
120 121
     
121 122
     /** {@inheritDoc} */
122 123
     public void setSelected(final FrameContainer source) {
123
-        MainFrame.getMainFrame().getStatusBar()
124
+        Main.getUI().getMainWindow().getStatusBar()
124 125
                 .setMessage("DummyFrameManager: Now focused: " + source);
125 126
     }
126 127
 
127 128
     /** {@inheritDoc} */
128 129
     public void iconUpdated(final FrameContainer window) {
129
-        MainFrame.getMainFrame().getStatusBar()
130
+        Main.getUI().getMainWindow().getStatusBar()
130 131
                 .setMessage("DummyFrameManager: Icon changed: " + window);
131 132
     }
132 133
 }

+ 1
- 0
src/com/dmdirc/ui/framemanager/MainFrameManager.java 查看文件

@@ -30,6 +30,7 @@ import com.dmdirc.Server;
30 30
 import com.dmdirc.ui.framemanager.buttonbar.ButtonBar;
31 31
 import com.dmdirc.ui.framemanager.tree.TreeFrameManager;
32 32
 import com.dmdirc.ui.framemanager.windowmenu.WindowMenuFrameManager;
33
+import com.dmdirc.ui.interfaces.FrameManager;
33 34
 
34 35
 import java.awt.Color;
35 36
 import java.io.IOException;

+ 4
- 4
src/com/dmdirc/ui/framemanager/buttonbar/ButtonBar.java 查看文件

@@ -25,12 +25,12 @@ package com.dmdirc.ui.framemanager.buttonbar;
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.Config;
27 27
 import com.dmdirc.FrameContainer;
28
+import com.dmdirc.Main;
28 29
 import com.dmdirc.Query;
29 30
 import com.dmdirc.Server;
30
-import com.dmdirc.ui.MainFrame;
31 31
 import com.dmdirc.ui.UIUtilities;
32
-import com.dmdirc.ui.framemanager.FrameManager;
33
-import com.dmdirc.ui.framemanager.FramemanagerPosition;
32
+import com.dmdirc.ui.interfaces.FrameManager;
33
+import com.dmdirc.ui.interfaces.FramemanagerPosition;
34 34
 import com.dmdirc.ui.interfaces.Window;
35 35
 
36 36
 import java.awt.BorderLayout;
@@ -291,7 +291,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
291 291
      * @param e The action event associated with this action
292 292
      */
293 293
     public void actionPerformed(final ActionEvent e) {
294
-        final Window active = MainFrame.getMainFrame().getActiveFrame();
294
+        final Window active = Main.getUI().getMainWindow().getActiveFrame();
295 295
         
296 296
         for (Map.Entry<FrameContainer, JToggleButton> entry : buttons.entrySet()) {
297 297
             if (entry.getValue().equals(e.getSource())) {

+ 1
- 1
src/com/dmdirc/ui/framemanager/tree/TreeFrameManager.java 查看文件

@@ -29,7 +29,7 @@ import com.dmdirc.Query;
29 29
 import com.dmdirc.Server;
30 30
 import com.dmdirc.logger.ErrorLevel;
31 31
 import com.dmdirc.logger.Logger;
32
-import com.dmdirc.ui.framemanager.FrameManager;
32
+import com.dmdirc.ui.interfaces.FrameManager;
33 33
 import static com.dmdirc.ui.UIUtilities.SMALL_BORDER;
34 34
 
35 35
 import java.awt.BorderLayout;

+ 4
- 3
src/com/dmdirc/ui/framemanager/windowmenu/WindowMenuFrameManager.java 查看文件

@@ -24,11 +24,12 @@ package com.dmdirc.ui.framemanager.windowmenu;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.FrameContainer;
27
+import com.dmdirc.Main;
27 28
 import com.dmdirc.Query;
28 29
 import com.dmdirc.Server;
29 30
 import com.dmdirc.ui.MainFrame;
30 31
 import com.dmdirc.ui.components.FrameContainerComparator;
31
-import com.dmdirc.ui.framemanager.FrameManager;
32
+import com.dmdirc.ui.interfaces.FrameManager;
32 33
 
33 34
 import java.awt.Color;
34 35
 import java.awt.Font;
@@ -160,7 +161,7 @@ public final class WindowMenuFrameManager implements FrameManager,
160 161
         mi.addActionListener(this);
161 162
         menuItemMap.put(window, mi);
162 163
         newMap.putAll(menuItemMap);
163
-        MainFrame.getMainFrame().populateWindowMenu(newMap);
164
+        Main.getUI().getMainWindow().populateWindowMenu(newMap);
164 165
     }
165 166
     
166 167
     /**
@@ -173,7 +174,7 @@ public final class WindowMenuFrameManager implements FrameManager,
173 174
                 new TreeMap<FrameContainer, JMenuItem>(new FrameContainerComparator());
174 175
         menuItemMap.remove(window);
175 176
         newMap.putAll(menuItemMap);
176
-        MainFrame.getMainFrame().populateWindowMenu(newMap);
177
+        Main.getUI().getMainWindow().populateWindowMenu(newMap);
177 178
     }
178 179
     
179 180
     /** {@inheritDoc} */

src/com/dmdirc/ui/framemanager/FrameManager.java → src/com/dmdirc/ui/interfaces/FrameManager.java 查看文件

@@ -20,7 +20,7 @@
20 20
  * SOFTWARE.
21 21
  */
22 22
 
23
-package com.dmdirc.ui.framemanager;
23
+package com.dmdirc.ui.interfaces;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.FrameContainer;

src/com/dmdirc/ui/framemanager/FramemanagerPosition.java → src/com/dmdirc/ui/interfaces/FramemanagerPosition.java 查看文件

@@ -20,7 +20,7 @@
20 20
  * SOFTWARE.
21 21
  */
22 22
 
23
-package com.dmdirc.ui.framemanager;
23
+package com.dmdirc.ui.interfaces;
24 24
 
25 25
 import java.util.Locale;
26 26
 

+ 104
- 0
src/com/dmdirc/ui/interfaces/StatusBar.java 查看文件

@@ -0,0 +1,104 @@
1
+/*
2
+ * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.ui.interfaces;
24
+
25
+import java.awt.Component;
26
+import javax.swing.Icon;
27
+
28
+/**
29
+ * Status bar interface.
30
+ */
31
+public interface StatusBar {
32
+    
33
+    /**
34
+     * sets the message in the status bar.
35
+     *
36
+     * @param newMessage Message to display
37
+     */
38
+    void setMessage(final String newMessage);
39
+    
40
+    /**
41
+     * Sets the message in the status bar with a specified callback event
42
+     * using the default timeout.
43
+     *
44
+     * @param newMessage Message to display
45
+     * @param newNotifier status message notifier to be notified for events on
46
+     * this message
47
+     */
48
+    void setMessage(final String newMessage, 
49
+            final StatusMessageNotifier newNotifier);
50
+    
51
+    /**
52
+     * Sets the message in the status bar with a specified callback event for
53
+     * a specified time.
54
+     *
55
+     * @param newMessage Message to display
56
+     * @param newNotifier status message notifier to be notified for events on
57
+     * this message
58
+     * @param timeout message timeout in seconds
59
+     */
60
+    void setMessage(final String newMessage,
61
+            final StatusMessageNotifier newNotifier, final int timeout);
62
+    
63
+    /**
64
+     * Removes the message from the status bar.
65
+     */
66
+    void clearMessage();
67
+    
68
+    /**
69
+     * sets the icon in the status bar.
70
+     *
71
+     * @param newIcon Icon to display
72
+     */
73
+    void setError(final Icon newIcon);
74
+    
75
+    /**
76
+     * sets the icon in the status bar with a specified callback event.
77
+     *
78
+     * @param newIcon Icon to display
79
+     * @param newNotifier status error notifier to be notified for events on
80
+     * this error
81
+     */
82
+    void setError(final Icon newIcon,
83
+            final StatusErrorNotifier newNotifier);
84
+    
85
+    /**
86
+     * Removes the error state from the status bar.
87
+     */
88
+    void clearError();
89
+    
90
+    /**
91
+     * Adds a component to the status bar.
92
+     *
93
+     * @param component component to add
94
+     */
95
+    void addComponent(final Component component);
96
+    
97
+    /**
98
+     * Removes a component to the status bar.
99
+     *
100
+     * @param component component to add
101
+     */
102
+    void removeComponent(final Component component);
103
+    
104
+}

+ 11
- 2
src/com/dmdirc/ui/interfaces/UIController.java 查看文件

@@ -28,8 +28,8 @@ import com.dmdirc.Server;
28 28
 import com.dmdirc.WritableFrameContainer;
29 29
 import com.dmdirc.commandparser.CommandParser;
30 30
 import com.dmdirc.ui.MainFrame;
31
-import com.dmdirc.ui.components.StatusBar;
32
-import com.dmdirc.ui.framemanager.FrameManager;
31
+import com.dmdirc.updater.Update;
32
+import java.util.List;
33 33
 
34 34
 /**
35 35
  * Defines the methods that should be implemented by UI controllers. Controllers
@@ -103,6 +103,15 @@ public interface UIController {
103 103
      */
104 104
     PreferencesPanel getPreferencesPanel(PreferencesInterface parent, String title);
105 105
     
106
+    /**
107
+     * Returns an updater dialog for the specified updates.
108
+     * 
109
+     * @param updates Updates available
110
+     *
111
+     * @return UpdaterDialog
112
+     */
113
+    UpdaterDialog getUpdaterDialog(List<Update> updates);
114
+    
106 115
     /**
107 116
      * Initialises any settings required by this UI (this is always called
108 117
      * before any aspect of the UI is instansiated).

+ 32
- 0
src/com/dmdirc/ui/interfaces/UpdaterDialog.java 查看文件

@@ -0,0 +1,32 @@
1
+/*
2
+ * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.ui.interfaces;
24
+
25
+/**
26
+ * Updater dialog
27
+ */
28
+public interface UpdaterDialog {
29
+    
30
+    /** Displays the dialog. */
31
+    void display();
32
+}

+ 5
- 7
src/com/dmdirc/updater/UpdateChecker.java 查看文件

@@ -27,8 +27,6 @@ import com.dmdirc.IconManager;
27 27
 import com.dmdirc.Main;
28 28
 import com.dmdirc.logger.ErrorLevel;
29 29
 import com.dmdirc.logger.Logger;
30
-import com.dmdirc.ui.MainFrame;
31
-import com.dmdirc.ui.dialogs.UpdaterDialog;
32 30
 
33 31
 import java.awt.event.MouseEvent;
34 32
 import java.awt.event.MouseListener;
@@ -72,7 +70,7 @@ public final class UpdateChecker implements Runnable, MouseListener {
72 70
     
73 71
     /** {@inheritDoc} */
74 72
     public void run() {
75
-        MainFrame.getMainFrame().getStatusBar().setMessage("Checking for updates...");
73
+        Main.getUI().getMainWindow().getStatusBar().setMessage("Checking for updates...");
76 74
         
77 75
         updates.clear();
78 76
         
@@ -122,7 +120,7 @@ public final class UpdateChecker implements Runnable, MouseListener {
122 120
      */
123 121
     private void checkLine(final String line) {
124 122
         if (line.startsWith("uptodate")) {
125
-            MainFrame.getMainFrame().getStatusBar().setMessage("No updates available");
123
+            Main.getUI().getMainWindow().getStatusBar().setMessage("No updates available");
126 124
         } else if (line.startsWith("outofdate")) {
127 125
             doUpdateAvailable(line);
128 126
         } else {
@@ -144,7 +142,7 @@ public final class UpdateChecker implements Runnable, MouseListener {
144 142
             label.addMouseListener(this);
145 143
             label.setBorder(BorderFactory.createEtchedBorder());
146 144
             label.setIcon(IconManager.getIconManager().getIcon("update"));
147
-            MainFrame.getMainFrame().getStatusBar().addComponent(label);
145
+            Main.getUI().getMainWindow().getStatusBar().addComponent(label);
148 146
         }
149 147
     }
150 148
     
@@ -165,7 +163,7 @@ public final class UpdateChecker implements Runnable, MouseListener {
165 163
         /*
166 164
         final List<Update> temp = new ArrayList<Update>();
167 165
         temp.add(new Update("outofdate teststuff 20073005 20060101 http://www.example.com/"));
168
-        new UpdaterDialog(temp);
166
+        new SwingUpdaterDialog(temp);
169 167
          */
170 168
         
171 169
         new Timer().schedule(new TimerTask() {
@@ -177,7 +175,7 @@ public final class UpdateChecker implements Runnable, MouseListener {
177 175
     
178 176
     /** {@inheritDoc} */
179 177
     public void mouseClicked(final MouseEvent e) {
180
-        new UpdaterDialog(updates);
178
+        Main.getUI().getUpdaterDialog(updates).display();
181 179
     }
182 180
     
183 181
     /** {@inheritDoc} */

Loading…
取消
儲存