Browse Source

Fixes issue 3725: AED Doesnt resize correctly when you show/hide substitutions

Change-Id: Id941aae4a913529a6ad12a1baf9d070f400e02b4
Reviewed-on: http://gerrit.dmdirc.com/847
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3
Gregory Holmes 14 years ago
parent
commit
bd45a6943d

+ 31
- 23
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionEditorDialog.java View File

1
 /*
1
 /*
2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
3
+ *
4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
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
5
  * of this software and associated documentation files (the "Software"), to deal
6
  * in the Software without restriction, including without limitation the rights
6
  * in the Software without restriction, including without limitation the rights
7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
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
8
  * copies of the Software, and to permit persons to whom the Software is
9
  * furnished to do so, subject to the following conditions:
9
  * furnished to do so, subject to the following conditions:
10
- * 
10
+ *
11
  * The above copyright notice and this permission notice shall be included in
11
  * The above copyright notice and this permission notice shall be included in
12
  * all copies or substantial portions of the Software.
12
  * all copies or substantial portions of the Software.
13
- * 
13
+ *
14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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,
15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
 import java.beans.PropertyChangeListener;
33
 import java.beans.PropertyChangeListener;
34
 
34
 
35
 import javax.swing.JButton;
35
 import javax.swing.JButton;
36
+import javax.swing.SwingUtilities;
36
 
37
 
37
 import net.miginfocom.swing.MigLayout;
38
 import net.miginfocom.swing.MigLayout;
38
 
39
 
73
     /** Action group. */
74
     /** Action group. */
74
     private String group;
75
     private String group;
75
 
76
 
76
-    /** 
77
+    /**
77
      * Instantiates the panel.
78
      * Instantiates the panel.
78
-     * 
79
+     *
79
      * @param window Parent window
80
      * @param window Parent window
80
      * @param group Action's group
81
      * @param group Action's group
81
      */
82
      */
83
         this(window, group, null);
84
         this(window, group, null);
84
     }
85
     }
85
 
86
 
86
-    /** 
87
+    /**
87
      * Instantiates the panel.
88
      * Instantiates the panel.
88
-     * 
89
+     *
89
      * @param window Parent window
90
      * @param window Parent window
90
      * @param action Action to be edited
91
      * @param action Action to be edited
91
      * @param group Action's group
92
      * @param group Action's group
103
         addListeners();
104
         addListeners();
104
         doComponents();
105
         doComponents();
105
         layoutComponents();
106
         layoutComponents();
106
-        
107
+
107
         setResizable(false);
108
         setResizable(false);
108
     }
109
     }
109
-    
110
+
110
     /**
111
     /**
111
      * Is the dialog open?
112
      * Is the dialog open?
112
-     * 
113
+     *
113
      * @return is the dialog open
114
      * @return is the dialog open
114
      */
115
      */
115
     public static boolean isOpen() {
116
     public static boolean isOpen() {
118
         }
119
         }
119
     }
120
     }
120
 
121
 
121
-    /** 
122
-     * Creates the dialog if one doesn't exist, and displays it. 
123
-     * 
122
+    /**
123
+     * Creates the dialog if one doesn't exist, and displays it.
124
+     *
124
      * @param window Parent window
125
      * @param window Parent window
125
      * @param group Action's group
126
      * @param group Action's group
126
      */
127
      */
129
         showActionEditorDialog(window, group, null);
130
         showActionEditorDialog(window, group, null);
130
     }
131
     }
131
 
132
 
132
-    /** 
133
-     * Creates the dialog if one doesn't exist, and displays it. 
134
-     * 
133
+    /**
134
+     * Creates the dialog if one doesn't exist, and displays it.
135
+     *
135
      * @param window Parent window
136
      * @param window Parent window
136
      * @param group Action's group
137
      * @param group Action's group
137
      * @param action Action to be edited
138
      * @param action Action to be edited
148
      *
149
      *
149
      * @param window Parent window
150
      * @param window Parent window
150
      * @param group Action's group
151
      * @param group Action's group
151
-     * 
152
+     *
152
      * @return The current ActionEditorDialog instance
153
      * @return The current ActionEditorDialog instance
153
      */
154
      */
154
     public static ActionEditorDialog getActionEditorDialog(final Window window,
155
     public static ActionEditorDialog getActionEditorDialog(final Window window,
158
 
159
 
159
     /**
160
     /**
160
      * Returns the current instance of the ActionEditorDialog.
161
      * Returns the current instance of the ActionEditorDialog.
161
-     * 
162
+     *
162
      * @param window Parent window
163
      * @param window Parent window
163
      * @param group Action's group
164
      * @param group Action's group
164
      * @param action Action to be edited
165
      * @param action Action to be edited
236
         add(getRightButton(), "right, sgx button");
237
         add(getRightButton(), "right, sgx button");
237
     }
238
     }
238
 
239
 
239
-    /** 
240
+    /**
240
      * @{inheritDoc}
241
      * @{inheritDoc}
241
-     * 
242
+     *
242
      * @param e Action event
243
      * @param e Action event
243
      */
244
      */
244
     @Override
245
     @Override
247
             substitutions.setVisible(!substitutions.isVisible());
248
             substitutions.setVisible(!substitutions.isVisible());
248
             showSubstitutions.setText(substitutions.isVisible() ? "Hide Substitutions"
249
             showSubstitutions.setText(substitutions.isVisible() ? "Hide Substitutions"
249
                     : "Show Substitutions");
250
                     : "Show Substitutions");
250
-            pack();
251
+                    pack();
251
         } else if (e.getSource().equals(getOkButton())) {
252
         } else if (e.getSource().equals(getOkButton())) {
252
             save();
253
             save();
253
             dispose();
254
             dispose();
260
     @Override
261
     @Override
261
     public void validate() {
262
     public void validate() {
262
         super.validate();
263
         super.validate();
263
-        
264
-        centreOnOwner();
264
+
265
+        SwingUtilities.invokeLater(new Runnable() {
266
+
267
+            /** {@inheritDoc} */
268
+            @Override
269
+            public void run() {
270
+                centreOnOwner();
271
+            }
272
+        });
265
     }
273
     }
266
 
274
 
267
     /** Saves the action being edited. */
275
     /** Saves the action being edited. */

Loading…
Cancel
Save