Selaa lähdekoodia

fixes issue 2906

tags/0.6.3m2a1
Gregory Holmes 15 vuotta sitten
vanhempi
commit
8edefc4137

+ 1
- 1
src/com/dmdirc/addons/ui_swing/SwingController.java Näytä tiedosto

509
     /** {@inheritDoc} */
509
     /** {@inheritDoc} */
510
     @Override
510
     @Override
511
     public PreferencesInterface getPluginPrefsPanel() {
511
     public PreferencesInterface getPluginPrefsPanel() {
512
-        return new PluginPanel();
512
+        return new PluginPanel(me);
513
     }
513
     }
514
 
514
 
515
     /** {@inheritDoc} */
515
     /** {@inheritDoc} */

+ 9
- 2
src/com/dmdirc/addons/ui_swing/components/SwingInputField.java Näytä tiedosto

31
 
31
 
32
 import com.dmdirc.util.ReturnableThread;
32
 import com.dmdirc.util.ReturnableThread;
33
 import java.awt.Color;
33
 import java.awt.Color;
34
+import java.awt.Window;
34
 import java.awt.event.ActionEvent;
35
 import java.awt.event.ActionEvent;
35
 import java.awt.event.ActionListener;
36
 import java.awt.event.ActionListener;
36
 import java.awt.event.KeyEvent;
37
 import java.awt.event.KeyEvent;
63
     private final JLabel errorIndicator;
64
     private final JLabel errorIndicator;
64
     /** Listener list. */
65
     /** Listener list. */
65
     private final ListenerList listeners;
66
     private final ListenerList listeners;
67
+    /** Parent Window. */
68
+    private final Window parentWindow;
66
 
69
 
67
     /**
70
     /**
68
      * Instantiates a new swing input field.
71
      * Instantiates a new swing input field.
72
+     *
73
+     * @param parentWindow Parent window
69
      */
74
      */
70
-    public SwingInputField() {
75
+    public SwingInputField(final Window parentWindow) {
71
         super();
76
         super();
72
 
77
 
78
+        this.parentWindow = parentWindow;
79
+
73
         listeners = new ListenerList();
80
         listeners = new ListenerList();
74
 
81
 
75
         textField = new JTextField();
82
         textField = new JTextField();
133
             public void run() {
140
             public void run() {
134
                 if (IdentityManager.getGlobalConfig().getOptionBool("general",
141
                 if (IdentityManager.getGlobalConfig().getOptionBool("general",
135
                         "showcolourdialog")) {
142
                         "showcolourdialog")) {
136
-                    colourPicker = new ColourPickerDialog(irc, hex);
143
+                    colourPicker = new ColourPickerDialog(irc, hex, parentWindow);
137
                     colourPicker.addActionListener(new ActionListener() {
144
                     colourPicker.addActionListener(new ActionListener() {
138
 
145
 
139
                         @Override
146
                         @Override

+ 9
- 8
src/com/dmdirc/addons/ui_swing/components/addonbrowser/BrowserWindow.java Näytä tiedosto

23
 package com.dmdirc.addons.ui_swing.components.addonbrowser;
23
 package com.dmdirc.addons.ui_swing.components.addonbrowser;
24
 
24
 
25
 import com.dmdirc.Main;
25
 import com.dmdirc.Main;
26
-import com.dmdirc.addons.ui_swing.MainFrame;
26
+import com.dmdirc.ui.CoreUIUtils;
27
 import com.dmdirc.util.ConfigFile;
27
 import com.dmdirc.util.ConfigFile;
28
 import com.dmdirc.util.InvalidConfigFileException;
28
 import com.dmdirc.util.InvalidConfigFileException;
29
 
29
 
30
+import java.awt.Window;
30
 import java.awt.event.ActionEvent;
31
 import java.awt.event.ActionEvent;
31
 import java.awt.event.ActionListener;
32
 import java.awt.event.ActionListener;
32
 import java.io.File;
33
 import java.io.File;
96
 
97
 
97
     /**
98
     /**
98
      * Creates and displays a new browser window.
99
      * Creates and displays a new browser window.
100
+     *
101
+     * @param parentWindow Parent window
99
      */
102
      */
100
-    public BrowserWindow() {
101
-        super((MainFrame) Main.getUI().getMainWindow(), "DMDirc Addon Browser",
102
-                false);
103
-        setIconImage(((MainFrame) Main.getUI().getMainWindow()).getIcon().
104
-                getImage());
103
+    public BrowserWindow(final Window parentWindow) {
104
+        super(parentWindow, "DMDirc Addon Browser", ModalityType.MODELESS);
105
+        setIconImages(parentWindow.getIconImages());
105
         setResizable(false);
106
         setResizable(false);
106
         setLayout(new MigLayout("fill, wmin 650, hmin 600"));
107
         setLayout(new MigLayout("fill, wmin 650, hmin 600"));
107
         scrollPane.getVerticalScrollBar().setUnitIncrement(15);
108
         scrollPane.getVerticalScrollBar().setUnitIncrement(15);
158
         }
159
         }
159
 
160
 
160
         pack();
161
         pack();
161
-        setLocationRelativeTo((MainFrame) Main.getUI().getMainWindow());
162
+        setLocationRelativeTo(parentWindow);
162
         setVisible(true);
163
         setVisible(true);
163
-        setLocationRelativeTo((MainFrame) Main.getUI().getMainWindow());
164
+        setLocationRelativeTo(parentWindow);
164
     }
165
     }
165
 
166
 
166
     /**
167
     /**

+ 12
- 6
src/com/dmdirc/addons/ui_swing/components/addonbrowser/DownloaderWindow.java Näytä tiedosto

6
 package com.dmdirc.addons.ui_swing.components.addonbrowser;
6
 package com.dmdirc.addons.ui_swing.components.addonbrowser;
7
 
7
 
8
 import com.dmdirc.Main;
8
 import com.dmdirc.Main;
9
-import com.dmdirc.addons.ui_swing.MainFrame;
10
 import com.dmdirc.ui.CoreUIUtils;
9
 import com.dmdirc.ui.CoreUIUtils;
11
 import com.dmdirc.util.DownloadListener;
10
 import com.dmdirc.util.DownloadListener;
12
 import com.dmdirc.util.Downloader;
11
 import com.dmdirc.util.Downloader;
13
 
12
 
13
+import java.awt.Window;
14
 import java.io.File;
14
 import java.io.File;
15
 import java.io.IOException;
15
 import java.io.IOException;
16
 
16
 
33
     private static final long serialVersionUID = 1;
33
     private static final long serialVersionUID = 1;
34
     /** Downloader progress bar. */
34
     /** Downloader progress bar. */
35
     private final JProgressBar jpb = new JProgressBar(0, 100);
35
     private final JProgressBar jpb = new JProgressBar(0, 100);
36
+    /** Parent window. */
37
+    private Window parentWindow;
36
 
38
 
37
-    /** Instantiates a new downloader window. */
38
-    public DownloaderWindow() {
39
-        super((MainFrame) Main.getUI().getMainWindow(), "DMDirc Addon Browser",
40
-                false);
39
+    /**
40
+     * Instantiates a new downloader window.
41
+     *
42
+     * @param parentWindow Parent window
43
+     */
44
+    public DownloaderWindow(final Window parentWindow) {
45
+        super(parentWindow, "DMDirc Addon Browser", ModalityType.MODELESS);
46
+        this.parentWindow = parentWindow;
41
         setTitle("Downloading addon information...");
47
         setTitle("Downloading addon information...");
42
         setLayout(new MigLayout("fill"));
48
         setLayout(new MigLayout("fill"));
43
         add(jpb, "grow");
49
         add(jpb, "grow");
56
         try {
62
         try {
57
             Downloader.downloadPage("http://addons.dmdirc.com/feed", 
63
             Downloader.downloadPage("http://addons.dmdirc.com/feed", 
58
                     Main.getConfigDir() + File.separator + "addons.feed", this);
64
                     Main.getConfigDir() + File.separator + "addons.feed", this);
59
-            new BrowserWindow();
65
+            new BrowserWindow(parentWindow);
60
         } catch (IOException ex) {
66
         } catch (IOException ex) {
61
             removeAll();
67
             removeAll();
62
             add(new JLabel("Unable to download feed."));
68
             add(new JLabel("Unable to download feed."));

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java Näytä tiedosto

132
      * Initialises the components for this frame.
132
      * Initialises the components for this frame.
133
      */
133
      */
134
     private void initComponents() {
134
     private void initComponents() {
135
-        setInputField(new SwingInputField());
135
+        setInputField(new SwingInputField(getController().getMainFrame()));
136
 
136
 
137
         getInputField().addKeyListener(this);
137
         getInputField().addKeyListener(this);
138
         getInputField().addMouseListener(this);
138
         getInputField().addMouseListener(this);

+ 12
- 3
src/com/dmdirc/addons/ui_swing/components/pluginpanel/PluginPanel.java Näytä tiedosto

31
 import com.dmdirc.addons.ui_swing.components.renderers.AddonCellRenderer;
31
 import com.dmdirc.addons.ui_swing.components.renderers.AddonCellRenderer;
32
 import com.dmdirc.addons.ui_swing.dialogs.prefs.SwingPreferencesDialog;
32
 import com.dmdirc.addons.ui_swing.dialogs.prefs.SwingPreferencesDialog;
33
 
33
 
34
+import java.awt.Window;
34
 import java.awt.event.ActionEvent;
35
 import java.awt.event.ActionEvent;
35
 import java.awt.event.ActionListener;
36
 import java.awt.event.ActionListener;
36
 import java.util.Collections;
37
 import java.util.Collections;
69
     private int selectedPlugin;
70
     private int selectedPlugin;
70
     /** Blurb label. */
71
     /** Blurb label. */
71
     private TextLabel blurbLabel;
72
     private TextLabel blurbLabel;
73
+    /** Parent Window. */
74
+    private Window parentWindow;
72
 
75
 
73
-    /** Creates a new instance of PluginDialog. */
74
-    public PluginPanel() {
76
+    /**
77
+     * Creates a new instance of PluginDialog.
78
+     *
79
+     * @param parentWindow Parent window
80
+     */
81
+    public PluginPanel(final Window parentWindow) {
75
         super();
82
         super();
76
 
83
 
84
+        this.parentWindow = parentWindow;
85
+
77
         initComponents();
86
         initComponents();
78
         addListeners();
87
         addListeners();
79
         layoutComponents();
88
         layoutComponents();
179
 
188
 
180
             pluginList.repaint();
189
             pluginList.repaint();
181
         } else if (e.getSource() != toggleButton) {
190
         } else if (e.getSource() != toggleButton) {
182
-            new DownloaderWindow();
191
+            new DownloaderWindow(parentWindow);
183
         }
192
         }
184
     }
193
     }
185
 
194
 

+ 4
- 0
src/com/dmdirc/ui/CoreUIUtils.java Näytä tiedosto

32
  * Core UI Utilities.
32
  * Core UI Utilities.
33
  */
33
  */
34
 public class CoreUIUtils {
34
 public class CoreUIUtils {
35
+
36
+    /** Precent creation. */
37
+    private CoreUIUtils() {
38
+    }
35
     
39
     
36
     /**
40
     /**
37
      * Centre the specified window on the active monitor.
41
      * Centre the specified window on the active monitor.

Loading…
Peruuta
Tallenna