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

General tidying of the frame managers.

pull/63/head
Greg Holmes 9 роки тому
джерело
коміт
0ec9c71d1e

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

307
         final FrameToggleButton button = new FrameToggleButton(
307
         final FrameToggleButton button = new FrameToggleButton(
308
                 source.getContainer().getName(),
308
                 source.getContainer().getName(),
309
                 source.getContainer().getIconManager().getIcon(source.getContainer().getIcon()),
309
                 source.getContainer().getIconManager().getIcon(source.getContainer().getIcon()),
310
-                (TextFrame) source, source.getContainer());
310
+                (TextFrame) source);
311
         button.addActionListener(this);
311
         button.addActionListener(this);
312
         button.addMouseListener(this);
312
         button.addMouseListener(this);
313
         button.setHorizontalAlignment(SwingConstants.LEFT);
313
         button.setHorizontalAlignment(SwingConstants.LEFT);

+ 5
- 8
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonPanel.java Переглянути файл

26
 
26
 
27
 import java.awt.Component;
27
 import java.awt.Component;
28
 import java.awt.Dimension;
28
 import java.awt.Dimension;
29
+import java.awt.LayoutManager;
29
 import java.awt.Rectangle;
30
 import java.awt.Rectangle;
30
 import java.awt.event.MouseWheelEvent;
31
 import java.awt.event.MouseWheelEvent;
31
 import java.awt.event.MouseWheelListener;
32
 import java.awt.event.MouseWheelListener;
33
 import javax.swing.JPanel;
34
 import javax.swing.JPanel;
34
 import javax.swing.Scrollable;
35
 import javax.swing.Scrollable;
35
 
36
 
36
-import net.miginfocom.swing.MigLayout;
37
-
38
 /**
37
 /**
39
  * Implements scrollable onto a JPanel so we have more control over scrolling.
38
  * Implements scrollable onto a JPanel so we have more control over scrolling.
40
  */
39
  */
41
-public class ButtonPanel extends JPanel implements Scrollable,
42
-        MouseWheelListener {
40
+public class ButtonPanel extends JPanel implements Scrollable, MouseWheelListener {
43
 
41
 
44
     /** A version number for this class. */
42
     /** A version number for this class. */
45
     private static final long serialVersionUID = 1;
43
     private static final long serialVersionUID = 1;
55
      * @param layout             Layout settings for this ButtonPanel
53
      * @param layout             Layout settings for this ButtonPanel
56
      * @param buttonBar          the buttonBar that created this Panel
54
      * @param buttonBar          the buttonBar that created this Panel
57
      */
55
      */
58
-    public ButtonPanel(final ActiveFrameManager activeFrameManager, final MigLayout layout,
56
+    public ButtonPanel(final ActiveFrameManager activeFrameManager, final LayoutManager layout,
59
             final ButtonBar buttonBar) {
57
             final ButtonBar buttonBar) {
60
         super(layout);
58
         super(layout);
61
 
59
 
65
 
63
 
66
     @Override
64
     @Override
67
     public Dimension getPreferredScrollableViewportSize() {
65
     public Dimension getPreferredScrollableViewportSize() {
68
-        return super.getPreferredSize();
66
+        return getPreferredSize();
69
     }
67
     }
70
 
68
 
71
     @Override
69
     @Override
97
         int newIndex = 0;
95
         int newIndex = 0;
98
         if (e.getWheelRotation() < 0) {
96
         if (e.getWheelRotation() < 0) {
99
             //Up
97
             //Up
100
-            newIndex = selectedIndex > 0 ? selectedIndex - 1
101
-                    : getComponentCount() - 1;
98
+            newIndex = selectedIndex > 0 ? selectedIndex - 1 : getComponentCount() - 1;
102
         } else if (e.getWheelRotation() > 0) {
99
         } else if (e.getWheelRotation() > 0) {
103
             //Down
100
             //Down
104
             newIndex = (selectedIndex + 1) % getComponentCount();
101
             newIndex = (selectedIndex + 1) % getComponentCount();

+ 1
- 16
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/FrameToggleButton.java Переглянути файл

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.framemanager.buttonbar;
23
 package com.dmdirc.addons.ui_swing.framemanager.buttonbar;
24
 
24
 
25
-import com.dmdirc.FrameContainer;
26
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
25
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
27
 
26
 
28
 import javax.swing.Icon;
27
 import javax.swing.Icon;
38
     private static final long serialVersionUID = 1;
37
     private static final long serialVersionUID = 1;
39
     /** Contains the window associated with this button. */
38
     /** Contains the window associated with this button. */
40
     private final TextFrame textFrame;
39
     private final TextFrame textFrame;
41
-    /** The frame container associated with this button. */
42
-    private final FrameContainer frameContainer;
43
 
40
 
44
     /**
41
     /**
45
      * Create a new instance of FrameToggleButton.
42
      * Create a new instance of FrameToggleButton.
47
      * @param text           Text to show
44
      * @param text           Text to show
48
      * @param icon           Icon to show
45
      * @param icon           Icon to show
49
      * @param textFrame      Text frame
46
      * @param textFrame      Text frame
50
-     * @param frameContainer Associated frame container
51
      */
47
      */
52
-    public FrameToggleButton(final String text, final Icon icon, final TextFrame textFrame,
53
-            final FrameContainer frameContainer) {
48
+    public FrameToggleButton(final String text, final Icon icon, final TextFrame textFrame) {
54
         super(text, icon);
49
         super(text, icon);
55
         this.textFrame = textFrame;
50
         this.textFrame = textFrame;
56
-        this.frameContainer = frameContainer;
57
     }
51
     }
58
 
52
 
59
     /**
53
     /**
65
         return textFrame;
59
         return textFrame;
66
     }
60
     }
67
 
61
 
68
-    /**
69
-     * Returns the FrameContainer associated with this button.
70
-     *
71
-     * @return FrameContainer associated with this button
72
-     */
73
-    public FrameContainer getFrameContainer() {
74
-        return frameContainer;
75
-    }
76
-
77
 }
62
 }

+ 18
- 13
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/ctrltab/CtrlTabWindowManager.java Переглянути файл

42
 import com.dmdirc.interfaces.ui.Window;
42
 import com.dmdirc.interfaces.ui.Window;
43
 import com.dmdirc.logger.ErrorLevel;
43
 import com.dmdirc.logger.ErrorLevel;
44
 
44
 
45
+import java.awt.event.InputEvent;
45
 import java.awt.event.KeyEvent;
46
 import java.awt.event.KeyEvent;
46
 import java.util.HashMap;
47
 import java.util.HashMap;
47
 import java.util.Map;
48
 import java.util.Map;
48
 
49
 
49
 import javax.inject.Inject;
50
 import javax.inject.Inject;
50
 import javax.inject.Singleton;
51
 import javax.inject.Singleton;
52
+import javax.swing.InputMap;
51
 import javax.swing.JComponent;
53
 import javax.swing.JComponent;
52
 import javax.swing.KeyStroke;
54
 import javax.swing.KeyStroke;
53
 import javax.swing.tree.DefaultTreeSelectionModel;
55
 import javax.swing.tree.DefaultTreeSelectionModel;
106
 
108
 
107
         activeFrameManager.addSelectionListener(this);
109
         activeFrameManager.addSelectionListener(this);
108
 
110
 
109
-        mainFrame.getRootPane().getActionMap().put("prevFrameAction",
110
-                new PreviousFrameAction(treeScroller));
111
-        mainFrame.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
112
-                .put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
113
-                                KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK),
114
-                        "prevFrameAction");
115
-        mainFrame.getRootPane().getActionMap().put(
116
-                "nextFrameAction", new NextFrameAction(treeScroller));
117
-        mainFrame.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
118
-                .put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
119
-                                KeyEvent.CTRL_DOWN_MASK), "nextFrameAction");
111
+        if (mainFrame.getRootPane().getActionMap() != null) {
112
+            mainFrame.getRootPane().getActionMap()
113
+                    .put("prevFrameAction", new PreviousFrameAction(treeScroller));
114
+            mainFrame.getRootPane().getActionMap()
115
+                    .put("nextFrameAction", new NextFrameAction(treeScroller));
116
+        }
117
+        final InputMap ancestorFocusedMap = mainFrame.getRootPane().getInputMap(
118
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
119
+        if (ancestorFocusedMap != null) {
120
+            ancestorFocusedMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
121
+                    InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK), "prevFrameAction");
122
+            ancestorFocusedMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
123
+                    InputEvent.CTRL_DOWN_MASK),
124
+                    "nextFrameAction");
125
+        }
120
     }
126
     }
121
 
127
 
122
     @Handler
128
     @Handler
158
                 if (node.getLevel() == 0) {
164
                 if (node.getLevel() == 0) {
159
                     eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM,
165
                     eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM,
160
                             new IllegalArgumentException(),
166
                             new IllegalArgumentException(),
161
-                            "delServer triggered for root node" + node.toString(), ""));
167
+                            "delServer triggered for root node" + node, ""));
162
                 } else {
168
                 } else {
163
                     model.removeNodeFromParent(nodes.get(window));
169
                     model.removeNodeFromParent(nodes.get(window));
164
                 }
170
                 }
177
         treeScroller.changeFocus(false);
183
         treeScroller.changeFocus(false);
178
     }
184
     }
179
 
185
 
180
-    /* {@inheritDoc} */
181
     @Override
186
     @Override
182
     public void selectionChanged(final TextFrame window) {
187
     public void selectionChanged(final TextFrame window) {
183
         UIUtilities.invokeLater(new Runnable() {
188
         UIUtilities.invokeLater(new Runnable() {

+ 4
- 51
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/NodeLabel.java Переглянути файл

29
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
29
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
30
 import com.dmdirc.events.FrameIconChangedEvent;
30
 import com.dmdirc.events.FrameIconChangedEvent;
31
 import com.dmdirc.events.FrameNameChangedEvent;
31
 import com.dmdirc.events.FrameNameChangedEvent;
32
-import com.dmdirc.events.NotificationClearedEvent;
33
 import com.dmdirc.events.NotificationSetEvent;
32
 import com.dmdirc.events.NotificationSetEvent;
34
 import com.dmdirc.ui.messages.Styliser;
33
 import com.dmdirc.ui.messages.Styliser;
35
 
34
 
103
 
102
 
104
     @Override
103
     @Override
105
     public void selectionChanged(final TextFrame window) {
104
     public void selectionChanged(final TextFrame window) {
106
-        selected = equals(window.getContainer());
105
+        selected = this.window.equals(window.getContainer());
107
     }
106
     }
108
 
107
 
109
     public void notificationSet(final NotificationSetEvent event) {
108
     public void notificationSet(final NotificationSetEvent event) {
110
             notificationColour = UIUtilities.convertColour(event.getColour());
109
             notificationColour = UIUtilities.convertColour(event.getColour());
111
     }
110
     }
112
 
111
 
113
-    public void notificationCleared(final NotificationClearedEvent event) {
112
+    public void notificationCleared() {
114
             notificationColour = null;
113
             notificationColour = null;
115
     }
114
     }
116
 
115
 
117
     @Handler
116
     @Handler
118
     public void iconChanged(final FrameIconChangedEvent event) {
117
     public void iconChanged(final FrameIconChangedEvent event) {
119
-        if (equals(event.getContainer())) {
118
+        if (window.equals(event.getContainer())) {
120
             icon.setIcon(window.getIconManager().getIcon(event.getIcon()));
119
             icon.setIcon(window.getIconManager().getIcon(event.getIcon()));
121
         }
120
         }
122
     }
121
     }
123
 
122
 
124
     @Handler
123
     @Handler
125
     public void nameChanged(final FrameNameChangedEvent event) {
124
     public void nameChanged(final FrameNameChangedEvent event) {
126
-        if (equals(event.getContainer())) {
125
+        if (window.equals(event.getContainer())) {
127
             text.setText(event.getName());
126
             text.setText(event.getName());
128
         }
127
         }
129
     }
128
     }
164
         return notificationColour;
163
         return notificationColour;
165
     }
164
     }
166
 
165
 
167
-    @Override
168
-    public boolean equals(final Object obj) {
169
-        if (window == null) {
170
-            return false;
171
-        }
172
-
173
-        return window.equals(obj);
174
-    }
175
-
176
     @Override
166
     @Override
177
     public int hashCode() {
167
     public int hashCode() {
178
         if (window == null) {
168
         if (window == null) {
187
         return UIManager.getFont("TextPane.font");
177
         return UIManager.getFont("TextPane.font");
188
     }
178
     }
189
 
179
 
190
-    /**
191
-     * Sets the foreground colour for this label.
192
-     *
193
-     * @param colour New foreground colour
194
-     */
195
     @Override
180
     @Override
196
     public void setForeground(final Color colour) {
181
     public void setForeground(final Color colour) {
197
         if (text != null) {
182
         if (text != null) {
199
         }
184
         }
200
     }
185
     }
201
 
186
 
202
-    /**
203
-     * Sets the background colour for this label.
204
-     *
205
-     * @param colour New background colour
206
-     */
207
     @Override
187
     @Override
208
     public void setBackground(final Color colour) {
188
     public void setBackground(final Color colour) {
209
         if (text != null) {
189
         if (text != null) {
211
         }
191
         }
212
     }
192
     }
213
 
193
 
214
-    /**
215
-     * Sets the font for this label.
216
-     *
217
-     * @param font New font
218
-     */
219
     @Override
194
     @Override
220
     public void setFont(final Font font) {
195
     public void setFont(final Font font) {
221
         if (text != null) {
196
         if (text != null) {
223
         }
198
         }
224
     }
199
     }
225
 
200
 
226
-    /**
227
-     * Sets the opacity of this label.
228
-     *
229
-     * @param opacity Desired opacity
230
-     */
231
     @Override
201
     @Override
232
     public void setOpaque(final boolean opacity) {
202
     public void setOpaque(final boolean opacity) {
233
         if (text != null) {
203
         if (text != null) {
235
         }
205
         }
236
     }
206
     }
237
 
207
 
238
-    /**
239
-     * Sets the text and style in this label.
240
-     *
241
-     * @param styliser   Styliser to use to style text
242
-     * @param styledText Styled text string to use
243
-     */
244
-    public void setStyledText(final Styliser styliser,
245
-            final String styledText) {
246
-        if (currentText.equals(styledText)) {
247
-            return;
248
-        }
249
-        text.setText("");
250
-        currentText = styledText;
251
-        styliser.addStyledString((StyledDocument) text.getDocument(),
252
-                new String[]{styledText,});
253
-    }
254
-
255
     /**
208
     /**
256
      * Sets the styles for the text in this label.
209
      * Sets the styles for the text in this label.
257
      *
210
      *

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

43
 import javax.swing.JPopupMenu;
43
 import javax.swing.JPopupMenu;
44
 import javax.swing.JTree;
44
 import javax.swing.JTree;
45
 import javax.swing.UIManager;
45
 import javax.swing.UIManager;
46
+import javax.swing.tree.DefaultTreeModel;
46
 import javax.swing.tree.TreeModel;
47
 import javax.swing.tree.TreeModel;
47
 import javax.swing.tree.TreePath;
48
 import javax.swing.tree.TreePath;
48
 import javax.swing.tree.TreeSelectionModel;
49
 import javax.swing.tree.TreeSelectionModel;
235
      *
236
      *
236
      * @param e mouse event
237
      * @param e mouse event
237
      */
238
      */
238
-    public void processMouseEvents(final MouseEvent e) {
239
+    void processMouseEvents(final MouseEvent e) {
239
         final TreePath localPath = getPathForLocation(e.getX(), e.getY());
240
         final TreePath localPath = getPathForLocation(e.getX(), e.getY());
240
         if (localPath != null && e.isPopupTrigger()) {
241
         if (localPath != null && e.isPopupTrigger()) {
241
             final TextFrame frame = windowFactory.getSwingWindow(
242
             final TextFrame frame = windowFactory.getSwingWindow(
293
                 }
294
                 }
294
                 break;
295
                 break;
295
             case "Down":
296
             case "Down":
296
-                if (index == (node.getSiblingCount() - 1)) {
297
+                if (index == node.getSiblingCount() - 1) {
297
                     index = 0;
298
                     index = 0;
298
                 } else {
299
                 } else {
299
                     index++;
300
                     index++;
309
         final TreeViewNode parentNode = (TreeViewNode) node.getParent();
310
         final TreeViewNode parentNode = (TreeViewNode) node.getParent();
310
         final TreePath nodePath = new TreePath(node.getPath());
311
         final TreePath nodePath = new TreePath(node.getPath());
311
         final boolean isExpanded = isExpanded(nodePath);
312
         final boolean isExpanded = isExpanded(nodePath);
312
-        ((TreeViewModel) getModel()).removeNodeFromParent(node);
313
+        ((DefaultTreeModel) getModel()).removeNodeFromParent(node);
313
         ((TreeViewModel) getModel()).insertNodeInto(node, parentNode, index);
314
         ((TreeViewModel) getModel()).insertNodeInto(node, parentNode, index);
314
         setExpandedState(nodePath, isExpanded);
315
         setExpandedState(nodePath, isExpanded);
315
     }
316
     }

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

390
             if (event.getWindow() != null && node != null) {
390
             if (event.getWindow() != null && node != null) {
391
                 final NodeLabel label = node.getLabel();
391
                 final NodeLabel label = node.getLabel();
392
                 if (label != null) {
392
                 if (label != null) {
393
-                    label.notificationCleared(event);
393
+                    label.notificationCleared();
394
                     tree.repaint();
394
                     tree.repaint();
395
                 }
395
                 }
396
             }
396
             }

+ 10
- 27
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewModel.java Переглянути файл

27
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
27
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
28
 
28
 
29
 import javax.swing.tree.DefaultTreeModel;
29
 import javax.swing.tree.DefaultTreeModel;
30
+import javax.swing.tree.MutableTreeNode;
31
+import javax.swing.tree.TreeNode;
30
 
32
 
31
 /**
33
 /**
32
  * A simple sorted tree data model based on DefaultTreeModel.
34
  * A simple sorted tree data model based on DefaultTreeModel.
46
      * @param globalConfig The configuration provider to read settings from.
48
      * @param globalConfig The configuration provider to read settings from.
47
      * @param root         a TreeNode object that is the root of the tree.
49
      * @param root         a TreeNode object that is the root of the tree.
48
      */
50
      */
49
-    public TreeViewModel(
50
-            final AggregateConfigProvider globalConfig,
51
-            final TreeViewNode root) {
51
+    public TreeViewModel(final AggregateConfigProvider globalConfig, final TreeNode root) {
52
         super(root, false);
52
         super(root, false);
53
 
53
 
54
         this.globalConfig = globalConfig;
54
         this.globalConfig = globalConfig;
61
      * @param newChild child to be added.
61
      * @param newChild child to be added.
62
      * @param parent   parent child is to be added too.
62
      * @param parent   parent child is to be added too.
63
      */
63
      */
64
-    public final void insertNodeInto(final TreeViewNode newChild,
65
-            final TreeViewNode parent) {
66
-        final int index;
67
-        index = getIndex(newChild, parent);
68
-        insertNodeInto(newChild, parent, index);
69
-    }
70
-
71
-    /**
72
-     * Inserts a new node into the tree and fires the appropriate events.
73
-     *
74
-     * @param newChild child to be added.
75
-     * @param parent   parent child is to be added too.
76
-     * @param index    Index of item to add
77
-     */
78
-    public final void insertNodeInto(final TreeViewNode newChild,
79
-            final TreeViewNode parent, final int index) {
80
-        super.insertNodeInto(newChild, parent, index);
64
+    public final void insertNodeInto(final TreeViewNode newChild, final MutableTreeNode parent) {
65
+        insertNodeInto(newChild, parent, getIndex(newChild, parent));
81
     }
66
     }
82
 
67
 
83
     /**
68
     /**
89
      *
74
      *
90
      * @return index where new node is to be inserted.
75
      * @return index where new node is to be inserted.
91
      */
76
      */
92
-    private int getIndex(final TreeViewNode newChild, final TreeViewNode parent) {
77
+    private int getIndex(final TreeViewNode newChild, final TreeNode parent) {
93
         if (newChild.getWindow() instanceof GlobalWindow) {
78
         if (newChild.getWindow() instanceof GlobalWindow) {
94
             return 0;
79
             return 0;
95
         }
80
         }
101
         if (globalConfig.getOptionBool("ui", "sortchildwindows")) {
86
         if (globalConfig.getOptionBool("ui", "sortchildwindows")) {
102
             for (int i = 0; i < parent.getChildCount(); i++) {
87
             for (int i = 0; i < parent.getChildCount(); i++) {
103
                 final TreeViewNode child = (TreeViewNode) parent.getChildAt(i);
88
                 final TreeViewNode child = (TreeViewNode) parent.getChildAt(i);
104
-                if (sortBefore(newChild, child)) {
105
-                    return i;
106
-                } else if (!sortAfter(newChild, child) && newChild.
107
-                        getUserObject().
108
-                        toString().compareToIgnoreCase(child.getUserObject().
109
-                                toString()) < 0) {
89
+                if (sortBefore(newChild, child)
90
+                        || !sortAfter(newChild, child)
91
+                        && newChild.getUserObject().toString().compareToIgnoreCase(
92
+                        child.getUserObject().toString()) < 0) {
110
                     return i;
93
                     return i;
111
                 }
94
                 }
112
             }
95
             }

+ 1
- 10
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewNodeMenuItem.java Переглянути файл

32
     /** A version number for this class. */
32
     /** A version number for this class. */
33
     private static final long serialVersionUID = 1;
33
     private static final long serialVersionUID = 1;
34
     /** Tree view node. */
34
     /** Tree view node. */
35
-    private TreeViewNode treeNode;
35
+    private final TreeViewNode treeNode;
36
 
36
 
37
     /**
37
     /**
38
      * Creates a new treeviewnodemenuitem.
38
      * Creates a new treeviewnodemenuitem.
58
         return treeNode;
58
         return treeNode;
59
     }
59
     }
60
 
60
 
61
-    /**
62
-     * Set the value of treeNode.
63
-     *
64
-     * @param treeNode new value of treeNode
65
-     */
66
-    public void setTreeNode(final TreeViewNode treeNode) {
67
-        this.treeNode = treeNode;
68
-    }
69
-
70
 }
61
 }

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

110
         if (label == null) {
110
         if (label == null) {
111
             return new JLabel("Label == null");
111
             return new JLabel("Label == null");
112
         }
112
         }
113
-        final boolean bold;
114
         Color background = tree.getBackground();
113
         Color background = tree.getBackground();
115
         Color foreground = tree.getForeground();
114
         Color foreground = tree.getForeground();
116
 
115
 
123
             foreground = colour;
122
             foreground = colour;
124
         }
123
         }
125
 
124
 
125
+        final boolean bold;
126
         if (label.isSelected()) {
126
         if (label.isSelected()) {
127
             bold = activeBold;
127
             bold = activeBold;
128
             if (!tree.getBackground().equals(activeBackground)) {
128
             if (!tree.getBackground().equals(activeBackground)) {

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

46
 import java.util.ArrayList;
46
 import java.util.ArrayList;
47
 import java.util.Collection;
47
 import java.util.Collection;
48
 import java.util.Collections;
48
 import java.util.Collections;
49
+import java.util.Comparator;
49
 import java.util.HashMap;
50
 import java.util.HashMap;
50
 import java.util.Map;
51
 import java.util.Map;
51
 import java.util.concurrent.Callable;
52
 import java.util.concurrent.Callable;
70
     /** A version number for this class. */
71
     /** A version number for this class. */
71
     private static final long serialVersionUID = 1;
72
     private static final long serialVersionUID = 1;
72
     /** Comparator. */
73
     /** Comparator. */
73
-    private final FrameContainerComparator comparator = new FrameContainerComparator();
74
+    private final Comparator<FrameContainer> comparator = new FrameContainerComparator();
74
     /** Non frame container menu count. */
75
     /** Non frame container menu count. */
75
     private final int itemCount;
76
     private final int itemCount;
76
     /** Menu items closing the active window. */
77
     /** Menu items closing the active window. */
388
                 continue;
389
                 continue;
389
             }
390
             }
390
             final FrameContainer child = ((FrameContainerMenuInterface) component).getFrame();
391
             final FrameContainer child = ((FrameContainerMenuInterface) component).getFrame();
391
-            if (sortBefore(newChild, child)) {
392
-                return i;
393
-            } else if (!sortAfter(newChild, child)
392
+            if (sortBefore(newChild, child)
393
+                    || !sortAfter(newChild, child)
394
                     && globalConfig.getOptionBool("treeview", "sortwindows")
394
                     && globalConfig.getOptionBool("treeview", "sortwindows")
395
                     && newChild.getName().compareToIgnoreCase(child.getName()) < 0) {
395
                     && newChild.getName().compareToIgnoreCase(child.getName()) < 0) {
396
                 return i;
396
                 return i;

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