Browse Source

pass more objects directly

tags/0.6.3m1rc1
Gregory Holmes 15 years ago
parent
commit
8dbf247506

+ 1
- 1
src/com/dmdirc/addons/ui_swing/MainFrame.java View File

361
      * Initialises the components for this frame.
361
      * Initialises the components for this frame.
362
      */
362
      */
363
     private void initComponents() {
363
     private void initComponents() {
364
-        statusBar = new SwingStatusBar(controller);
364
+        statusBar = new SwingStatusBar(controller, this);
365
         frameManagerPanel = new JPanel();
365
         frameManagerPanel = new JPanel();
366
         desktopPane = new DMDircDesktopPane(this);
366
         desktopPane = new DMDircDesktopPane(this);
367
 
367
 

+ 21
- 41
src/com/dmdirc/addons/ui_swing/SwingController.java View File

88
     private MainFrame me;
88
     private MainFrame me;
89
     /** Status bar. */
89
     /** Status bar. */
90
     private SwingStatusBar statusBar;
90
     private SwingStatusBar statusBar;
91
-    /** Semaphore used for controlling access to statusBar. */
92
-    private static final Semaphore STATUSBAR_SEMAPHORE = new Semaphore(1);
93
     /** Top level window list. */
91
     /** Top level window list. */
94
     private final List<java.awt.Window> windows;
92
     private final List<java.awt.Window> windows;
95
-    
93
+
96
     /** Instantiates a new SwingController. */
94
     /** Instantiates a new SwingController. */
97
     public SwingController() {
95
     public SwingController() {
98
         windows = new ArrayList<java.awt.Window>();
96
         windows = new ArrayList<java.awt.Window>();
119
      * @return This UI's main window
117
      * @return This UI's main window
120
      */
118
      */
121
     public MainFrame getMainFrame() {
119
     public MainFrame getMainFrame() {
122
-        synchronized (SwingController.this) {
123
-            if (me == null) {
124
-                UIUtilities.invokeAndWait(new Runnable() {
125
-
126
-                    /** {@inheritDoc} */
127
-                    @Override
128
-                    public void run() {
129
-                        me = new MainFrame(SwingController.this);
130
-                        statusBar = me.getStatusBar();
131
-                    }
132
-                });
133
-                UIUtilities.invokeLater(new Runnable() {
134
-
135
-                    /** {@inheritDoc} */
136
-                    @Override
137
-                    public void run() {
138
-                        ErrorListDialog.getErrorListDialog(SwingController.this);
139
-                    }
140
-                });
141
-            }
142
-
143
-            return me;
144
-        }
120
+        return me;
145
     }
121
     }
146
 
122
 
147
     /** {@inheritDoc} */
123
     /** {@inheritDoc} */
156
      * @return This UI's status bar
132
      * @return This UI's status bar
157
      */
133
      */
158
     public SwingStatusBar getSwingStatusBar() {
134
     public SwingStatusBar getSwingStatusBar() {
159
-        STATUSBAR_SEMAPHORE.acquireUninterruptibly();
160
-        if (statusBar == null) {
161
-            getMainFrame();
162
-        }
163
-        STATUSBAR_SEMAPHORE.release();
164
         return statusBar;
135
         return statusBar;
165
     }
136
     }
166
 
137
 
238
             /** {@inheritDoc} */
209
             /** {@inheritDoc} */
239
             @Override
210
             @Override
240
             public void run() {
211
             public void run() {
241
-                setObject(SwingUpdaterDialog.getSwingUpdaterDialog(updates,
242
-                        SwingController.this));
212
+                setObject(SwingUpdaterDialog.getSwingUpdaterDialog(updates, me));
243
             }
213
             }
244
         });
214
         });
245
     }
215
     }
299
             /** {@inheritDoc} */
269
             /** {@inheritDoc} */
300
             @Override
270
             @Override
301
             public void run() {
271
             public void run() {
302
-                ChannelSettingsDialog.showChannelSettingsDialog(channel, getMainFrame());
272
+                ChannelSettingsDialog.showChannelSettingsDialog(channel, me);
303
             }
273
             }
304
         });
274
         });
305
     }
275
     }
312
             /** {@inheritDoc} */
282
             /** {@inheritDoc} */
313
             @Override
283
             @Override
314
             public void run() {
284
             public void run() {
315
-                ServerSettingsDialog.showServerSettingsDialog(server, getMainFrame());
285
+                ServerSettingsDialog.showServerSettingsDialog(server, me);
316
             }
286
             }
317
         });
287
         });
318
     }
288
     }
328
                 /** {@inheritDoc} */
298
                 /** {@inheritDoc} */
329
                 @Override
299
                 @Override
330
                 public void run() {
300
                 public void run() {
331
-                    setObject(getMainFrame().getExtendedState());
301
+                    setObject(me.getExtendedState());
332
                 }
302
                 }
333
             });
303
             });
334
             for (final java.awt.Window window : getTopLevelWindows()) {
304
             for (final java.awt.Window window : getTopLevelWindows()) {
338
                     @Override
308
                     @Override
339
                     public void run() {
309
                     public void run() {
340
                         SwingUtilities.updateComponentTreeUI(window);
310
                         SwingUtilities.updateComponentTreeUI(window);
341
-                        if (window != getMainFrame()) {
311
+                        if (window != me) {
342
                             window.pack();
312
                             window.pack();
343
                         }
313
                         }
344
                     }
314
                     }
349
                 /** {@inheritDoc} */
319
                 /** {@inheritDoc} */
350
                 @Override
320
                 @Override
351
                 public void run() {
321
                 public void run() {
352
-                    getMainFrame().setExtendedState(state);
322
+                    me.setExtendedState(state);
353
                 }
323
                 }
354
             });
324
             });
355
         } catch (ClassNotFoundException ex) {
325
         } catch (ClassNotFoundException ex) {
460
             /** {@inheritDoc} */
430
             /** {@inheritDoc} */
461
             @Override
431
             @Override
462
             public void run() {
432
             public void run() {
463
-                URLDialog.showURLDialog(url, getMainFrame());
433
+                URLDialog.showURLDialog(url, me);
464
 
434
 
465
             }
435
             }
466
         });
436
         });
474
             /** {@inheritDoc} */
444
             /** {@inheritDoc} */
475
             @Override
445
             @Override
476
             public void run() {
446
             public void run() {
477
-                new SSLCertificateDialog(getMainFrame(), model).setVisible(true);
447
+                new SSLCertificateDialog(me, model).setVisible(true);
478
             }
448
             }
479
         });
449
         });
480
     }
450
     }
527
     /** {@inheritDoc} */
497
     /** {@inheritDoc} */
528
     @Override
498
     @Override
529
     public PreferencesInterface getUrlHandlersPrefsPanel() {
499
     public PreferencesInterface getUrlHandlersPrefsPanel() {
530
-        return new URLConfigPanel(getMainFrame());
500
+        return new URLConfigPanel(me);
531
     }
501
     }
532
 
502
 
533
     /** {@inheritDoc} */
503
     /** {@inheritDoc} */
551
         if (GraphicsEnvironment.isHeadless()) {
521
         if (GraphicsEnvironment.isHeadless()) {
552
             throw new IllegalStateException("Swing UI can't be run in a headless environment");
522
             throw new IllegalStateException("Swing UI can't be run in a headless environment");
553
         }
523
         }
524
+        UIUtilities.invokeAndWait(new Runnable() {
525
+
526
+            /** {@inheritDoc} */
527
+            @Override
528
+            public void run() {
529
+                me = new MainFrame(SwingController.this);
530
+                statusBar = me.getStatusBar();
531
+                ErrorListDialog.getErrorListDialog(me, me.getStatusBar());
532
+            }
533
+        });
554
 
534
 
555
         Main.setUI(this);
535
         Main.setUI(this);
556
     }
536
     }

+ 14
- 9
src/com/dmdirc/addons/ui_swing/components/statusbar/ErrorPanel.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.components.statusbar;
23
 package com.dmdirc.addons.ui_swing.components.statusbar;
24
 
24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.addons.ui_swing.MainFrame;
26
 import com.dmdirc.addons.ui_swing.dialogs.error.ErrorListDialog;
26
 import com.dmdirc.addons.ui_swing.dialogs.error.ErrorListDialog;
27
 import com.dmdirc.logger.ErrorLevel;
27
 import com.dmdirc.logger.ErrorLevel;
28
 import com.dmdirc.logger.ErrorListener;
28
 import com.dmdirc.logger.ErrorListener;
63
     /** Currently showing error level. */
63
     /** Currently showing error level. */
64
     private ErrorLevel errorLevel;
64
     private ErrorLevel errorLevel;
65
     /** Status controller. */
65
     /** Status controller. */
66
-    private final SwingController controller;
66
+    private final MainFrame mainFrame;
67
+    /** Swing status bar. */
68
+    private SwingStatusBar statusBar;
67
     /** Error manager. */
69
     /** Error manager. */
68
     private final ErrorManager errorManager = ErrorManager.getErrorManager();
70
     private final ErrorManager errorManager = ErrorManager.getErrorManager();
69
     /** Dismiss menu. */
71
     /** Dismiss menu. */
76
     /**
78
     /**
77
      * Creates a new ErrorPanel for the speicified status bar.
79
      * Creates a new ErrorPanel for the speicified status bar.
78
      *
80
      *
79
-     * @param controller Swing controller
81
+     * @param mainFrame Main frame
82
+     * @param statusBar Status bar  
80
      */
83
      */
81
-    public ErrorPanel(final SwingController controller) {
84
+    public ErrorPanel(final MainFrame mainFrame, final SwingStatusBar statusBar) {
82
         super(new JLabel());
85
         super(new JLabel());
83
 
86
 
84
-        this.controller = controller;
87
+        this.mainFrame = mainFrame;
88
+        this.statusBar = statusBar;
89
+        
85
         menu = new JPopupMenu();
90
         menu = new JPopupMenu();
86
         dismiss = new JMenuItem("Clear All");
91
         dismiss = new JMenuItem("Clear All");
87
         show = new JMenuItem("Open");
92
         show = new JMenuItem("Open");
98
     /** {@inheritDoc} */
103
     /** {@inheritDoc} */
99
     @Override
104
     @Override
100
     protected StatusbarPopupWindow getWindow() {
105
     protected StatusbarPopupWindow getWindow() {
101
-        return new ErrorPopup(this, controller.getMainFrame());
106
+        return new ErrorPopup(this, mainFrame);
102
     }
107
     }
103
 
108
 
104
     /** Clears the error. */
109
     /** Clears the error. */
154
     /** {@inheritDoc} */
159
     /** {@inheritDoc} */
155
     @Override
160
     @Override
156
     public boolean isReady() {
161
     public boolean isReady() {
157
-        return controller.getMainFrame().getStatusBar().isValid();
162
+        return statusBar.isValid();
158
     }
163
     }
159
 
164
 
160
     /**
165
     /**
210
     public void mouseClicked(final MouseEvent mouseEvent) {
215
     public void mouseClicked(final MouseEvent mouseEvent) {
211
         super.mouseClicked(mouseEvent);
216
         super.mouseClicked(mouseEvent);
212
         if (mouseEvent.getButton() == MouseEvent.BUTTON1) {
217
         if (mouseEvent.getButton() == MouseEvent.BUTTON1) {
213
-            ErrorListDialog.showErrorListDialog(controller);
218
+            ErrorListDialog.showErrorListDialog(mainFrame, statusBar);
214
         }
219
         }
215
         checkMouseEvent(mouseEvent);
220
         checkMouseEvent(mouseEvent);
216
     }
221
     }
234
     @Override
239
     @Override
235
     public void actionPerformed(final ActionEvent e) {
240
     public void actionPerformed(final ActionEvent e) {
236
         if (e.getSource() == show) {
241
         if (e.getSource() == show) {
237
-            ErrorListDialog.showErrorListDialog(controller);
242
+            ErrorListDialog.showErrorListDialog(mainFrame, statusBar);
238
         } else {
243
         } else {
239
             final Collection<ProgramError> errors =
244
             final Collection<ProgramError> errors =
240
                     ErrorManager.getErrorManager().getErrors();
245
                     ErrorManager.getErrorManager().getErrors();

+ 9
- 4
src/com/dmdirc/addons/ui_swing/components/statusbar/SwingStatusBar.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.components.statusbar;
23
 package com.dmdirc.addons.ui_swing.components.statusbar;
24
 
24
 
25
+import com.dmdirc.addons.ui_swing.MainFrame;
25
 import com.dmdirc.addons.ui_swing.SwingController;
26
 import com.dmdirc.addons.ui_swing.SwingController;
26
 import com.dmdirc.logger.ErrorLevel;
27
 import com.dmdirc.logger.ErrorLevel;
27
 import com.dmdirc.logger.Logger;
28
 import com.dmdirc.logger.Logger;
56
     private final InviteLabel inviteLabel;
57
     private final InviteLabel inviteLabel;
57
     /** Swing controller. */
58
     /** Swing controller. */
58
     private SwingController controller;
59
     private SwingController controller;
60
+    /** Main frame. */
61
+    private MainFrame mainFrame;
59
 
62
 
60
     /**
63
     /**
61
      * Creates a new instance of SwingStatusBar.
64
      * Creates a new instance of SwingStatusBar.
62
      * 
65
      * 
63
      * @param controller Swing controller
66
      * @param controller Swing controller
67
+     * @param mainFrame Main frame
64
      */
68
      */
65
-    public SwingStatusBar(final SwingController controller) {
69
+    public SwingStatusBar(final SwingController controller, final MainFrame mainFrame) {
66
         super();
70
         super();
67
         
71
         
68
         this.controller = controller;
72
         this.controller = controller;
73
+        this.mainFrame = mainFrame;
69
 
74
 
70
         messageLabel = new MessageLabel();
75
         messageLabel = new MessageLabel();
71
-        errorPanel = new ErrorPanel(controller);
72
-        updateLabel = new UpdaterLabel(controller);
73
-        inviteLabel = new InviteLabel(controller.getMainFrame());
76
+        errorPanel = new ErrorPanel(mainFrame, this);
77
+        updateLabel = new UpdaterLabel(mainFrame);
78
+        inviteLabel = new InviteLabel(mainFrame);
74
 
79
 
75
         setLayout(new MigLayout("fill, ins 0, hidemode 3"));
80
         setLayout(new MigLayout("fill, ins 0, hidemode 3"));
76
 
81
 

+ 6
- 6
src/com/dmdirc/addons/ui_swing/components/statusbar/UpdaterLabel.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.components.statusbar;
23
 package com.dmdirc.addons.ui_swing.components.statusbar;
24
 
24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.addons.ui_swing.MainFrame;
26
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingRestartDialog;
26
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingRestartDialog;
27
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingUpdaterDialog;
27
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingUpdaterDialog;
28
 import com.dmdirc.interfaces.UpdateCheckerListener;
28
 import com.dmdirc.interfaces.UpdateCheckerListener;
52
      */
52
      */
53
     private static final long serialVersionUID = 1;
53
     private static final long serialVersionUID = 1;
54
     /** Swing controller. */
54
     /** Swing controller. */
55
-    private SwingController controller;
55
+    private MainFrame mainFrame;
56
 
56
 
57
     /**
57
     /**
58
      * Instantiates a new updater label, handles showing updates on the status bar.
58
      * Instantiates a new updater label, handles showing updates on the status bar.
59
      * 
59
      * 
60
-     * @param controller Swing controller
60
+     * @param mainFrame Main frame
61
      */
61
      */
62
-    public UpdaterLabel(final SwingController controller) {
62
+    public UpdaterLabel(final MainFrame mainFrame) {
63
         super();
63
         super();
64
         
64
         
65
-        this.controller = controller;
65
+        this.mainFrame = mainFrame;
66
         setBorder(BorderFactory.createEtchedBorder());
66
         setBorder(BorderFactory.createEtchedBorder());
67
         addMouseListener(this);
67
         addMouseListener(this);
68
         UpdateChecker.addListener(this);
68
         UpdateChecker.addListener(this);
123
                 restartDialog.setVisible(true);
123
                 restartDialog.setVisible(true);
124
             } else if (!UpdateChecker.getStatus().equals(UpdateChecker.STATE.CHECKING)) {
124
             } else if (!UpdateChecker.getStatus().equals(UpdateChecker.STATE.CHECKING)) {
125
                 SwingUpdaterDialog.showSwingUpdaterDialog(
125
                 SwingUpdaterDialog.showSwingUpdaterDialog(
126
-                        UpdateChecker.getAvailableUpdates(), controller);
126
+                        UpdateChecker.getAvailableUpdates(), mainFrame);
127
             }
127
             }
128
         }
128
         }
129
     }
129
     }

+ 23
- 15
src/com/dmdirc/addons/ui_swing/dialogs/error/ErrorListDialog.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.dialogs.error;
23
 package com.dmdirc.addons.ui_swing.dialogs.error;
24
 
24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.addons.ui_swing.MainFrame;
26
 import com.dmdirc.addons.ui_swing.components.PackingTable;
26
 import com.dmdirc.addons.ui_swing.components.PackingTable;
27
 import com.dmdirc.addons.ui_swing.components.StandardDialog;
27
 import com.dmdirc.addons.ui_swing.components.StandardDialog;
28
 import com.dmdirc.addons.ui_swing.components.renderers.ErrorLevelIconCellRenderer;
28
 import com.dmdirc.addons.ui_swing.components.renderers.ErrorLevelIconCellRenderer;
29
 import com.dmdirc.addons.ui_swing.components.renderers.DateCellRenderer;
29
 import com.dmdirc.addons.ui_swing.components.renderers.DateCellRenderer;
30
+import com.dmdirc.addons.ui_swing.components.statusbar.SwingStatusBar;
30
 import com.dmdirc.logger.ErrorListener;
31
 import com.dmdirc.logger.ErrorListener;
31
 import com.dmdirc.logger.ErrorManager;
32
 import com.dmdirc.logger.ErrorManager;
32
 import com.dmdirc.logger.ErrorReportStatus;
33
 import com.dmdirc.logger.ErrorReportStatus;
82
     /** Delete all button. */
83
     /** Delete all button. */
83
     private JButton deleteAllButton;
84
     private JButton deleteAllButton;
84
     /** Swing Controller. */
85
     /** Swing Controller. */
85
-    private SwingController controller;
86
+    private MainFrame mainFrame;
87
+    /** Status bar. */
88
+    private SwingStatusBar statusBar;
86
 
89
 
87
     /** 
90
     /** 
88
      * Creates a new instance of ErrorListDialog. 
91
      * Creates a new instance of ErrorListDialog. 
89
      * 
92
      * 
90
      * @param controller Swing controller
93
      * @param controller Swing controller
91
      */
94
      */
92
-    private ErrorListDialog(final SwingController controller) {
93
-        super(controller.getMainFrame(), ModalityType.MODELESS);
94
-        this.controller = controller;
95
+    private ErrorListDialog(final MainFrame mainFrame, final SwingStatusBar statusBar) {
96
+        super(mainFrame, ModalityType.MODELESS);
97
+        if (statusBar == null) {
98
+            new Exception().printStackTrace();
99
+        }
100
+        this.mainFrame = mainFrame;
101
+        this.statusBar = statusBar;
95
 
102
 
96
         setTitle("DMDirc: Error list");
103
         setTitle("DMDirc: Error list");
97
 
104
 
107
     /** 
114
     /** 
108
      * Returns the instance of ErrorListDialog.
115
      * Returns the instance of ErrorListDialog.
109
      * 
116
      * 
110
-     * @param controller Swing controller
117
+     * @param mainFrame Main frame
118
+     * @param statusBar Status bar
111
      */
119
      */
112
-    public static void showErrorListDialog(final SwingController controller) {
113
-        me = getErrorListDialog(controller);
120
+    public static void showErrorListDialog(final MainFrame mainFrame, 
121
+            final SwingStatusBar statusBar) {
122
+        me = getErrorListDialog(mainFrame, statusBar);
114
 
123
 
115
         me.setLocationRelativeTo(me.getParent());
124
         me.setLocationRelativeTo(me.getParent());
116
         me.setVisible(true);
125
         me.setVisible(true);
120
     /**
129
     /**
121
      * Returns the current instance of the ErrorListDialog.
130
      * Returns the current instance of the ErrorListDialog.
122
      * 
131
      * 
123
-     * @param controller Swing controller
132
+     * @param mainFrame Main frame
133
+     * @param statusBar Status bar
124
      *
134
      *
125
      * @return The current PluginDErrorListDialogialog instance
135
      * @return The current PluginDErrorListDialogialog instance
126
      */
136
      */
127
-    public static ErrorListDialog getErrorListDialog(final SwingController controller) {
137
+    public static ErrorListDialog getErrorListDialog(final MainFrame mainFrame, 
138
+            final SwingStatusBar statusBar) {
128
         synchronized (ErrorListDialog.class) {
139
         synchronized (ErrorListDialog.class) {
129
             if (me == null) {
140
             if (me == null) {
130
-                me = new ErrorListDialog(controller);
141
+                me = new ErrorListDialog(mainFrame, statusBar);
131
             } else if (me.tableModel.getRowCount() !=
142
             } else if (me.tableModel.getRowCount() !=
132
                     me.errorManager.getErrorCount()) {
143
                     me.errorManager.getErrorCount()) {
133
                 me.tableModel = new ErrorTableModel(me.errorManager.getErrors());
144
                 me.tableModel = new ErrorTableModel(me.errorManager.getErrors());
382
     /** {@inheritDoc} */
393
     /** {@inheritDoc} */
383
     @Override
394
     @Override
384
     public boolean isReady() {
395
     public boolean isReady() {
385
-        if (controller == null) {
386
-            return false;
387
-        }
388
-        return controller.getSwingStatusBar().isVisible();
396
+        return statusBar.isVisible();
389
     }
397
     }
390
     
398
     
391
     /** {@inheritDoc} */
399
     /** {@inheritDoc} */

+ 13
- 14
src/com/dmdirc/addons/ui_swing/dialogs/updater/SwingUpdaterDialog.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.dialogs.updater;
23
 package com.dmdirc.addons.ui_swing.dialogs.updater;
24
 
24
 
25
+import com.dmdirc.addons.ui_swing.MainFrame;
25
 import com.dmdirc.interfaces.UpdateCheckerListener;
26
 import com.dmdirc.interfaces.UpdateCheckerListener;
26
 import com.dmdirc.ui.interfaces.UpdaterDialog;
27
 import com.dmdirc.ui.interfaces.UpdaterDialog;
27
 import com.dmdirc.addons.ui_swing.components.TextLabel;
28
 import com.dmdirc.addons.ui_swing.components.TextLabel;
28
-import com.dmdirc.addons.ui_swing.SwingController;
29
 import com.dmdirc.addons.ui_swing.components.PackingTable;
29
 import com.dmdirc.addons.ui_swing.components.PackingTable;
30
 import com.dmdirc.addons.ui_swing.components.StandardDialog;
30
 import com.dmdirc.addons.ui_swing.components.StandardDialog;
31
 import com.dmdirc.addons.ui_swing.components.renderers.UpdateComponentTableCellRenderer;
31
 import com.dmdirc.addons.ui_swing.components.renderers.UpdateComponentTableCellRenderer;
74
     /** Update.Status renderer. */
74
     /** Update.Status renderer. */
75
     private UpdateStatusTableCellRenderer updateStatusRenderer;
75
     private UpdateStatusTableCellRenderer updateStatusRenderer;
76
     /** Swing controller. */
76
     /** Swing controller. */
77
-    private SwingController controller;
77
+    private MainFrame mainFrame;
78
 
78
 
79
     /**
79
     /**
80
      * Creates a new instance of the updater dialog.
80
      * Creates a new instance of the updater dialog.
81
      * 
81
      * 
82
      * @param updates A list of updates that are available.
82
      * @param updates A list of updates that are available.
83
-     * @param controller Swing controller
83
+     * @param mainFrame Main frame
84
      */
84
      */
85
-    private SwingUpdaterDialog(final List<Update> updates, final SwingController controller) {
86
-        super(controller.getMainFrame(), false);
85
+    private SwingUpdaterDialog(final List<Update> updates, final MainFrame mainFrame) {
86
+        super(mainFrame, ModalityType.MODELESS);
87
         
87
         
88
-        this.controller = controller;
88
+        this.mainFrame = mainFrame;
89
 
89
 
90
         initComponents(updates);
90
         initComponents(updates);
91
         layoutComponents();
91
         layoutComponents();
103
      * Creates the dialog if one doesn't exist, and displays it.
103
      * Creates the dialog if one doesn't exist, and displays it.
104
      * 
104
      * 
105
      * @param updates The updates that are available
105
      * @param updates The updates that are available
106
-     * @param controller Swing controller
106
+     * @param mainFrame Main frame
107
      */
107
      */
108
     public static void showSwingUpdaterDialog(
108
     public static void showSwingUpdaterDialog(
109
-            final List<Update> updates, final SwingController controller) {
110
-        me = getSwingUpdaterDialog(updates, controller);
109
+            final List<Update> updates, final MainFrame mainFrame) {
110
+        me = getSwingUpdaterDialog(updates, mainFrame);
111
         me.display();
111
         me.display();
112
     }
112
     }
113
 
113
 
115
      * Gets the dialog if one doesn't exist.
115
      * Gets the dialog if one doesn't exist.
116
      * 
116
      * 
117
      * @param updates The updates that are available
117
      * @param updates The updates that are available
118
-     * @param controller Swing controller
119
-     * 
118
+     * @param mainFrame Main frame
120
      * @return SwingUpdaterDialog instance
119
      * @return SwingUpdaterDialog instance
121
      */
120
      */
122
     public static SwingUpdaterDialog getSwingUpdaterDialog(
121
     public static SwingUpdaterDialog getSwingUpdaterDialog(
123
-            final List<Update> updates, final SwingController controller) {
122
+            final List<Update> updates, final MainFrame mainFrame) {
124
         synchronized (SwingUpdaterDialog.class) {
123
         synchronized (SwingUpdaterDialog.class) {
125
             if (me == null) {
124
             if (me == null) {
126
-                me = new SwingUpdaterDialog(updates, controller);
125
+                me = new SwingUpdaterDialog(updates, mainFrame);
127
             } else {
126
             } else {
128
                 ((UpdateTableModel) me.table.getModel()).setUpdates(updates);
127
                 ((UpdateTableModel) me.table.getModel()).setUpdates(updates);
129
             }
128
             }
194
     /** {@inheritDoc} */
193
     /** {@inheritDoc} */
195
     @Override
194
     @Override
196
     public void display() {
195
     public void display() {
197
-        setLocationRelativeTo(controller.getMainFrame());
196
+        setLocationRelativeTo(mainFrame);
198
         setVisible(true);
197
         setVisible(true);
199
         requestFocusInWindow();
198
         requestFocusInWindow();
200
     }
199
     }

Loading…
Cancel
Save