Parcourir la source

Fixes issue 2980: Table in NickColours>Colours in prefs dialog displays first time and vanishes on subsequent views

Change-Id: I8d9a4c4b310eec49a9042efd9801cdc9ccf2fb29
Reviewed-on: http://gerrit.dmdirc.com/327
Tested-by: Gregory Holmes <greboid@dmdirc.com>
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3
Gregory Holmes il y a 14 ans
Parent
révision
09dc756d0a

+ 0
- 1
src/com/dmdirc/addons/ui_swing/dialogs/prefs/CategoryPanel.java Voir le fichier

@@ -33,7 +33,6 @@ import java.awt.Window;
33 33
 import java.util.Collections;
34 34
 import java.util.HashMap;
35 35
 import java.util.Map;
36
-import java.util.concurrent.atomic.AtomicBoolean;
37 36
 
38 37
 import javax.swing.BorderFactory;
39 38
 import javax.swing.JPanel;

+ 82
- 0
src/com/dmdirc/addons/ui_swing/dialogs/prefs/NoRemovePanel.java Voir le fichier

@@ -0,0 +1,82 @@
1
+/*
2
+ * 
3
+ * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
+ * 
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ * 
12
+ * The above copyright notice and this permission notice shall be included in
13
+ * all copies or substantial portions of the Software.
14
+ * 
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+
24
+package com.dmdirc.addons.ui_swing.dialogs.prefs;
25
+
26
+import java.awt.Component;
27
+import java.awt.LayoutManager;
28
+
29
+import javax.swing.JPanel;
30
+
31
+/**
32
+ * Creates a new JPanel that prevents components from being removed.
33
+ */
34
+public class NoRemovePanel extends JPanel {
35
+
36
+    /**
37
+     * A version number for this class. It should be changed whenever the
38
+     * class structure is changed (or anything else that would prevent
39
+     * serialized objects being unserialized with the new class).
40
+     */
41
+    private static final long serialVersionUID = 1;
42
+
43
+    /**
44
+     * Creates a new JPanel that prevents components being removed.
45
+     */
46
+    public NoRemovePanel() {
47
+    }
48
+
49
+    /**
50
+     * Creates a new JPanel that prevents components being removed.
51
+     *
52
+     * @param isDoubleBuffered Use double buffering?
53
+     */
54
+    public NoRemovePanel(boolean isDoubleBuffered) {
55
+        super(isDoubleBuffered);
56
+    }
57
+
58
+    /**
59
+     * Creates a new JPanel that prevents components being removed.
60
+     *
61
+     * @param layout Layout manager
62
+     */
63
+    public NoRemovePanel(LayoutManager layout) {
64
+        super(layout);
65
+    }
66
+
67
+    /**
68
+     * Creates a new JPanel that prevents components being removed.
69
+     *
70
+     * @param layout Layout manager
71
+     * @param isDoubleBuffered Use double buffering?
72
+     */
73
+    public NoRemovePanel(LayoutManager layout, boolean isDoubleBuffered) {
74
+        super(layout, isDoubleBuffered);
75
+    }
76
+
77
+    /** {@inheritDoc} */
78
+    @Override
79
+    public void remove(final Component comp) {
80
+        //Ignore
81
+    }
82
+}

+ 5
- 3
src/com/dmdirc/addons/ui_swing/dialogs/prefs/PrefsCategoryLoader.java Voir le fichier

@@ -244,9 +244,10 @@ public class PrefsCategoryLoader extends SwingWorker<JPanel, Object> {
244 244
     private void addInlineCategory(final PreferencesCategory category,
245 245
             final JPanel parent) {
246 246
         final JPanel panel =
247
-                new JPanel(new MigLayout("fillx, gap unrel, wrap 2, hidemode 3, pack, " +
248
-                "wmax 470-" + leftPadding + "-" +
247
+                new NoRemovePanel(new MigLayout("fillx, gap unrel, wrap 2, " +
248
+                "hidemode 3, pack, wmax 470-" + leftPadding + "-" +
249 249
                 rightPadding + "-2*" + padding));
250
+        panel.setName(category.getPath());
250 251
         panel.setBorder(BorderFactory.createTitledBorder(UIManager.getBorder(
251 252
                 "TitledBorder.border"), category.getTitle()));
252 253
 
@@ -264,9 +265,10 @@ public class PrefsCategoryLoader extends SwingWorker<JPanel, Object> {
264 265
      */
265 266
     private JPanel addCategory(final PreferencesCategory category) {
266 267
         final JPanel panel =
267
-                new JPanel(new MigLayout("fillx, gap unrel, " +
268
+                new NoRemovePanel(new MigLayout("fillx, gap unrel, " +
268 269
                 "wrap 2, hidemode 3, wmax 470-" + leftPadding + "-" +
269 270
                 rightPadding + "-2*" + padding));
271
+        panel.setName(category.getPath());
270 272
         final String path = category.getPath();
271 273
 
272 274
         initCategory(category, panel, path);

Chargement…
Annuler
Enregistrer