Переглянути джерело

Fixes issue 3802: Sort order of window menu is wrong

Change-Id: I9d31bebe41f89822ff646ca78fb88a5eea92950e
Reviewed-on: http://gerrit.dmdirc.com/907
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.6.3
Gregory Holmes 14 роки тому
джерело
коміт
e44f50fca1

+ 3
- 6
src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/FrameContainerMenu.java Переглянути файл

@@ -41,7 +41,7 @@ import javax.swing.SwingUtilities;
41 41
  * Frame container JMenu.
42 42
  */
43 43
 public class FrameContainerMenu extends JMenu implements FrameInfoListener,
44
-        ActionListener, SelectionListener {
44
+        ActionListener, SelectionListener, FrameContainerMenuIterface {
45 45
 
46 46
     /**
47 47
      * A version number for this class. It should be changed whenever the class
@@ -129,11 +129,8 @@ public class FrameContainerMenu extends JMenu implements FrameInfoListener,
129 129
         setFont(getFont().deriveFont(Font.ITALIC));
130 130
     }
131 131
 
132
-    /**
133
-     * Returns the wrapped frame container.
134
-     *
135
-     * @return Wrapped frame container
136
-     */
132
+    /** {@inheritDoc} */
133
+    @Override
137 134
     public FrameContainer getFrame() {
138 135
         return frame;
139 136
     }

+ 3
- 6
src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/FrameContainerMenuItem.java Переглянути файл

@@ -40,7 +40,7 @@ import javax.swing.SwingUtilities;
40 40
  * Action representing a frame.
41 41
  */
42 42
 public class FrameContainerMenuItem extends JMenuItem implements FrameInfoListener,
43
-        ActionListener, SelectionListener {
43
+        ActionListener, SelectionListener, FrameContainerMenuIterface {
44 44
 
45 45
     /**
46 46
      * A version number for this class. It should be changed whenever the class
@@ -126,11 +126,8 @@ public class FrameContainerMenuItem extends JMenuItem implements FrameInfoListen
126 126
         }
127 127
     }
128 128
 
129
-    /**
130
-     * Returns the wrapped frame container.
131
-     * 
132
-     * @return Wrapped frame container
133
-     */
129
+    /** {@inheritDoc} */
130
+    @Override
134 131
     public FrameContainer getFrame() {
135 132
         return frame;
136 133
     }

+ 38
- 0
src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/FrameContainerMenuIterface.java Переглянути файл

@@ -0,0 +1,38 @@
1
+/*
2
+ * Copyright (c) 2006-2010 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.addons.ui_swing.framemanager.windowmenu;
24
+
25
+import com.dmdirc.FrameContainer;
26
+
27
+/**
28
+ * Interface to define a menu or menu item that holds a framecontainer.
29
+ */
30
+public interface FrameContainerMenuIterface {
31
+
32
+    /**
33
+     * Returns the wrapped frame container.
34
+     *
35
+     * @return Wrapped frame container
36
+     */
37
+    public FrameContainer getFrame();
38
+}

+ 3
- 3
src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/WindowMenuFrameManager.java Переглянути файл

@@ -323,11 +323,11 @@ public final class WindowMenuFrameManager extends JMenu implements
323 323
     private int getIndex(final FrameContainer newChild, final JMenu menu) {
324 324
         final int count = menu == this ? itemCount : 0;
325 325
         for (int i = count; i < menu.getMenuComponentCount(); i++) {
326
-            if (!(menu.getMenuComponent(i) instanceof FrameContainerMenuItem)) {
326
+            if (!(menu.getMenuComponent(i) instanceof FrameContainerMenuIterface)) {
327 327
                 continue;
328 328
             }
329
-            final FrameContainer child =
330
-                    ((FrameContainerMenuItem) menu.getMenuComponent(i)).getFrame();
329
+            final FrameContainer child = ((FrameContainerMenuIterface)
330
+                    menu.getMenuComponent(i)).getFrame();
331 331
             if (sortBefore(newChild, child)) {
332 332
                 return i;
333 333
             } else if (!sortAfter(newChild, child) && IdentityManager.

Завантаження…
Відмінити
Зберегти