Sfoglia il codice sorgente

Remove deprecated methods.

Change-Id: I9c0f0cc56b11844399b95a19cc855771984d03a0
Depends-On: Iddf8113511c0b8787d182e8f6d856f10beaabd84
Reviewed-on: http://gerrit.dmdirc.com/3296
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
changes/96/3296/2
Greg Holmes 10 anni fa
parent
commit
0caa76eb3c

+ 0
- 9
src/com/dmdirc/addons/ui_swing/SwingController.java Vedi File

@@ -28,7 +28,6 @@ import com.dmdirc.addons.ui_swing.commands.Input;
28 28
 import com.dmdirc.addons.ui_swing.commands.PopInCommand;
29 29
 import com.dmdirc.addons.ui_swing.commands.PopOutCommand;
30 30
 import com.dmdirc.addons.ui_swing.commands.ServerSettings;
31
-import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
32 31
 import com.dmdirc.addons.ui_swing.dialogs.error.ErrorListDialog;
33 32
 import com.dmdirc.addons.ui_swing.framemanager.FrameManagerProvider;
34 33
 import com.dmdirc.addons.ui_swing.injection.SwingModule;
@@ -41,7 +40,6 @@ import com.dmdirc.interfaces.config.AggregateConfigProvider;
41 40
 import com.dmdirc.interfaces.config.ConfigProvider;
42 41
 import com.dmdirc.interfaces.config.IdentityController;
43 42
 import com.dmdirc.interfaces.ui.UIController;
44
-import com.dmdirc.interfaces.ui.Window;
45 43
 import com.dmdirc.logger.ErrorLevel;
46 44
 import com.dmdirc.logger.Logger;
47 45
 import com.dmdirc.plugins.Exported;
@@ -629,13 +627,6 @@ public class SwingController extends BaseCommandPlugin implements UIController {
629 627
         getMainFrame().getJMenuBar().addMenuItem(parentMenu, menuItem);
630 628
     }
631 629
 
632
-    @Override
633
-    public void requestWindowFocus(final Window window) {
634
-        if (window instanceof TextFrame) {
635
-            getMainFrame().setActiveFrame((TextFrame) window);
636
-        }
637
-    }
638
-
639 630
     /**
640 631
      * Returns the version of this swing UI.
641 632
      *

+ 5
- 4
src/com/dmdirc/addons/ui_swing/SwingLinkHandler.java Vedi File

@@ -33,6 +33,7 @@ import com.dmdirc.ui.core.util.URLHandler;
33 33
 import com.google.common.eventbus.Subscribe;
34 34
 
35 35
 import javax.inject.Inject;
36
+import javax.inject.Provider;
36 37
 import javax.inject.Singleton;
37 38
 
38 39
 /**
@@ -42,16 +43,16 @@ import javax.inject.Singleton;
42 43
 public class SwingLinkHandler {
43 44
 
44 45
     private final URLHandler urlHandler;
45
-    private final SwingController controller;
46
+    private final Provider<MainFrame> mainFrame;
46 47
     private final SwingWindowFactory windowFactory;
47 48
 
48 49
     @Inject
49 50
     public SwingLinkHandler(
50
-            final SwingController controller,
51
+            final Provider<MainFrame> mainFrame,
51 52
             final URLHandler urlHandler,
52 53
             final SwingWindowFactory windowFactory) {
53 54
         this.urlHandler = urlHandler;
54
-        this.controller = controller;
55
+        this.mainFrame = mainFrame;
55 56
         this.windowFactory = windowFactory;
56 57
     }
57 58
 
@@ -74,7 +75,7 @@ public class SwingLinkHandler {
74 75
         final FrameContainer container = event.getWindow().getContainer();
75 76
         final Connection connection = container.getConnection();
76 77
         if (connection != null) {
77
-            controller.requestWindowFocus(
78
+            mainFrame.get().setActiveFrame(
78 79
                     windowFactory.getSwingWindow(connection.getQuery(event.getTarget())));
79 80
         }
80 81
     }

+ 7
- 6
src/com/dmdirc/addons/ui_swing/SwingWindowFactory.java Vedi File

@@ -46,6 +46,7 @@ import java.util.Map;
46 46
 import java.util.Set;
47 47
 
48 48
 import javax.inject.Inject;
49
+import javax.inject.Provider;
49 50
 import javax.inject.Singleton;
50 51
 
51 52
 /**
@@ -60,15 +61,15 @@ public class SwingWindowFactory implements FrameListener {
60 61
     private final Map<Collection<String>, WindowProvider> implementations = new HashMap<>();
61 62
     /** A map of frame containers to their Swing windows. */
62 63
     private final Map<FrameContainer, TextFrame> windows = new HashMap<>();
63
-    /** The controller that owns this window factory. */
64
-    private final SwingController controller;
64
+    /** The provider to get the main frame to focus frames. */
65
+    private final Provider<MainFrame> mainFrameProvider;
65 66
     /** Our list of listeners. */
66 67
     private final ListenerList listeners = new ListenerList();
67 68
 
68 69
     /**
69 70
      * Creates a new window factory for the specified controller.
70 71
      *
71
-     * @param controller              The controller this factory is for
72
+     * @param mainFrameProvider       The provider to get the main frame to focus frames.
72 73
      * @param customFrameFactory      The factory to use to produce custom frames.
73 74
      * @param customInputFrameFactory The factory to use to produce custom input frames.
74 75
      * @param serverFrameFactory      The factory to use to produce server frames.
@@ -77,13 +78,13 @@ public class SwingWindowFactory implements FrameListener {
77 78
      */
78 79
     @Inject
79 80
     public SwingWindowFactory(
80
-            final SwingController controller,
81
+            final Provider<MainFrame> mainFrameProvider,
81 82
             final CustomFrameFactory customFrameFactory,
82 83
             final CustomInputFrameFactory customInputFrameFactory,
83 84
             final ServerFrameFactory serverFrameFactory,
84 85
             final ChannelFrameFactory channelFrameFactory,
85 86
             final GlobalCommandParser commandParser) {
86
-        this.controller = controller;
87
+        this.mainFrameProvider = mainFrameProvider;
87 88
 
88 89
         // TODO: Allow auto-factories to implement an interface and simplify this a bit.
89 90
         registerImplementation(
@@ -228,7 +229,7 @@ public class SwingWindowFactory implements FrameListener {
228 229
                 }
229 230
 
230 231
                 if (focus) {
231
-                    controller.requestWindowFocus(childWindow);
232
+                    mainFrameProvider.get().setActiveFrame(childWindow);
232 233
                 }
233 234
             }
234 235
         });

+ 5
- 8
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java Vedi File

@@ -26,7 +26,6 @@ import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.FrameContainer;
27 27
 import com.dmdirc.FrameContainerComparator;
28 28
 import com.dmdirc.addons.ui_swing.MainFrame;
29
-import com.dmdirc.addons.ui_swing.SwingController;
30 29
 import com.dmdirc.addons.ui_swing.SwingWindowFactory;
31 30
 import com.dmdirc.addons.ui_swing.UIUtilities;
32 31
 import com.dmdirc.addons.ui_swing.actions.CloseFrameContainerAction;
@@ -114,7 +113,6 @@ public final class ButtonBar implements FrameManager, ActionListener,
114 113
     /**
115 114
      * Creates a new instance of ButtonBar.
116 115
      *
117
-     * @param controller        The controller to use to change window focus.
118 116
      * @param windowFactory     The factory to use to retrieve window information.
119 117
      * @param windowManager     The window manager to use to read window state.
120 118
      * @param globalConfig      Global configuration to read settings from.
@@ -122,7 +120,6 @@ public final class ButtonBar implements FrameManager, ActionListener,
122 120
      */
123 121
     @Inject
124 122
     public ButtonBar(
125
-            final SwingController controller,
126 123
             final SwingWindowFactory windowFactory,
127 124
             @GlobalConfig final AggregateConfigProvider globalConfig,
128 125
             final WindowManager windowManager,
@@ -144,10 +141,10 @@ public final class ButtonBar implements FrameManager, ActionListener,
144 141
                 globalConfig.getOption("ui", "framemanagerPosition"));
145 142
 
146 143
         if (position.isHorizontal()) {
147
-            buttonPanel = new ButtonPanel(controller,
144
+            buttonPanel = new ButtonPanel(mainFrameProvider,
148 145
                     new MigLayout("ins rel, fill, flowx"), this);
149 146
         } else {
150
-            buttonPanel = new ButtonPanel(controller,
147
+            buttonPanel = new ButtonPanel(mainFrameProvider,
151 148
                     new MigLayout("ins rel, fill, flowy"), this);
152 149
         }
153 150
         scrollPane.getViewport().addMouseWheelListener(buttonPanel);
@@ -309,7 +306,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
309 306
         final FrameToggleButton button = new FrameToggleButton(
310 307
                 source.getContainer().getName(),
311 308
                 source.getContainer().getIconManager().getIcon(source.getContainer().getIcon()),
312
-                source);
309
+                (TextFrame) source, source.getContainer());
313 310
         button.addActionListener(this);
314 311
         button.addMouseListener(this);
315 312
         button.setHorizontalAlignment(SwingConstants.LEFT);
@@ -369,7 +366,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
369 366
     @Override
370 367
     public void actionPerformed(final ActionEvent e) {
371 368
         final FrameToggleButton button = (FrameToggleButton) e.getSource();
372
-        final TextFrame frame = (TextFrame) button.getWindow();
369
+        final TextFrame frame = button.getTextFrame();
373 370
         if (frame != null && frame.equals(activeWindow)) {
374 371
             button.setSelected(true);
375 372
         }
@@ -512,7 +509,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
512 509
         if (e.isPopupTrigger()) {
513 510
             final FrameToggleButton button = (FrameToggleButton) e.getSource();
514 511
 
515
-            final TextFrame frame = (TextFrame) button.getWindow();
512
+            final TextFrame frame = button.getTextFrame();
516 513
             if (frame == null) {
517 514
                 return;
518 515
             }

+ 12
- 17
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonPanel.java Vedi File

@@ -22,7 +22,7 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.framemanager.buttonbar;
24 24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.addons.ui_swing.MainFrame;
26 26
 
27 27
 import java.awt.Component;
28 28
 import java.awt.Dimension;
@@ -30,6 +30,7 @@ import java.awt.Rectangle;
30 30
 import java.awt.event.MouseWheelEvent;
31 31
 import java.awt.event.MouseWheelListener;
32 32
 
33
+import javax.inject.Provider;
33 34
 import javax.swing.JPanel;
34 35
 import javax.swing.Scrollable;
35 36
 
@@ -37,35 +38,29 @@ import net.miginfocom.swing.MigLayout;
37 38
 
38 39
 /**
39 40
  * Implements scrollable onto a JPanel so we have more control over scrolling.
40
- *
41
- * @since 0.6.4
42 41
  */
43 42
 public class ButtonPanel extends JPanel implements Scrollable,
44 43
         MouseWheelListener {
45 44
 
46
-    /**
47
-     * A version number for this class. It should be changed whenever the class structure is changed
48
-     * (or anything else that would prevent serialized objects being unserialized with the new
49
-     * class).
50
-     */
45
+    /** A version number for this class. */
51 46
     private static final long serialVersionUID = 1;
52
-    /** The controller that owns this panel. */
53
-    private final SwingController controller;
47
+    /** The provider to get the main frame to set the active frame. */
48
+    private final Provider<MainFrame> mainFrameProvider;
54 49
     /** The ButtonBar that created this Panel. */
55 50
     private final ButtonBar buttonBar;
56 51
 
57 52
     /**
58 53
      * Constructor for ButtonPanel.
59 54
      *
60
-     * @param controller The controller that owns this panel
61
-     * @param layout     Layout settings for this ButtonPanel
62
-     * @param buttonBar  the buttonBar that created this Panel
55
+     * @param mainFrameProvider The provider to get the main frame to set the active frame.
56
+     * @param layout            Layout settings for this ButtonPanel
57
+     * @param buttonBar         the buttonBar that created this Panel
63 58
      */
64
-    public ButtonPanel(final SwingController controller, final MigLayout layout,
59
+    public ButtonPanel(final Provider<MainFrame> mainFrameProvider, final MigLayout layout,
65 60
             final ButtonBar buttonBar) {
66 61
         super(layout);
67 62
 
68
-        this.controller = controller;
63
+        this.mainFrameProvider = mainFrameProvider;
69 64
         this.buttonBar = buttonBar;
70 65
     }
71 66
 
@@ -110,8 +105,8 @@ public class ButtonPanel extends JPanel implements Scrollable,
110 105
             newIndex = (selectedIndex + 1) % getComponentCount();
111 106
         }
112 107
 
113
-        controller.requestWindowFocus(
114
-                ((FrameToggleButton) getComponent(newIndex)).getWindow());
108
+        mainFrameProvider.get().setActiveFrame(
109
+                ((FrameToggleButton) getComponent(newIndex)).getTextFrame());
115 110
     }
116 111
 
117 112
     /**

+ 17
- 18
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/FrameToggleButton.java Vedi File

@@ -23,38 +23,37 @@
23 23
 package com.dmdirc.addons.ui_swing.framemanager.buttonbar;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.interfaces.ui.Window;
26
+import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
27 27
 
28 28
 import javax.swing.Icon;
29 29
 import javax.swing.JToggleButton;
30 30
 
31
+
31 32
 /**
32 33
  * Custom toggle button that contains Window information for this button.
33
- *
34
- * @author Simon Mott
35
- * @since 0.6.4
36 34
  */
37 35
 public class FrameToggleButton extends JToggleButton {
38 36
 
39
-    /**
40
-     * A version number for this class. It should be changed whenever the class structure is changed
41
-     * (or anything else that would prevent serialized objects being unserialized with the new
42
-     * class).
43
-     */
37
+    /** A version number for this class. */
44 38
     private static final long serialVersionUID = 1;
45 39
     /** Contains the window associated with this button. */
46
-    private final Window window;
40
+    private final TextFrame textFrame;
41
+    /** The frame container associated with this button. */
42
+    private final FrameContainer frameContainer;
47 43
 
48 44
     /**
49 45
      * Create a new instance of FrameToggleButton.
50 46
      *
51
-     * @param text   Text to show
52
-     * @param icon   Icon to show
53
-     * @param window Parent window
47
+     * @param text           Text to show
48
+     * @param icon           Icon to show
49
+     * @param textFrame      Text frame
50
+     * @param frameContainer Associated frame container
54 51
      */
55
-    public FrameToggleButton(final String text, final Icon icon, final Window window) {
52
+    public FrameToggleButton(final String text, final Icon icon, final TextFrame textFrame,
53
+            final FrameContainer frameContainer) {
56 54
         super(text, icon);
57
-        this.window = window;
55
+        this.textFrame = textFrame;
56
+        this.frameContainer = frameContainer;
58 57
     }
59 58
 
60 59
     /**
@@ -62,8 +61,8 @@ public class FrameToggleButton extends JToggleButton {
62 61
      *
63 62
      * @return Window associated with this button
64 63
      */
65
-    public Window getWindow() {
66
-        return window;
64
+    public TextFrame getTextFrame() {
65
+        return textFrame;
67 66
     }
68 67
 
69 68
     /**
@@ -72,7 +71,7 @@ public class FrameToggleButton extends JToggleButton {
72 71
      * @return FrameContainer associated with this button
73 72
      */
74 73
     public FrameContainer getFrameContainer() {
75
-        return window.getContainer();
74
+        return frameContainer;
76 75
     }
77 76
 
78 77
 }

+ 15
- 18
src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java Vedi File

@@ -22,7 +22,7 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.framemanager.tree;
24 24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.addons.ui_swing.MainFrame;
26 26
 import com.dmdirc.addons.ui_swing.SwingWindowFactory;
27 27
 import com.dmdirc.addons.ui_swing.UIUtilities;
28 28
 import com.dmdirc.addons.ui_swing.actions.CloseFrameContainerAction;
@@ -37,6 +37,7 @@ import java.awt.event.MouseEvent;
37 37
 import java.awt.event.MouseListener;
38 38
 import java.awt.event.MouseMotionListener;
39 39
 
40
+import javax.inject.Provider;
40 41
 import javax.swing.BorderFactory;
41 42
 import javax.swing.JComponent;
42 43
 import javax.swing.JMenuItem;
@@ -55,16 +56,12 @@ import net.miginfocom.layout.PlatformDefaults;
55 56
 public class Tree extends JTree implements MouseMotionListener,
56 57
         ConfigChangeListener, MouseListener, ActionListener {
57 58
 
58
-    /**
59
-     * A version number for this class. It should be changed whenever the class structure is changed
60
-     * (or anything else that would prevent serialized objects being unserialized with the new
61
-     * class).
62
-     */
59
+    /** A version number for this class. */
63 60
     private static final long serialVersionUID = 1;
64 61
     /** Tree frame manager. */
65 62
     private final TreeFrameManager manager;
66
-    /** UI Controller. */
67
-    private final SwingController controller;
63
+    /** The provider to use to retrieve the current main frame.. */
64
+    private final Provider<MainFrame> mainFrameProvider;
68 65
     /** Config manager. */
69 66
     private final AggregateConfigProvider config;
70 67
     /** Drag selection enabled? */
@@ -79,26 +76,26 @@ public class Tree extends JTree implements MouseMotionListener,
79 76
     /**
80 77
      * Specialised JTree for frame manager.
81 78
      *
82
-     * @param manager       Frame manager
83
-     * @param model         tree model.
84
-     * @param controller    Swing controller
85
-     * @param globalConfig  The config to read settings from.
86
-     * @param domain        The domain to read settings from.
87
-     * @param windowFactory The factory to use to get swing windows.
79
+     * @param manager           Frame manager
80
+     * @param model             tree model.
81
+     * @param mainFrameProvider The provider to use to retrieve the current main frame.
82
+     * @param globalConfig      The config to read settings from.
83
+     * @param domain            The domain to read settings from.
84
+     * @param windowFactory     The factory to use to get swing windows.
88 85
      */
89 86
     public Tree(
90 87
             final TreeFrameManager manager,
91 88
             final TreeModel model,
92
-            final SwingController controller,
89
+            final Provider<MainFrame> mainFrameProvider,
93 90
             final AggregateConfigProvider globalConfig,
94 91
             final SwingWindowFactory windowFactory,
95 92
             final String domain) {
96 93
         super(model);
97 94
 
98 95
         this.manager = manager;
99
-        this.controller = controller;
100 96
         this.config = globalConfig;
101 97
         this.windowFactory = windowFactory;
98
+        this.mainFrameProvider = mainFrameProvider;
102 99
 
103 100
         putClientProperty("JTree.lineStyle", "Angled");
104 101
         getInputMap().setParent(null);
@@ -191,7 +188,7 @@ public class Tree extends JTree implements MouseMotionListener,
191 188
         if (dragSelect && dragButton) {
192 189
             final TreeViewNode node = getNodeForLocation(e.getX(), e.getY());
193 190
             if (node != null) {
194
-                controller.requestWindowFocus(windowFactory.getSwingWindow(
191
+                mainFrameProvider.get().setActiveFrame(windowFactory.getSwingWindow(
195 192
                         ((TreeViewNode) new TreePath(node.getPath()).getLastPathComponent())
196 193
                         .getWindow()));
197 194
             }
@@ -231,7 +228,7 @@ public class Tree extends JTree implements MouseMotionListener,
231 228
             final TreePath selectedPath = getPathForLocation(e.getX(),
232 229
                     e.getY());
233 230
             if (selectedPath != null) {
234
-                controller.requestWindowFocus(windowFactory.getSwingWindow(
231
+                mainFrameProvider.get().setActiveFrame(windowFactory.getSwingWindow(
235 232
                         ((TreeViewNode) selectedPath.getLastPathComponent()).getWindow()));
236 233
             }
237 234
         }

+ 2
- 7
src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeFrameManager.java Vedi File

@@ -78,8 +78,6 @@ public class TreeFrameManager implements FrameManager,
78 78
     private TreeViewModel model;
79 79
     /** node storage, used for adding and deleting nodes correctly. */
80 80
     private final Map<FrameContainer, TreeViewNode> nodes;
81
-    /** UI Controller. */
82
-    private final SwingController controller;
83 81
     /** Tree scroller. */
84 82
     private TreeScroller scroller;
85 83
     /** Configuration manager. */
@@ -96,7 +94,6 @@ public class TreeFrameManager implements FrameManager,
96 94
     /**
97 95
      * Creates a new instance of the TreeFrameManager.
98 96
      *
99
-     * @param controller        The controller to use to switch windows.
100 97
      * @param windowManager     The window manager to use to read window state.
101 98
      * @param globalConfig      The provider to read config settings from.
102 99
      * @param colourManager     The colour manager to use to retrieve colours.
@@ -106,7 +103,6 @@ public class TreeFrameManager implements FrameManager,
106 103
      */
107 104
     @Inject
108 105
     public TreeFrameManager(
109
-            final SwingController controller,
110 106
             final WindowManager windowManager,
111 107
             @GlobalConfig final AggregateConfigProvider globalConfig,
112 108
             final ColourManager colourManager,
@@ -116,7 +112,6 @@ public class TreeFrameManager implements FrameManager,
116 112
         this.windowFactory = windowFactory;
117 113
         this.windowManager = windowManager;
118 114
         this.nodes = new HashMap<>();
119
-        this.controller = controller;
120 115
         this.config = globalConfig;
121 116
         this.colourManager = colourManager;
122 117
 
@@ -124,7 +119,7 @@ public class TreeFrameManager implements FrameManager,
124 119
             @Override
125 120
             public void run() {
126 121
                 model = new TreeViewModel(config, new TreeViewNode(null, null));
127
-                tree = new Tree(TreeFrameManager.this, model, controller, globalConfig,
122
+                tree = new Tree(TreeFrameManager.this, model, mainFrameProvider, globalConfig,
128 123
                         windowFactory, domain);
129 124
                 tree.setCellRenderer(new TreeViewTreeCellRenderer(config, colourManager,
130 125
                         TreeFrameManager.this));
@@ -322,7 +317,7 @@ public class TreeFrameManager implements FrameManager,
322 317
                 if (scroller != null) {
323 318
                     scroller.unregister();
324 319
                 }
325
-                scroller = new TreeTreeScroller(controller, windowFactory, tree);
320
+                scroller = new TreeTreeScroller(mainFrameProvider, windowFactory, tree);
326 321
 
327 322
                 for (FrameContainer window : windowManager.getRootWindows()) {
328 323
                     addWindow(null, window);

+ 10
- 9
src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeTreeScroller.java Vedi File

@@ -22,12 +22,13 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.framemanager.tree;
24 24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.addons.ui_swing.MainFrame;
26 26
 import com.dmdirc.addons.ui_swing.SwingWindowFactory;
27 27
 import com.dmdirc.addons.ui_swing.components.TreeScroller;
28 28
 import com.dmdirc.logger.ErrorLevel;
29 29
 import com.dmdirc.logger.Logger;
30 30
 
31
+import javax.inject.Provider;
31 32
 import javax.swing.tree.TreePath;
32 33
 
33 34
 /**
@@ -35,25 +36,25 @@ import javax.swing.tree.TreePath;
35 36
  */
36 37
 public class TreeTreeScroller extends TreeScroller {
37 38
 
38
-    /** The Swing Controller that owns this scroller. */
39
-    private final SwingController controller;
39
+    /** Main frame provider. */
40
+    private final Provider<MainFrame> mainFrameProvider;
40 41
     /** Factory to use to retrieve swing windows. */
41 42
     private final SwingWindowFactory windowFactory;
42 43
 
43 44
     /**
44 45
      * Creates a new Tree scroller for the tree view.
45 46
      *
46
-     * @param controller    The Swing Controller that owns this item
47
-     * @param windowFactory Factory to use to retrieve swing windows.
48
-     * @param tree          Tree view tree
47
+     * @param mainFrameProvider Main frame provider.
48
+     * @param windowFactory     Factory to use to retrieve swing windows.
49
+     * @param tree              Tree view tree
49 50
      */
50 51
     public TreeTreeScroller(
51
-            final SwingController controller,
52
+            final Provider<MainFrame> mainFrameProvider,
52 53
             final SwingWindowFactory windowFactory,
53 54
             final Tree tree) {
54 55
         super(tree);
55 56
 
56
-        this.controller = controller;
57
+        this.mainFrameProvider = mainFrameProvider;
57 58
         this.windowFactory = windowFactory;
58 59
     }
59 60
 
@@ -76,7 +77,7 @@ public class TreeTreeScroller extends TreeScroller {
76 77
         }
77 78
         super.setPath(path);
78 79
 
79
-        controller.requestWindowFocus(windowFactory.getSwingWindow(
80
+        mainFrameProvider.get().setActiveFrame(windowFactory.getSwingWindow(
80 81
                 ((TreeViewNode) path.getLastPathComponent()).getWindow()));
81 82
     }
82 83
 

+ 8
- 7
src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/FrameContainerMenu.java Vedi File

@@ -23,8 +23,8 @@
23 23
 package com.dmdirc.addons.ui_swing.framemanager.windowmenu;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
+import com.dmdirc.addons.ui_swing.MainFrame;
26 27
 import com.dmdirc.addons.ui_swing.SelectionListener;
27
-import com.dmdirc.addons.ui_swing.SwingController;
28 28
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
29 29
 import com.dmdirc.interfaces.FrameInfoListener;
30 30
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
@@ -33,6 +33,7 @@ import java.awt.Font;
33 33
 import java.awt.event.ActionEvent;
34 34
 import java.awt.event.ActionListener;
35 35
 
36
+import javax.inject.Provider;
36 37
 import javax.swing.JMenu;
37 38
 import javax.swing.SwingUtilities;
38 39
 
@@ -44,8 +45,8 @@ public class FrameContainerMenu extends JMenu implements FrameInfoListener,
44 45
 
45 46
     /** A version number for this class. */
46 47
     private static final long serialVersionUID = 1;
47
-    /** The swing controller that owns this item. */
48
-    private final SwingController controller;
48
+    /** The provider to get the main frame to set the active frame. */
49
+    private final Provider<MainFrame> mainFrameProvider;
49 50
     /** The swing frame. */
50 51
     private final TextFrame window;
51 52
     /** Wrapped frame. */
@@ -54,21 +55,21 @@ public class FrameContainerMenu extends JMenu implements FrameInfoListener,
54 55
     /**
55 56
      * Instantiates a new FrameContainer menu item wrapping the specified frame.
56 57
      *
57
-     * @param controller   Controller
58
+     * @param mainFrameProvider   The provider to get the main frame to set the active frame.
58 59
      * @param globalConfig The config to read settings from
59 60
      * @param domain       The domain to read settings from
60 61
      * @param window       The swing window being wrapped
61 62
      * @param frame        Wrapped frame
62 63
      */
63 64
     public FrameContainerMenu(
64
-            final SwingController controller,
65
+            final Provider<MainFrame> mainFrameProvider,
65 66
             final AggregateConfigProvider globalConfig,
66 67
             final String domain,
67 68
             final TextFrame window,
68 69
             final FrameContainer frame) {
69 70
         super(frame.getName());
70 71
 
71
-        this.controller = controller;
72
+        this.mainFrameProvider = mainFrameProvider;
72 73
         this.window = window;
73 74
         this.frame = frame;
74 75
 
@@ -117,7 +118,7 @@ public class FrameContainerMenu extends JMenu implements FrameInfoListener,
117 118
      */
118 119
     @Override
119 120
     public void actionPerformed(final ActionEvent e) {
120
-        controller.requestWindowFocus(window);
121
+        mainFrameProvider.get().setActiveFrame(window);
121 122
     }
122 123
 
123 124
     @Override

+ 11
- 10
src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/FrameContainerMenuItem.java Vedi File

@@ -23,8 +23,8 @@
23 23
 package com.dmdirc.addons.ui_swing.framemanager.windowmenu;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
+import com.dmdirc.addons.ui_swing.MainFrame;
26 27
 import com.dmdirc.addons.ui_swing.SelectionListener;
27
-import com.dmdirc.addons.ui_swing.SwingController;
28 28
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
29 29
 import com.dmdirc.interfaces.FrameInfoListener;
30 30
 import com.dmdirc.ui.messages.Styliser;
@@ -33,6 +33,7 @@ import java.awt.Font;
33 33
 import java.awt.event.ActionEvent;
34 34
 import java.awt.event.ActionListener;
35 35
 
36
+import javax.inject.Provider;
36 37
 import javax.swing.JMenuItem;
37 38
 import javax.swing.SwingUtilities;
38 39
 
@@ -44,8 +45,8 @@ public class FrameContainerMenuItem extends JMenuItem implements FrameInfoListen
44 45
 
45 46
     /** A version number for this class. */
46 47
     private static final long serialVersionUID = 1;
47
-    /** The swing controller that owns this item. */
48
-    private final SwingController controller;
48
+    /** The provider to retrieve the mainframe to set active frames. */
49
+    private final Provider<MainFrame> mainFrameProvider;
49 50
     /** Wrapped frame. */
50 51
     private final FrameContainer frame;
51 52
     /** Swing window. */
@@ -56,19 +57,19 @@ public class FrameContainerMenuItem extends JMenuItem implements FrameInfoListen
56 57
     /**
57 58
      * Instantiates a new FrameContainer menu item wrapping the specified frame.
58 59
      *
59
-     * @param controller The Swing Controller that owns this item
60
-     * @param frame      Wrapped frame
61
-     * @param window     The window this menu item corresponds to.
62
-     * @param manager    Parent window menu frame manager.
60
+     * @param mainFrameProvider The provider to retrieve the mainframe to set active frames.
61
+     * @param frame             Wrapped frame
62
+     * @param window            The window this menu item corresponds to.
63
+     * @param manager           Parent window menu frame manager.
63 64
      */
64 65
     public FrameContainerMenuItem(
65
-            final SwingController controller,
66
+            final Provider<MainFrame> mainFrameProvider,
66 67
             final FrameContainer frame,
67 68
             final TextFrame window,
68 69
             final WindowMenuFrameManager manager) {
69 70
         super(frame.getName(), frame.getIconManager().getIcon(frame.getIcon()));
70 71
 
71
-        this.controller = controller;
72
+        this.mainFrameProvider = mainFrameProvider;
72 73
         this.frame = frame;
73 74
         this.window = window;
74 75
         this.manager = manager;
@@ -110,7 +111,7 @@ public class FrameContainerMenuItem extends JMenuItem implements FrameInfoListen
110 111
 
111 112
     @Override
112 113
     public void actionPerformed(final ActionEvent e) {
113
-        controller.requestWindowFocus(window);
114
+        mainFrameProvider.get().setActiveFrame(window);
114 115
     }
115 116
 
116 117
     @Override

+ 10
- 13
src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/WindowMenuFrameManager.java Vedi File

@@ -48,6 +48,7 @@ import java.util.concurrent.Callable;
48 48
 import java.util.concurrent.atomic.AtomicBoolean;
49 49
 
50 50
 import javax.inject.Inject;
51
+import javax.inject.Provider;
51 52
 import javax.inject.Singleton;
52 53
 import javax.swing.AbstractButton;
53 54
 import javax.swing.JMenu;
@@ -62,11 +63,7 @@ import javax.swing.JSeparator;
62 63
 public class WindowMenuFrameManager extends JMenu implements
63 64
         SwingWindowListener, ActionListener, SelectionListener {
64 65
 
65
-    /**
66
-     * A version number for this class. It should be changed whenever the class structure is changed
67
-     * (or anything else that would prevent serialized objects being unserialized with the new
68
-     * class).
69
-     */
66
+    /** A version number for this class. */
70 67
     private static final long serialVersionUID = 1;
71 68
     /** Comparator. */
72 69
     private final FrameContainerComparator comparator = new FrameContainerComparator();
@@ -85,7 +82,7 @@ public class WindowMenuFrameManager extends JMenu implements
85 82
     private final Map<FrameContainer, FrameContainerMenuItem> items;
86 83
     private final Map<FrameContainer, FrameContainerMenuItem> menuItems;
87 84
 
88
-    private final MainFrame mainFrame;
85
+    private final Provider<MainFrame> mainFrame;
89 86
     private final AggregateConfigProvider globalConfig;
90 87
     private final String domain;
91 88
 
@@ -106,7 +103,7 @@ public class WindowMenuFrameManager extends JMenu implements
106 103
             @GlobalConfig final AggregateConfigProvider globalConfig,
107 104
             @PluginDomain(SwingController.class) final String domain,
108 105
             final SwingWindowFactory windowFactory,
109
-            final MainFrame mainFrame) {
106
+            final Provider<MainFrame> mainFrame) {
110 107
         this.controller = controller;
111 108
         this.globalConfig = globalConfig;
112 109
         this.domain = domain;
@@ -135,7 +132,7 @@ public class WindowMenuFrameManager extends JMenu implements
135 132
 
136 133
         itemCount = getMenuComponentCount();
137 134
 
138
-        mainFrame.addSelectionListener(this);
135
+        mainFrame.get().addSelectionListener(this);
139 136
 
140 137
         new WindowMenuScroller(this, globalConfig, domain, itemCount);
141 138
         checkMenuItems();
@@ -159,7 +156,7 @@ public class WindowMenuFrameManager extends JMenu implements
159 156
                         @Override
160 157
                         public FrameContainerMenuItem call() {
161 158
                             return new FrameContainerMenuItem(
162
-                                    controller,
159
+                                    mainFrame,
163 160
                                     window.getContainer(),
164 161
                                     window,
165 162
                                     WindowMenuFrameManager.this);
@@ -181,7 +178,7 @@ public class WindowMenuFrameManager extends JMenu implements
181 178
                         @Override
182 179
                         public FrameContainerMenuItem call() {
183 180
                             return new FrameContainerMenuItem(
184
-                                    controller,
181
+                                    mainFrame,
185 182
                                     window.getContainer(),
186 183
                                     window,
187 184
                                     WindowMenuFrameManager.this);
@@ -195,7 +192,7 @@ public class WindowMenuFrameManager extends JMenu implements
195 192
                             @Override
196 193
                             public FrameContainerMenu call() {
197 194
                                 return new FrameContainerMenu(
198
-                                        controller,
195
+                                        mainFrame,
199 196
                                         globalConfig,
200 197
                                         domain,
201 198
                                         parent,
@@ -257,7 +254,7 @@ public class WindowMenuFrameManager extends JMenu implements
257 254
                                     getContainer()),
258 255
                                     menus.get(parent.getContainer()),
259 256
                                     new FrameContainerMenuItem(
260
-                                            controller,
257
+                                            mainFrame,
261 258
                                             parent.getContainer(),
262 259
                                             parent,
263 260
                                             WindowMenuFrameManager.this));
@@ -314,7 +311,7 @@ public class WindowMenuFrameManager extends JMenu implements
314 311
     @Override
315 312
     public void actionPerformed(final ActionEvent e) {
316 313
         if (enabledMenuItems.get() && e.getActionCommand().equals("Close")) {
317
-            mainFrame.getActiveFrame().getContainer().close();
314
+            mainFrame.get().getActiveFrame().getContainer().close();
318 315
         }
319 316
     }
320 317
 

+ 0
- 6
src/com/dmdirc/addons/ui_web/WebInterfaceUI.java Vedi File

@@ -26,7 +26,6 @@ import com.dmdirc.ServerManager;
26 26
 import com.dmdirc.addons.ui_web.uicomponents.WebStatusBar;
27 27
 import com.dmdirc.interfaces.config.IdentityController;
28 28
 import com.dmdirc.interfaces.ui.UIController;
29
-import com.dmdirc.interfaces.ui.Window;
30 29
 import com.dmdirc.plugins.PluginDomain;
31 30
 import com.dmdirc.plugins.PluginManager;
32 31
 import com.dmdirc.ui.WindowManager;
@@ -151,9 +150,4 @@ public class WebInterfaceUI implements UIController {
151 150
         // Do nothing
152 151
     }
153 152
 
154
-    @Override
155
-    public void requestWindowFocus(final Window window) {
156
-        // TODO: Tell clients to focus
157
-    }
158
-
159 153
 }

Loading…
Annulla
Salva