浏览代码

Massive window changes.

See corresponding core change for full details.

Change-Id: I6ddf872aa7073dd9306a17f6ae03c462a5898296
Reviewed-on: http://gerrit.dmdirc.com/1143
Automatic-Compile: Gregory Holmes <greg@dmdirc.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4
Chris Smith 14 年前
父节点
当前提交
ae3eb43d28
共有 66 个文件被更改,包括 623 次插入590 次删除
  1. 1
    2
      src/com/dmdirc/addons/audio/AudioCommand.java
  2. 1
    1
      src/com/dmdirc/addons/audio/BeepCommand.java
  3. 1
    1
      src/com/dmdirc/addons/calc/CalcCommand.java
  4. 3
    5
      src/com/dmdirc/addons/dcc/DCCChatWindow.java
  5. 2
    2
      src/com/dmdirc/addons/dcc/DCCCommand.java
  6. 4
    4
      src/com/dmdirc/addons/dcc/DCCCommandParser.java
  7. 16
    52
      src/com/dmdirc/addons/dcc/DCCFrame.java
  8. 4
    3
      src/com/dmdirc/addons/dcc/DCCPlugin.java
  9. 3
    2
      src/com/dmdirc/addons/dcc/DCCTransferWindow.java
  10. 1
    2
      src/com/dmdirc/addons/dcop/DcopCommand.java
  11. 1
    1
      src/com/dmdirc/addons/dns/DNSCommand.java
  12. 1
    1
      src/com/dmdirc/addons/freedesktop_notifications/FDNotifyCommand.java
  13. 5
    5
      src/com/dmdirc/addons/lagdisplay/LagDisplayPlugin.java
  14. 5
    18
      src/com/dmdirc/addons/logging/HistoryWindow.java
  15. 3
    11
      src/com/dmdirc/addons/logging/LoggingCommand.java
  16. 13
    14
      src/com/dmdirc/addons/logging/LoggingPlugin.java
  17. 1
    1
      src/com/dmdirc/addons/nickcolours/NickColourPanel.java
  18. 2
    3
      src/com/dmdirc/addons/nickcolours/NickColourPlugin.java
  19. 3
    3
      src/com/dmdirc/addons/nowplaying/NowPlayingCommand.java
  20. 1
    1
      src/com/dmdirc/addons/osd/OsdCommand.java
  21. 0
    193
      src/com/dmdirc/addons/redirect/FakeInputWindow.java
  22. 94
    0
      src/com/dmdirc/addons/redirect/FakeWriteableFrameContainer.java
  23. 3
    3
      src/com/dmdirc/addons/redirect/RedirectCommand.java
  24. 2
    1
      src/com/dmdirc/addons/scriptplugin/ScriptCommand.java
  25. 1
    1
      src/com/dmdirc/addons/systray/PopupCommand.java
  26. 3
    3
      src/com/dmdirc/addons/time/TimedCommand.java
  27. 2
    2
      src/com/dmdirc/addons/time/TimerCommand.java
  28. 1
    1
      src/com/dmdirc/addons/ui_dummy/DummyChannelWindow.java
  29. 2
    3
      src/com/dmdirc/addons/ui_dummy/DummyController.java
  30. 5
    5
      src/com/dmdirc/addons/ui_dummy/DummyFrameManager.java
  31. 13
    4
      src/com/dmdirc/addons/ui_dummy/DummyInputWindow.java
  32. 2
    2
      src/com/dmdirc/addons/ui_dummy/DummyQueryWindow.java
  33. 11
    26
      src/com/dmdirc/addons/ui_swing/MainFrame.java
  34. 21
    7
      src/com/dmdirc/addons/ui_swing/SwingController.java
  35. 185
    0
      src/com/dmdirc/addons/ui_swing/SwingWindowFactory.java
  36. 15
    28
      src/com/dmdirc/addons/ui_swing/components/MDIBar.java
  37. 3
    3
      src/com/dmdirc/addons/ui_swing/components/MenuBar.java
  38. 1
    1
      src/com/dmdirc/addons/ui_swing/components/ToolTipPanel.java
  39. 1
    1
      src/com/dmdirc/addons/ui_swing/components/TopicBar.java
  40. 22
    34
      src/com/dmdirc/addons/ui_swing/components/desktopPane/DMDircDesktopPane.java
  41. 3
    2
      src/com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.java
  42. 1
    1
      src/com/dmdirc/addons/ui_swing/components/frames/CustomFrame.java
  43. 5
    3
      src/com/dmdirc/addons/ui_swing/components/frames/CustomInputFrame.java
  44. 6
    4
      src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java
  45. 2
    2
      src/com/dmdirc/addons/ui_swing/components/frames/QueryFrame.java
  46. 2
    2
      src/com/dmdirc/addons/ui_swing/components/frames/ServerFrame.java
  47. 13
    15
      src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java
  48. 2
    2
      src/com/dmdirc/addons/ui_swing/components/reorderablelist/ArrayListTransferable.java
  49. 20
    20
      src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java
  50. 15
    16
      src/com/dmdirc/addons/ui_swing/framemanager/tree/NodeLabel.java
  51. 32
    19
      src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java
  52. 12
    14
      src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeFrameManager.java
  53. 5
    5
      src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewModel.java
  54. 6
    5
      src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewNode.java
  55. 2
    2
      src/com/dmdirc/addons/ui_web/WebInterfaceUI.java
  56. 5
    5
      src/com/dmdirc/addons/ui_web/uicomponents/WebFrameManager.java
  57. 4
    3
      src/com/dmdirc/addons/ui_web/uicomponents/WebInputWindow.java
  58. 13
    3
      src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java
  59. 1
    1
      src/com/dmdirc/addons/urlcatcher/UrlCatcherPlugin.java
  60. 1
    1
      src/com/dmdirc/addons/urlcatcher/UrlListCommand.java
  61. 2
    2
      src/com/dmdirc/addons/userlevel/AccessLevelComponent.java
  62. 2
    2
      src/com/dmdirc/addons/userlevel/ChannelAccessLevelComponent.java
  63. 3
    3
      src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java
  64. 1
    1
      test/com/dmdirc/addons/redirect/RedirectCommandTest.java
  65. 6
    6
      test/com/dmdirc/addons/ui_swing/components/frames/InputTextFrameTest.java
  66. 1
    1
      test/com/dmdirc/addons/urlcatcher/UrlCatcherPluginTest.java

+ 1
- 2
src/com/dmdirc/addons/audio/AudioCommand.java 查看文件

@@ -26,7 +26,6 @@ import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.commandparser.CommandArguments;
27 27
 import com.dmdirc.commandparser.CommandManager;
28 28
 import com.dmdirc.commandparser.commands.GlobalCommand;
29
-import com.dmdirc.ui.interfaces.InputWindow;
30 29
 
31 30
 import java.io.File;
32 31
 
@@ -47,7 +46,7 @@ public final class AudioCommand extends GlobalCommand {
47 46
 
48 47
     /** {@inheritDoc} */
49 48
     @Override
50
-    public void execute(final FrameContainer origin, final boolean isSilent,
49
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
51 50
                         final CommandArguments args) {
52 51
         final String filename = args.getArgumentsAsString();
53 52
         final File file = new File(filename);

+ 1
- 1
src/com/dmdirc/addons/audio/BeepCommand.java 查看文件

@@ -46,7 +46,7 @@ public final class BeepCommand extends GlobalCommand {
46 46
 
47 47
     /** {@inheritDoc} */
48 48
     @Override
49
-    public void execute(final FrameContainer origin, final boolean isSilent,
49
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
50 50
                         final CommandArguments args) {
51 51
         Toolkit.getDefaultToolkit().beep();
52 52
     }

+ 1
- 1
src/com/dmdirc/addons/calc/CalcCommand.java 查看文件

@@ -38,7 +38,7 @@ public class CalcCommand extends GlobalCommand {
38 38
 
39 39
     /** {@inheritDoc} */
40 40
     @Override
41
-    public void execute(final FrameContainer origin, final boolean isSilent,
41
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
42 42
             final CommandArguments args) {
43 43
         try {
44 44
             int offset = 0;

+ 3
- 5
src/com/dmdirc/addons/dcc/DCCChatWindow.java 查看文件

@@ -24,14 +24,14 @@ package com.dmdirc.addons.dcc;
24 24
 
25 25
 import com.dmdirc.actions.ActionManager;
26 26
 import com.dmdirc.addons.dcc.actions.DCCActions;
27
-import com.dmdirc.Main;
27
+import com.dmdirc.ui.interfaces.InputWindow;
28 28
 
29 29
 /**
30 30
  * This class links DCC Chat objects to a window.
31 31
  *
32 32
  * @author Shane 'Dataforce' McCormack
33 33
  */
34
-public class DCCChatWindow extends DCCFrame implements DCCChatHandler {
34
+public class DCCChatWindow extends DCCFrame<InputWindow> implements DCCChatHandler {
35 35
 
36 36
     /** The DCCChat object we are a window for */
37 37
     private final DCCChat dcc;
@@ -53,18 +53,16 @@ public class DCCChatWindow extends DCCFrame implements DCCChatHandler {
53 53
      */
54 54
     public DCCChatWindow(final DCCPlugin plugin, final DCCChat dcc,
55 55
             final String title, final String nick, final String targetNick) {
56
-        super(plugin, title, "dcc-chat-inactive", false,
56
+        super(plugin, title, "dcc-chat-inactive", InputWindow.class,
57 57
                 DCCCommandParser.getDCCCommandParser());
58 58
         this.dcc = dcc;
59 59
         dcc.setHandler(this);
60 60
         nickname = nick;
61 61
         otherNickname = targetNick;
62 62
 
63
-        myWindow = Main.getUI().getInputWindow(this);
64 63
         plugin.addWindow(this);
65 64
 
66 65
         setTitle(title);
67
-        myWindow.open();
68 66
     }
69 67
 
70 68
     /**

+ 2
- 2
src/com/dmdirc/addons/dcc/DCCCommand.java 查看文件

@@ -66,7 +66,7 @@ public final class DCCCommand extends ServerCommand implements IntelligentComman
66 66
 
67 67
     /** {@inheritDoc} */
68 68
     @Override
69
-    public void execute(final FrameContainer origin, final Server server,
69
+    public void execute(final FrameContainer<?> origin, final Server server,
70 70
             final boolean isSilent, final CommandArguments args) {
71 71
         if (args.getArguments().length > 1) {
72 72
             final String type = args.getArguments()[0];
@@ -136,7 +136,7 @@ public final class DCCCommand extends ServerCommand implements IntelligentComman
136 136
      * @param filename The file to send
137 137
      * @since 0.6.3m1
138 138
      */
139
-    public void sendFile(final String target, final FrameContainer origin,
139
+    public void sendFile(final String target, final FrameContainer<?> origin,
140 140
             final Server server, final boolean isSilent, final String filename) {
141 141
         // New thread to ask the user what file to send
142 142
         final File givenFile = new File(filename);

+ 4
- 4
src/com/dmdirc/addons/dcc/DCCCommandParser.java 查看文件

@@ -77,7 +77,7 @@ public class DCCCommandParser extends CommandParser {
77 77
      * @param args The arguments to the command
78 78
      */
79 79
     @Override
80
-    protected void executeCommand(final FrameContainer origin,
80
+    protected void executeCommand(final FrameContainer<?> origin,
81 81
             final boolean isSilent, final Command command, final CommandArguments args) {
82 82
         ((GlobalCommand) command).execute(origin, isSilent, args);
83 83
     }
@@ -91,13 +91,13 @@ public class DCCCommandParser extends CommandParser {
91 91
      * @param line The line input by the user
92 92
      */
93 93
     @Override
94
-    protected void handleNonCommand(final FrameContainer origin, final String line) {
95
-        ((WritableFrameContainer) origin).sendLine(line);
94
+    protected void handleNonCommand(final FrameContainer<?> origin, final String line) {
95
+        ((WritableFrameContainer<?>) origin).sendLine(line);
96 96
     }
97 97
 
98 98
     /** {@inheritDoc} */
99 99
     @Override
100
-    public void setOwner(final FrameContainer owner) {
100
+    public void setOwner(final FrameContainer<?> owner) {
101 101
         // Don't care
102 102
     }
103 103
 

+ 16
- 52
src/com/dmdirc/addons/dcc/DCCFrame.java 查看文件

@@ -22,21 +22,19 @@
22 22
 
23 23
 package com.dmdirc.addons.dcc;
24 24
 
25
-import com.dmdirc.Main;
26 25
 import com.dmdirc.Server;
27 26
 import com.dmdirc.WritableFrameContainer;
28 27
 import com.dmdirc.addons.ui_swing.components.frames.InputTextFrame;
29 28
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
30 29
 import com.dmdirc.addons.ui_swing.SwingController;
31
-import com.dmdirc.addons.ui_swing.UIUtilities;
32 30
 import com.dmdirc.commandparser.PopupType;
33 31
 import com.dmdirc.commandparser.parsers.CommandParser;
34 32
 import com.dmdirc.commandparser.parsers.GlobalCommandParser;
35 33
 import com.dmdirc.config.IdentityManager;
36 34
 import com.dmdirc.ui.WindowManager;
35
+import com.dmdirc.ui.input.TabCompleter;
37 36
 import com.dmdirc.ui.interfaces.InputWindow;
38 37
 
39
-import com.dmdirc.util.ReturnableThread;
40 38
 import java.awt.Container;
41 39
 
42 40
 import javax.swing.JPopupMenu;
@@ -44,14 +42,15 @@ import javax.swing.JPopupMenu;
44 42
 /**
45 43
  * This class links DCC objects to a window.
46 44
  *
45
+ * @param <T> The type of window which corresponds to this DCC frame
47 46
  * @author Shane 'Dataforce' McCormack
48 47
  */
49
-public abstract class DCCFrame extends WritableFrameContainer {
48
+public abstract class DCCFrame<T extends InputWindow> extends WritableFrameContainer<T> {
50 49
 
51 50
     /**
52 51
      * Empty Frame.
53 52
      */
54
-    class EmptyFrame extends InputTextFrame {
53
+    static class EmptyFrame extends InputTextFrame {
55 54
 
56 55
         /** A version number for this class. */
57 56
         private static final long serialVersionUID = 200711271;
@@ -61,8 +60,8 @@ public abstract class DCCFrame extends WritableFrameContainer {
61 60
          *
62 61
          * @param owner The frame container that owns this frame
63 62
          */
64
-        public EmptyFrame(final WritableFrameContainer owner) {
65
-            super(owner, (SwingController) Main.getUI());
63
+        public EmptyFrame(final SwingController controller, final WritableFrameContainer<?> owner) {
64
+            super(controller, owner);
66 65
             setTextPane(null);
67 66
             pack();
68 67
         }
@@ -109,55 +108,25 @@ public abstract class DCCFrame extends WritableFrameContainer {
109 108
 
110 109
     }
111 110
 
112
-    /** The Window we're using. */
113
-    protected InputWindow myWindow = null;
114
-
115 111
     /** The dcc plugin that owns this frame */
116 112
     protected final DCCPlugin plugin;
117 113
 
118 114
     /** The Window we're using. */
119 115
     private boolean windowClosing = false;
120 116
 
121
-    /**
122
-     * Creates a new instance of DCCFrame with an empty window.
123
-     *
124
-     * @param plugin The DCCPlugin that owns this frame
125
-     * @param title The title of this window
126
-     * @param icon The icon to use
127
-     * @param parser Command parser to use for this window
128
-     */
129
-    public DCCFrame(final DCCPlugin plugin, final String title,
130
-            final String icon, final CommandParser parser) {
131
-        this(plugin, title, icon, true, parser);
132
-    }
133
-
134 117
     /**
135 118
      * Creates a new instance of DCCFrame.
136 119
      *
137 120
      * @param plugin The DCCPlugin that owns this frame
138 121
      * @param title The title of this window
139
-     * @param defaultWindow Create default (empty) window. (non-default = chat frame)
140 122
      * @param icon The icon to use
123
+     * @param windowClass The class of window to use for this container
141 124
      * @param parser Command parser to use for this window
142 125
      */
143 126
     public DCCFrame(final DCCPlugin plugin, final String title, final String icon,
144
-            final boolean defaultWindow, final CommandParser parser) {
145
-        super(icon, title, title, IdentityManager.getGlobalConfig(), parser);
127
+            final Class<T> windowClass, final CommandParser parser) {
128
+        super(icon, title, title, windowClass, IdentityManager.getGlobalConfig(), parser);
146 129
         this.plugin = plugin;
147
-
148
-        if (defaultWindow) {
149
-            myWindow = UIUtilities.invokeAndWait(new ReturnableThread<EmptyFrame>() {
150
-
151
-                /** {@inheritDoc} */
152
-                @Override
153
-                public void run() {
154
-                    final EmptyFrame frame = new EmptyFrame(DCCFrame.this);
155
-                    setTitle(title);
156
-                    setObject(frame);
157
-                }
158
-
159
-            });
160
-        }
161 130
     }
162 131
 
163 132
     /**
@@ -180,16 +149,6 @@ public abstract class DCCFrame extends WritableFrameContainer {
180 149
         return 512;
181 150
     }
182 151
 
183
-    /**
184
-     * Returns the internal frame associated with this object.
185
-     *
186
-     * @return The internal frame associated with this object
187
-     */
188
-    @Override
189
-    public InputWindow getFrame() {
190
-        return myWindow;
191
-    }
192
-
193 152
     /**
194 153
      * Returns the content pane of the internal frame associated with this object.
195 154
      *
@@ -209,6 +168,12 @@ public abstract class DCCFrame extends WritableFrameContainer {
209 168
         return null;
210 169
     }
211 170
 
171
+    /** {@inheritDoc} */
172
+    @Override
173
+    public TabCompleter getTabCompleter() {
174
+        return new TabCompleter();
175
+    }
176
+
212 177
     /**
213 178
      * Is the window closing?
214 179
      *
@@ -224,7 +189,7 @@ public abstract class DCCFrame extends WritableFrameContainer {
224 189
         windowClosing = true;
225 190
 
226 191
         // 1: Make the window non-visible
227
-        myWindow.setVisible(false);
192
+        getFrame().setVisible(false);
228 193
 
229 194
         // 2: Remove any callbacks or listeners
230 195
         // 3: Trigger any actions neccessary
@@ -241,7 +206,6 @@ public abstract class DCCFrame extends WritableFrameContainer {
241 206
     @Override
242 207
     public void windowClosed() {
243 208
         // 7: Remove any references to the window and parents
244
-        myWindow = null; // NOPMD
245 209
     }
246 210
 
247 211
 }

+ 4
- 3
src/com/dmdirc/addons/dcc/DCCPlugin.java 查看文件

@@ -28,6 +28,7 @@ import com.dmdirc.Server;
28 28
 import com.dmdirc.actions.ActionManager;
29 29
 import com.dmdirc.actions.CoreActionType;
30 30
 import com.dmdirc.actions.interfaces.ActionType;
31
+import com.dmdirc.addons.dcc.DCCFrame.EmptyFrame;
31 32
 import com.dmdirc.addons.dcc.kde.KFileChooser;
32 33
 import com.dmdirc.addons.dcc.actions.DCCActions;
33 34
 import com.dmdirc.addons.ui_swing.MainFrame;
@@ -625,7 +626,7 @@ public final class DCCPlugin extends Plugin implements ActionListener {
625 626
 /**
626 627
  * Creates a placeholder DCC Frame.
627 628
  */
628
-class PlaceholderDCCFrame extends DCCFrame {
629
+class PlaceholderDCCFrame extends DCCFrame<EmptyFrame> {
629 630
 
630 631
     /**
631 632
      * Creates a placeholder dcc frame.
@@ -633,13 +634,13 @@ class PlaceholderDCCFrame extends DCCFrame {
633 634
      * @param plugin Parent plugin
634 635
      */
635 636
     public PlaceholderDCCFrame(final DCCPlugin plugin) {
636
-        super(plugin, "DCCs", "dcc", DCCCommandParser.getDCCCommandParser());
637
+        super(plugin, "DCCs", "dcc", EmptyFrame.class, DCCCommandParser.getDCCCommandParser());
637 638
     }
638 639
 
639 640
     @Override
640 641
     public void close() {
641 642
         int dccs = 0;
642
-        for (FrameContainer window : getChildren()) {
643
+        for (FrameContainer<?> window : getChildren()) {
643 644
             if (window instanceof DCCTransferWindow) {
644 645
                 if (((DCCTransferWindow) window).getDCC().isActive()) {
645 646
                     dccs++;

+ 3
- 2
src/com/dmdirc/addons/dcc/DCCTransferWindow.java 查看文件

@@ -25,6 +25,7 @@ package com.dmdirc.addons.dcc;
25 25
 import com.dmdirc.Server;
26 26
 import com.dmdirc.ServerState;
27 27
 import com.dmdirc.actions.ActionManager;
28
+import com.dmdirc.addons.dcc.DCCFrame.EmptyFrame;
28 29
 import com.dmdirc.addons.dcc.actions.DCCActions;
29 30
 import com.dmdirc.config.IdentityManager;
30 31
 import com.dmdirc.logger.ErrorLevel;
@@ -50,7 +51,7 @@ import net.miginfocom.swing.MigLayout;
50 51
  *
51 52
  * @author Shane 'Dataforce' McCormack
52 53
  */
53
-public class DCCTransferWindow extends DCCFrame implements DCCTransferHandler,
54
+public class DCCTransferWindow extends DCCFrame<EmptyFrame> implements DCCTransferHandler,
54 55
         ActionListener, SocketCloseListener {
55 56
 
56 57
     /** The DCCSend object we are a window for */
@@ -112,7 +113,7 @@ public class DCCTransferWindow extends DCCFrame implements DCCTransferHandler,
112 113
             final String title, final String targetNick, final Server server) {
113 114
         super(plugin, title, dcc.getType() == DCCTransfer.TransferType.SEND
114 115
                 ? "dcc-send-inactive" : "dcc-receive-inactive",
115
-                DCCCommandParser.getDCCCommandParser());
116
+                EmptyFrame.class, DCCCommandParser.getDCCCommandParser());
116 117
         this.dcc = dcc;
117 118
         this.server = server;
118 119
         this.parser = server == null ? null : server.getParser();

+ 1
- 2
src/com/dmdirc/addons/dcop/DcopCommand.java 查看文件

@@ -27,7 +27,6 @@ import com.dmdirc.Server;
27 27
 import com.dmdirc.commandparser.CommandArguments;
28 28
 import com.dmdirc.commandparser.CommandManager;
29 29
 import com.dmdirc.commandparser.commands.ServerCommand;
30
-import com.dmdirc.ui.interfaces.InputWindow;
31 30
 
32 31
 import java.util.List;
33 32
 
@@ -48,7 +47,7 @@ public final class DcopCommand extends ServerCommand {
48 47
 
49 48
     /** {@inheritDoc} */
50 49
     @Override
51
-    public void execute(final FrameContainer origin, final Server server,
50
+    public void execute(final FrameContainer<?> origin, final Server server,
52 51
             final boolean isSilent, final CommandArguments args) {
53 52
         if (args.getArguments().length != 3) {
54 53
             showUsage(origin, isSilent, "dcop", "<app> <object> <function>");

+ 1
- 1
src/com/dmdirc/addons/dns/DNSCommand.java 查看文件

@@ -44,7 +44,7 @@ public final class DNSCommand extends GlobalCommand {
44 44
     
45 45
     /** {@inheritDoc} */
46 46
     @Override
47
-    public void execute(final FrameContainer origin, final boolean isSilent,
47
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
48 48
             final CommandArguments args) {
49 49
         if (args.getArguments().length == 0) {
50 50
             showUsage(origin, isSilent, "dns", "<IP|hostname>");

+ 1
- 1
src/com/dmdirc/addons/freedesktop_notifications/FDNotifyCommand.java 查看文件

@@ -50,7 +50,7 @@ public final class FDNotifyCommand extends GlobalCommand {
50 50
 
51 51
     /** {@inheritDoc} */
52 52
     @Override
53
-    public void execute(final FrameContainer origin, final boolean isSilent,
53
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
54 54
             final CommandArguments args) {
55 55
         myPlugin.showNotification("", args.getArgumentsAsString());
56 56
     }

+ 5
- 5
src/com/dmdirc/addons/lagdisplay/LagDisplayPlugin.java 查看文件

@@ -153,9 +153,9 @@ public final class LagDisplayPlugin extends Plugin implements ActionListener, Co
153 153
         boolean useAlternate = false;
154 154
 
155 155
         for (Object obj : arguments) {
156
-            if (obj instanceof FrameContainer
157
-                    && ((FrameContainer) obj).getConfigManager() != null) {
158
-                useAlternate = ((FrameContainer) obj).getConfigManager()
156
+            if (obj instanceof FrameContainer<?>
157
+                    && ((FrameContainer<?>) obj).getConfigManager() != null) {
158
+                useAlternate = ((FrameContainer<?>) obj).getConfigManager()
159 159
                         .getOptionBool(getDomain(), "usealternate");
160 160
                 break;
161 161
             }
@@ -189,12 +189,12 @@ public final class LagDisplayPlugin extends Plugin implements ActionListener, Co
189 189
 
190 190
             if (((Server) arguments[0]).ownsFrame(active)) {
191 191
                 panel.setText("Not connected");
192
-                pings.remove(arguments[0]);
192
+                pings.remove((Server) arguments[0]);
193 193
             }
194 194
 
195 195
             panel.refreshDialog();
196 196
         } else if (type.equals(CoreActionType.CLIENT_FRAME_CHANGED)) {
197
-            final FrameContainer source = (FrameContainer) arguments[0];
197
+            final FrameContainer<?> source = (FrameContainer<?>) arguments[0];
198 198
             if (source == null || source.getServer() == null) {
199 199
                 panel.setText("Unknown");
200 200
             } else if (source.getServer().getState() != ServerState.CONNECTED) {

+ 5
- 18
src/com/dmdirc/addons/logging/HistoryWindow.java 查看文件

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.addons.logging;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Main;
27 26
 import com.dmdirc.Server;
28 27
 import com.dmdirc.config.IdentityManager;
29 28
 import com.dmdirc.ui.WindowManager;
@@ -34,10 +33,7 @@ import com.dmdirc.ui.interfaces.Window;
34 33
  *
35 34
  * @author Chris
36 35
  */
37
-public class HistoryWindow extends FrameContainer {
38
-
39
-    /** The window we're using. */
40
-    private Window window;
36
+public class HistoryWindow extends FrameContainer<Window> {
41 37
 
42 38
     /**
43 39
      * Creates a new HistoryWindow.
@@ -48,31 +44,23 @@ public class HistoryWindow extends FrameContainer {
48 44
      * @param numLines The number of lines to show
49 45
      */
50 46
     public HistoryWindow(final String title, final ReverseFileReader reader,
51
-                         final FrameContainer parent, final int numLines) {
52
-        super("raw", title, title, parent.getConfigManager());
47
+                         final FrameContainer<?> parent, final int numLines) {
48
+        super("raw", title, title, Window.class, parent.getConfigManager());
53 49
 
54 50
         this.parent = parent;
55 51
 
56
-        window = Main.getUI().getWindow(this);
57
-
58 52
         WindowManager.addWindow(parent, this);
59
-        window.open();
53
+
60 54
         final int frameBufferSize = IdentityManager.getGlobalConfig().getOptionInt(
61 55
                 "ui", "frameBufferSize");
62 56
         addLine(reader.getLinesAsString(Math.min(frameBufferSize, numLines)), false);
63 57
     }
64 58
 
65
-    /** {@inheritDoc} */
66
-    @Override
67
-    public Window getFrame() {
68
-        return window;
69
-    }
70
-
71 59
     /** {@inheritDoc} */
72 60
     @Override
73 61
     public void windowClosing() {
74 62
         // 1: Make the window non-visible
75
-        window.setVisible(false);
63
+        getFrame().setVisible(false);
76 64
 
77 65
         // 2: Remove any callbacks or listeners
78 66
         // 3: Trigger any actions neccessary
@@ -87,7 +75,6 @@ public class HistoryWindow extends FrameContainer {
87 75
     @Override
88 76
     public void windowClosed() {
89 77
         // 7: Remove any references to the window and parents
90
-        window = null; // NOPMD
91 78
         parent = null; // NOPMD
92 79
     }
93 80
 

+ 3
- 11
src/com/dmdirc/addons/logging/LoggingCommand.java 查看文件

@@ -32,7 +32,6 @@ import com.dmdirc.plugins.Plugin;
32 32
 import com.dmdirc.plugins.PluginInfo;
33 33
 import com.dmdirc.plugins.PluginManager;
34 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
35
-import com.dmdirc.ui.interfaces.InputWindow;
36 35
 
37 36
 /**
38 37
  * The dcop command retrieves information from a dcop application.
@@ -51,7 +50,7 @@ public final class LoggingCommand extends ServerCommand implements IntelligentCo
51 50
 
52 51
     /** {@inheritDoc} */
53 52
     @Override
54
-    public void execute(final FrameContainer origin, final Server server,
53
+    public void execute(final FrameContainer<?> origin, final Server server,
55 54
                         final boolean isSilent, final CommandArguments args) {
56 55
         final PluginInfo pluginInfo = PluginManager.getPluginManager().getPluginInfoByName("logging");
57 56
         if (pluginInfo == null) {
@@ -75,7 +74,7 @@ public final class LoggingCommand extends ServerCommand implements IntelligentCo
75 74
                     sendLine(origin, isSilent, FORMAT_ERROR, "Plugin failed to reload.");
76 75
                 }
77 76
             } else if (args.getArguments()[0].equalsIgnoreCase("history")) {
78
-                if (!plugin.showHistory((InputWindow) origin.getFrame())) {
77
+                if (!plugin.showHistory(origin)) {
79 78
                     sendLine(origin, isSilent, FORMAT_ERROR, "Unable to open history for this window.");
80 79
                 }
81 80
             } else if (args.getArguments()[0].equalsIgnoreCase("help")) {
@@ -90,14 +89,7 @@ public final class LoggingCommand extends ServerCommand implements IntelligentCo
90 89
         }
91 90
     }
92 91
 
93
-    /**
94
-     * Returns a list of suggestions for the specified argument, given the list
95
-     * of previous arguments.
96
-     *
97
-     * @param arg The argument that is being completed
98
-     * @param previousArgs The contents of the previous arguments, if any
99
-     * @return A list of suggestions for the argument
100
-     */
92
+    /** {@inheritDoc} */
101 93
     @Override
102 94
     public AdditionalTabTargets getSuggestions(final int arg,
103 95
             final IntelligentCommandContext context) {

+ 13
- 14
src/com/dmdirc/addons/logging/LoggingPlugin.java 查看文件

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.addons.logging;
24 24
 
25 25
 import com.dmdirc.Channel;
26
+import com.dmdirc.FrameContainer;
26 27
 import com.dmdirc.Main;
27 28
 import com.dmdirc.Query;
28 29
 import com.dmdirc.Server;
@@ -45,8 +46,6 @@ import com.dmdirc.parser.interfaces.ChannelInfo;
45 46
 import com.dmdirc.parser.interfaces.ClientInfo;
46 47
 import com.dmdirc.parser.interfaces.Parser;
47 48
 import com.dmdirc.plugins.Plugin;
48
-import com.dmdirc.ui.interfaces.InputWindow;
49
-import com.dmdirc.ui.interfaces.Window;
50 49
 import com.dmdirc.ui.messages.Styliser;
51 50
 
52 51
 import java.awt.Color;
@@ -298,7 +297,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
298 297
         switch (type) {
299 298
             case QUERY_OPENED:
300 299
                 if (autobackbuffer) {
301
-                    showBackBuffer(query.getFrame(), filename);
300
+                    showBackBuffer(query, filename);
302 301
                 }
303 302
 
304 303
                 appendLine(filename, "*** Query opened at: %s", openedAtFormat.format(new Date()));
@@ -353,7 +352,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
353 352
         switch (type) {
354 353
             case CHANNEL_OPENED:
355 354
                 if (autobackbuffer) {
356
-                    showBackBuffer(chan.getFrame(), filename);
355
+                    showBackBuffer(chan, filename);
357 356
                 }
358 357
 
359 358
                 appendLine(filename, "*** Channel opened at: %s", openedAtFormat.format(new Date()));
@@ -487,7 +486,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
487 486
      * @param frame The frame to add the backbuffer lines to
488 487
      * @param filename File to get backbuffer from
489 488
      */
490
-    protected void showBackBuffer(final Window frame, final String filename) {
489
+    protected void showBackBuffer(final FrameContainer<?> frame, final String filename) {
491 490
         if (frame == null) {
492 491
             Logger.userError(ErrorLevel.LOW, "Given a null frame");
493 492
             return;
@@ -804,16 +803,16 @@ public class LoggingPlugin extends Plugin implements ActionListener,
804 803
      * @param target The window whose history we're trying to open
805 804
      * @return True if the history is available, false otherwise
806 805
      */
807
-    protected boolean showHistory(final InputWindow target) {
806
+    protected boolean showHistory(final FrameContainer<?> target) {
808 807
         Object component;
809 808
 
810
-        if (target.getContainer() instanceof Channel) {
811
-            component = ((Channel) target.getContainer()).getChannelInfo();
812
-        } else if (target.getContainer() instanceof Query) {
813
-            final Parser parser = ((Query) target.getContainer()).getServer().getParser();
814
-            component = parser.getClient(((Query) target.getContainer()).getHost());
815
-        } else if (target.getContainer() instanceof Server) {
816
-            component = target.getContainer().getServer().getParser();
809
+        if (target instanceof Channel) {
810
+            component = ((Channel) target).getChannelInfo();
811
+        } else if (target instanceof Query) {
812
+            final Parser parser = ((Query) target).getServer().getParser();
813
+            component = parser.getClient(((Query) target).getHost());
814
+        } else if (target instanceof Server) {
815
+            component = ((Server) target).getParser();
817 816
         } else {
818 817
             // Unknown component
819 818
             return false;
@@ -838,7 +837,7 @@ public class LoggingPlugin extends Plugin implements ActionListener,
838 837
             return false;
839 838
         }
840 839
 
841
-        new HistoryWindow("History", reader, target.getContainer(), historyLines);
840
+        new HistoryWindow("History", reader, target, historyLines);
842 841
 
843 842
         return true;
844 843
     }

+ 1
- 1
src/com/dmdirc/addons/nickcolours/NickColourPanel.java 查看文件

@@ -210,7 +210,7 @@ public class NickColourPanel extends JPanel implements ActionListener,
210 210
         final DefaultTableModel model = ((DefaultTableModel) table.getModel());
211 211
 
212 212
         for (Object row : model.getDataVector()) {
213
-            final Vector vrow = (Vector) row;
213
+            final Vector<?> vrow = (Vector<?>) row;
214 214
 
215 215
             res.add(new Object[]{vrow.elementAt(0), vrow.elementAt(1), vrow.
216 216
                         elementAt(2), vrow.elementAt(3)});

+ 2
- 3
src/com/dmdirc/addons/nickcolours/NickColourPlugin.java 查看文件

@@ -100,7 +100,7 @@ public final class NickColourPlugin extends Plugin implements ActionListener,
100 100
      */
101 101
     private void colourClient(final String network,
102 102
             final ChannelClientInfo client) {
103
-        final Map map = client.getMap();
103
+        final Map<Object, Object> map = client.getMap();
104 104
         final ClientInfo myself =
105 105
                 client.getClient().getParser().getLocalClient();
106 106
         final String nickOption1 = "color:"
@@ -151,8 +151,7 @@ public final class NickColourPlugin extends Plugin implements ActionListener,
151 151
      * @param textColour Text colour to be inserted
152 152
      * @param nickColour Nick colour to be inserted
153 153
      */
154
-    @SuppressWarnings("unchecked")
155
-    private void putColour(final Map map, final Color textColour,
154
+    private void putColour(final Map<Object, Object> map, final Color textColour,
156 155
             final Color nickColour) {
157 156
         if (settext && textColour != null) {
158 157
             map.put(ChannelClientProperty.TEXT_FOREGROUND, textColour);

+ 3
- 3
src/com/dmdirc/addons/nowplaying/NowPlayingCommand.java 查看文件

@@ -61,8 +61,8 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
61 61
     
62 62
     /** {@inheritDoc} */
63 63
     @Override
64
-    public void execute(final FrameContainer origin, final Server server,
65
-            final MessageTarget target, final boolean isSilent, final CommandArguments args) {
64
+    public void execute(final FrameContainer<?> origin, final Server server,
65
+            final MessageTarget<?> target, final boolean isSilent, final CommandArguments args) {
66 66
         if (args.getArguments().length > 0 && args.getArguments()[0]
67 67
                 .equalsIgnoreCase("--sources")) {
68 68
             doSourceList(origin, isSilent, args.getArgumentsAsString(1));
@@ -104,7 +104,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
104 104
      * @param isSilent Whether this command is being silenced
105 105
      * @param format Format to be passed to getInformation
106 106
      */
107
-    private void doSourceList(final FrameContainer origin, final boolean isSilent,
107
+    private void doSourceList(final FrameContainer<?> origin, final boolean isSilent,
108 108
             final String format) {
109 109
         final List<MediaSource> sources = parent.getSources();
110 110
         

+ 1
- 1
src/com/dmdirc/addons/osd/OsdCommand.java 查看文件

@@ -70,7 +70,7 @@ public final class OsdCommand extends GlobalCommand implements IntelligentComman
70 70
 
71 71
     /** {@inheritDoc} */
72 72
     @Override
73
-    public void execute(final FrameContainer origin, final boolean isSilent,
73
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
74 74
             final CommandArguments args) {
75 75
         if (args.getArguments().length > 0
76 76
                 && "--close".equalsIgnoreCase(args.getArguments()[0])) {

+ 0
- 193
src/com/dmdirc/addons/redirect/FakeInputWindow.java 查看文件

@@ -1,193 +0,0 @@
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.redirect;
24
-
25
-import com.dmdirc.MessageTarget;
26
-import com.dmdirc.WritableFrameContainer;
27
-import com.dmdirc.commandparser.parsers.CommandParser;
28
-import com.dmdirc.config.ConfigManager;
29
-import com.dmdirc.ui.input.InputHandler;
30
-import com.dmdirc.ui.interfaces.InputWindow;
31
-import com.dmdirc.util.StringTranscoder;
32
-
33
-import java.nio.charset.Charset;
34
-
35
-/**
36
- * Implements a fake input window, which sends echoed text to the specified
37
- * chat window instead.
38
- * 
39
- * @author Chris
40
- */
41
-public class FakeInputWindow implements InputWindow {
42
-    
43
-    /** The target for this window. */
44
-    private final MessageTarget target;
45
-
46
-    /**
47
-     * Creates a new instance of FakeInputWindow.
48
-     * 
49
-     * @param target The message target that output gets sent to
50
-     */
51
-    public FakeInputWindow(final MessageTarget target) {
52
-        this.target = target;
53
-    }
54
-
55
-    /** {@inheritDoc} */
56
-    @Override
57
-    public CommandParser getCommandParser() {
58
-        return target.getFrame().getCommandParser();
59
-    }
60
-
61
-    /** {@inheritDoc} */
62
-    @Override
63
-    public InputHandler getInputHandler() {
64
-        return target.getFrame().getInputHandler();
65
-    }
66
-
67
-    /** {@inheritDoc} */
68
-    @Override
69
-    public void setAwayIndicator(final boolean isAway) {
70
-        // Do nothing
71
-    }
72
-
73
-    /** {@inheritDoc} */
74
-    @Override
75
-    @Deprecated
76
-    public void addLine(final String messageType, final Object... args) {
77
-        getContainer().addLine(messageType, args);
78
-    }
79
-
80
-    /** {@inheritDoc} */
81
-    @Override
82
-    @Deprecated
83
-    public void addLine(final StringBuffer messageType, final Object... args) {
84
-        getContainer().addLine(messageType, args);
85
-    }
86
-
87
-    /** {@inheritDoc} */
88
-    @Override
89
-    @Deprecated
90
-    public void addLine(final String line, final boolean timestamp) {
91
-        getContainer().addLine(line, timestamp);
92
-    }
93
-
94
-    /** {@inheritDoc} */
95
-    @Override
96
-    @Deprecated
97
-    public void clear() {
98
-        // Do nothing
99
-    }
100
-
101
-    /** {@inheritDoc} */
102
-    @Override
103
-    public ConfigManager getConfigManager() {
104
-        return target.getFrame().getConfigManager();
105
-    }
106
-
107
-    /** {@inheritDoc} */
108
-    @Override
109
-    public WritableFrameContainer getContainer() {
110
-        return target;
111
-    }
112
-
113
-    /** {@inheritDoc} */
114
-    @Override
115
-    public boolean isVisible() {
116
-        return false;
117
-    }
118
-
119
-    /** {@inheritDoc} */
120
-    @Override
121
-    public void setVisible(final boolean isVisible) {
122
-        // Do nothing
123
-    }
124
-
125
-    /** {@inheritDoc} */
126
-    @Override
127
-    public String getTitle() {
128
-        return "Fake window";
129
-    }
130
-
131
-    /** {@inheritDoc} */
132
-    @Override
133
-    public boolean isMaximum() {
134
-        return false;
135
-    }
136
-
137
-    /** {@inheritDoc} */
138
-    @Override
139
-    @Deprecated
140
-    public void setTitle(final String title) {
141
-        // Do nothing
142
-    }
143
-
144
-    /** {@inheritDoc} */
145
-    @Override
146
-    public void open() {
147
-        // Do nothing
148
-    }
149
-
150
-    /** {@inheritDoc} */
151
-    @Override
152
-    @Deprecated
153
-    public StringTranscoder getTranscoder() {
154
-        return new StringTranscoder(Charset.defaultCharset());
155
-    }
156
-
157
-    /** {@inheritDoc} */
158
-    @Override
159
-    public void close() {
160
-        /// Do nothing
161
-    }
162
-
163
-    /** {@inheritDoc} */
164
-    @Override
165
-    public void restore() {
166
-        // Do nothing
167
-    }
168
-
169
-    /** {@inheritDoc} */
170
-    @Override
171
-    public void maximise() {
172
-        // Do nothing
173
-    }
174
-
175
-    /** {@inheritDoc} */
176
-    @Override
177
-    public void toggleMaximise() {
178
-        // Do nothing
179
-    }
180
-
181
-    /** {@inheritDoc} */
182
-    @Override
183
-    public void minimise() {
184
-        // Do nothing
185
-    }
186
-
187
-    /** {@inheritDoc} */
188
-    @Override
189
-    public void activateFrame() {
190
-        // Do nothing
191
-    }
192
-
193
-}

+ 94
- 0
src/com/dmdirc/addons/redirect/FakeWriteableFrameContainer.java 查看文件

@@ -0,0 +1,94 @@
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.redirect;
24
+
25
+import com.dmdirc.MessageTarget;
26
+import com.dmdirc.Server;
27
+import com.dmdirc.WritableFrameContainer;
28
+import com.dmdirc.ui.input.TabCompleter;
29
+import com.dmdirc.ui.interfaces.InputWindow;
30
+
31
+/**
32
+ * Implements a fake input window, which sends echoed text to the specified
33
+ * chat window instead.
34
+ * 
35
+ * @author Chris
36
+ */
37
+public class FakeWriteableFrameContainer extends WritableFrameContainer<InputWindow> {
38
+    
39
+    /** The target for this window. */
40
+    private final MessageTarget<? extends InputWindow> target;
41
+
42
+    /**
43
+     * Creates a new instance of FakeInputWindow.
44
+     * 
45
+     * @param target The message target that output gets sent to
46
+     */
47
+    public FakeWriteableFrameContainer(final MessageTarget<?> target) {
48
+        super(target.getIcon(), target.getName(), target.getTitle(),
49
+                InputWindow.class, target.getConfigManager(), target.getCommandParser());
50
+        this.target = target;
51
+    }
52
+
53
+    /** {@inheritDoc} */
54
+    @Override
55
+    public void addLine(final String line, final boolean timestamp) {
56
+        target.sendLine(line);
57
+    }
58
+
59
+    /** {@inheritDoc} */
60
+    @Override
61
+    public void sendLine(final String line) {
62
+        target.sendLine(line);
63
+    }
64
+
65
+    /** {@inheritDoc} */
66
+    @Override
67
+    public TabCompleter getTabCompleter() {
68
+        return target.getTabCompleter();
69
+    }
70
+
71
+    /** {@inheritDoc} */
72
+    @Override
73
+    public int getMaxLineLength() {
74
+        return target.getMaxLineLength();
75
+    }
76
+
77
+    /** {@inheritDoc} */
78
+    @Override
79
+    public Server getServer() {
80
+        return target.getServer();
81
+    }
82
+
83
+    /** {@inheritDoc} */
84
+    @Override
85
+    public void windowClosing() {
86
+        // Do nothing
87
+    }
88
+
89
+    /** {@inheritDoc} */
90
+    @Override
91
+    public void windowClosed() {
92
+        // Do nothing
93
+    }
94
+}

+ 3
- 3
src/com/dmdirc/addons/redirect/RedirectCommand.java 查看文件

@@ -45,9 +45,9 @@ public class RedirectCommand extends ChatCommand implements IntelligentCommand {
45 45
     
46 46
     /** {@inheritDoc} */
47 47
     @Override
48
-    public void execute(final FrameContainer origin, final Server server,
49
-            final MessageTarget target, final boolean isSilent, final CommandArguments args) {
50
-        target.getFrame().getCommandParser().parseCommand(target, // TODO: This doesn't redirect
48
+    public void execute(final FrameContainer<?> origin, final Server server,
49
+            final MessageTarget<?> target, final boolean isSilent, final CommandArguments args) {
50
+        target.getCommandParser().parseCommand(new FakeWriteableFrameContainer(target),
51 51
                 args.getArgumentsAsString());
52 52
     }
53 53
     

+ 2
- 1
src/com/dmdirc/addons/scriptplugin/ScriptCommand.java 查看文件

@@ -58,7 +58,8 @@ public final class ScriptCommand extends GlobalCommand implements IntelligentCom
58 58
         
59 59
     /** {@inheritDoc} */
60 60
     @Override
61
-    public void execute(final FrameContainer origin, final boolean isSilent, final CommandArguments commandArgs) {
61
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
62
+            final CommandArguments commandArgs) {
62 63
         final String[] args = commandArgs.getArguments();
63 64
     
64 65
         if (args.length > 0 && (args[0].equalsIgnoreCase("rehash") || args[0].equalsIgnoreCase("reload"))) {

+ 1
- 1
src/com/dmdirc/addons/systray/PopupCommand.java 查看文件

@@ -64,7 +64,7 @@ public final class PopupCommand extends ServerCommand {
64 64
 
65 65
     /** {@inheritDoc} */
66 66
     @Override
67
-    public void execute(final FrameContainer origin, final Server server,
67
+    public void execute(final FrameContainer<?> origin, final Server server,
68 68
             final boolean isSilent, final CommandArguments args) {
69 69
         showPopup("DMDirc", args.getArgumentsAsString());
70 70
     }

+ 3
- 3
src/com/dmdirc/addons/time/TimedCommand.java 查看文件

@@ -42,7 +42,7 @@ public final class TimedCommand extends TimerTask {
42 42
     private final String command;
43 43
     
44 44
     /** The window to use for executing commands. */
45
-    private final FrameContainer origin;
45
+    private final FrameContainer<?> origin;
46 46
     
47 47
     /** The timer we're using for scheduling this command. */
48 48
     private final Timer timer;
@@ -55,7 +55,7 @@ public final class TimedCommand extends TimerTask {
55 55
      * @param origin The command window to use for the execution
56 56
      */
57 57
     public TimedCommand(final int repetitions, final int delay,
58
-            final String command, final FrameContainer origin) {
58
+            final String command, final FrameContainer<?> origin) {
59 59
         super();
60 60
         
61 61
         this.repetitions = repetitions;
@@ -73,7 +73,7 @@ public final class TimedCommand extends TimerTask {
73 73
         if (origin == null) {
74 74
             parser = GlobalCommandParser.getGlobalCommandParser();
75 75
         } else {
76
-            parser = ((WritableFrameContainer) origin).getFrame().getCommandParser();
76
+            parser = ((WritableFrameContainer<?>) origin).getCommandParser();
77 77
         }
78 78
         
79 79
         parser.parseCommand(origin, command);

+ 2
- 2
src/com/dmdirc/addons/time/TimerCommand.java 查看文件

@@ -46,7 +46,7 @@ public final class TimerCommand extends GlobalCommand implements IntelligentComm
46 46
     
47 47
     /** {@inheritDoc} */
48 48
     @Override
49
-    public void execute(final FrameContainer origin, final boolean isSilent,
49
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
50 50
             final CommandArguments args) {
51 51
         if (args.getArguments().length < 3) {
52 52
             doUsage(origin, isSilent);
@@ -73,7 +73,7 @@ public final class TimerCommand extends GlobalCommand implements IntelligentComm
73 73
      * @param origin The window that the command was entered in
74 74
      * @param isSilent Whether this command is being silenced or not
75 75
      */
76
-    private void doUsage(final FrameContainer origin, final boolean isSilent) {
76
+    private void doUsage(final FrameContainer<?> origin, final boolean isSilent) {
77 77
         showUsage(origin, isSilent, "timer", "<repetitions> <interval> <command>");
78 78
     }
79 79
     

+ 1
- 1
src/com/dmdirc/addons/ui_dummy/DummyChannelWindow.java 查看文件

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.addons.ui_dummy;
24 24
 
25 25
 import com.dmdirc.Channel;
26
-import com.dmdirc.commandparser.parsers.ChannelCommandParser;
27 26
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28 27
 import com.dmdirc.ui.interfaces.ChannelWindow;
29 28
 
@@ -73,6 +72,7 @@ public final class DummyChannelWindow extends DummyInputWindow implements Channe
73 72
 
74 73
     /** {@inheritDoc} */
75 74
     @Override
75
+    @Deprecated
76 76
     public Channel getChannel() {
77 77
         return parent;
78 78
     }

+ 2
- 3
src/com/dmdirc/addons/ui_dummy/DummyController.java 查看文件

@@ -28,7 +28,6 @@ import com.dmdirc.Main;
28 28
 import com.dmdirc.Query;
29 29
 import com.dmdirc.Server;
30 30
 import com.dmdirc.WritableFrameContainer;
31
-import com.dmdirc.commandparser.parsers.CommandParser;
32 31
 import com.dmdirc.config.prefs.PreferencesInterface;
33 32
 import com.dmdirc.plugins.Plugin;
34 33
 import com.dmdirc.ui.core.dialogs.sslcertificate.SSLCertificateDialogModel;
@@ -93,13 +92,13 @@ public final class DummyController extends Plugin implements UIController {
93 92
     
94 93
     /** {@inheritDoc} */
95 94
     @Override
96
-    public Window getWindow(final FrameContainer owner) {
95
+    public Window getWindow(final FrameContainer<?> owner) {
97 96
         throw new UnsupportedOperationException("Not supported yet.");
98 97
     }
99 98
     
100 99
     /** {@inheritDoc} */
101 100
     @Override
102
-    public InputWindow getInputWindow(final WritableFrameContainer owner) {
101
+    public InputWindow getInputWindow(final WritableFrameContainer<?> owner) {
103 102
         return new DummyInputWindow(owner, owner.getCommandParser());
104 103
     }
105 104
     

+ 5
- 5
src/com/dmdirc/addons/ui_dummy/DummyFrameManager.java 查看文件

@@ -49,29 +49,29 @@ public class DummyFrameManager implements FrameManager {
49 49
     
50 50
     /** {@inheritDoc} */
51 51
     @Override
52
-    public void addWindow(final FrameContainer window, final boolean focus) {
52
+    public void addWindow(final FrameContainer<?> window, final boolean focus) {
53 53
         Main.getUI().getStatusBar()
54 54
                 .setMessage("DummyFrameManager: addServer: " + window);
55 55
     }
56 56
     
57 57
     /** {@inheritDoc} */
58 58
     @Override
59
-    public void delWindow(final FrameContainer window) {
59
+    public void delWindow(final FrameContainer<?> window) {
60 60
         Main.getUI().getStatusBar()
61 61
                 .setMessage("DummyFrameManager: delServer: " + window);
62 62
     }
63 63
     
64 64
     /** {@inheritDoc} */
65 65
     @Override
66
-    public void addWindow(final FrameContainer parent, 
67
-            final FrameContainer window, final boolean focus) {
66
+    public void addWindow(final FrameContainer<?> parent,
67
+            final FrameContainer<?> window, final boolean focus) {
68 68
         Main.getUI().getStatusBar()
69 69
                 .setMessage("DummyFrameManager: addCustom: " + window + "@" + parent);
70 70
     }
71 71
     
72 72
     /** {@inheritDoc} */
73 73
     @Override
74
-    public void delWindow(final FrameContainer parent, final FrameContainer window) {
74
+    public void delWindow(final FrameContainer<?> parent, final FrameContainer<?> window) {
75 75
         Main.getUI().getStatusBar()
76 76
                 .setMessage("DummyFrameManager: delCustom: " + window + "@" + parent);
77 77
     }

+ 13
- 4
src/com/dmdirc/addons/ui_dummy/DummyInputWindow.java 查看文件

@@ -28,10 +28,10 @@ import com.dmdirc.config.ConfigManager;
28 28
 import com.dmdirc.config.IdentityManager;
29 29
 import com.dmdirc.ui.input.InputHandler;
30 30
 import com.dmdirc.ui.interfaces.InputWindow;
31
+import com.dmdirc.ui.interfaces.UIController;
31 32
 import com.dmdirc.util.StringTranscoder;
32 33
 
33 34
 import java.nio.charset.Charset;
34
-import java.util.Arrays;
35 35
 
36 36
 /**
37 37
  * Dummy input window, used for testing.
@@ -45,7 +45,7 @@ public class DummyInputWindow implements InputWindow {
45 45
     /** are we maximised? */
46 46
     private boolean maximised;
47 47
     /** Our container. */
48
-    private final WritableFrameContainer container;
48
+    private final WritableFrameContainer<? extends InputWindow> container;
49 49
     /** Our command parser. */
50 50
     private final CommandParser commandParser;
51 51
     
@@ -55,7 +55,7 @@ public class DummyInputWindow implements InputWindow {
55 55
      * @param owner Parent window
56 56
      * @param commandParser Parent command parser
57 57
      */
58
-    public DummyInputWindow(final WritableFrameContainer owner, 
58
+    public DummyInputWindow(final WritableFrameContainer<? extends InputWindow> owner,
59 59
             final CommandParser commandParser) {
60 60
         this.container = owner;
61 61
         this.commandParser = commandParser;
@@ -75,6 +75,7 @@ public class DummyInputWindow implements InputWindow {
75 75
     
76 76
     /** {@inheritDoc} */
77 77
     @Override
78
+    @Deprecated
78 79
     public void setAwayIndicator(final boolean isAway) {
79 80
         // Do nothing
80 81
     }
@@ -109,13 +110,14 @@ public class DummyInputWindow implements InputWindow {
109 110
     
110 111
     /** {@inheritDoc} */
111 112
     @Override
113
+    @Deprecated
112 114
     public ConfigManager getConfigManager() {
113 115
         return IdentityManager.getGlobalConfig();
114 116
     }
115 117
     
116 118
     /** {@inheritDoc} */
117 119
     @Override
118
-    public WritableFrameContainer getContainer() {
120
+    public WritableFrameContainer<? extends InputWindow> getContainer() {
119 121
         return container;
120 122
     }
121 123
     
@@ -133,6 +135,7 @@ public class DummyInputWindow implements InputWindow {
133 135
     
134 136
     /** {@inheritDoc} */
135 137
     @Override
138
+    @Deprecated
136 139
     public String getTitle() {
137 140
         return title;
138 141
     }
@@ -207,5 +210,11 @@ public class DummyInputWindow implements InputWindow {
207 210
     public void activateFrame() {
208 211
         // Do nothing
209 212
     }
213
+
214
+    /** {@inheritDoc} */
215
+    @Override
216
+    public UIController getController() {
217
+        return new DummyController();
218
+    }
210 219
     
211 220
 }

+ 2
- 2
src/com/dmdirc/addons/ui_dummy/DummyQueryWindow.java 查看文件

@@ -36,8 +36,8 @@ public class DummyQueryWindow extends DummyInputWindow implements QueryWindow {
36 36
      * 
37 37
      * @param owner The window that owns this one
38 38
      */
39
-    public DummyQueryWindow(final WritableFrameContainer owner) {
40
-        super(owner, owner.getServer().getFrame().getCommandParser());
39
+    public DummyQueryWindow(final WritableFrameContainer<? extends QueryWindow> owner) {
40
+        super(owner, owner.getCommandParser());
41 41
     }
42 42
 
43 43
 }

+ 11
- 26
src/com/dmdirc/addons/ui_swing/MainFrame.java 查看文件

@@ -28,11 +28,11 @@ import com.dmdirc.addons.ui_swing.components.SplitPane;
28 28
 import com.dmdirc.addons.ui_swing.components.desktopPane.DMDircDesktopPane;
29 29
 import com.dmdirc.addons.ui_swing.components.statusbar.SwingStatusBar;
30 30
 import com.dmdirc.addons.ui_swing.framemanager.tree.TreeFrameManager;
31
-import com.dmdirc.FrameContainer;
32 31
 import com.dmdirc.Main;
33 32
 import com.dmdirc.ServerManager;
34 33
 import com.dmdirc.actions.ActionManager;
35 34
 import com.dmdirc.actions.CoreActionType;
35
+import com.dmdirc.addons.ui_swing.SwingWindowFactory.SwingWindowListener;
36 36
 import com.dmdirc.addons.ui_swing.dialogs.StandardQuestionDialog;
37 37
 import com.dmdirc.config.IdentityManager;
38 38
 import com.dmdirc.interfaces.ConfigChangeListener;
@@ -43,10 +43,9 @@ import com.dmdirc.ui.interfaces.FramemanagerPosition;
43 43
 import com.dmdirc.ui.interfaces.MainWindow;
44 44
 import com.dmdirc.ui.interfaces.Window;
45 45
 import com.dmdirc.ui.CoreUIUtils;
46
-import com.dmdirc.ui.interfaces.FrameListener;
47 46
 import com.dmdirc.util.ReturnableThread;
48
-import java.awt.Dialog.ModalityType;
49 47
 
48
+import java.awt.Dialog.ModalityType;
50 49
 import java.awt.Dimension;
51 50
 import java.awt.event.WindowEvent;
52 51
 import java.awt.event.WindowFocusListener;
@@ -67,7 +66,7 @@ import net.miginfocom.swing.MigLayout;
67 66
  * The main application frame.
68 67
  */
69 68
 public final class MainFrame extends JFrame implements WindowListener,
70
-        MainWindow, ConfigChangeListener, FrameListener {
69
+        MainWindow, ConfigChangeListener, SwingWindowListener {
71 70
 
72 71
     /** Logger to use. */
73 72
     private static final java.util.logging.Logger LOGGER =
@@ -366,11 +365,10 @@ public final class MainFrame extends JFrame implements WindowListener,
366 365
                     mainFrameManager = new TreeFrameManager();
367 366
                 }
368 367
 
369
-
370 368
                 WindowManager.addFrameListener(mainFrameManager);
371 369
                 mainFrameManager.setParent(frameManagerPanel);
372 370
 
373
-                WindowManager.addFrameListener(MainFrame.this);
371
+                controller.getWindowFactory().addWindowListener(MainFrame.this);
374 372
             }
375 373
         });
376 374
     }
@@ -381,7 +379,7 @@ public final class MainFrame extends JFrame implements WindowListener,
381 379
     private void initComponents() {
382 380
         statusBar = new SwingStatusBar(controller, this);
383 381
         frameManagerPanel = new JPanel();
384
-        desktopPane = new DMDircDesktopPane(this, controller.getDomain());
382
+        desktopPane = new DMDircDesktopPane(controller, this, controller.getDomain());
385 383
 
386 384
         initFrameManagers();
387 385
 
@@ -569,7 +567,7 @@ public final class MainFrame extends JFrame implements WindowListener,
569 567
 
570 568
     /** {@inheritDoc}. */
571 569
     @Override
572
-    public void addWindow(final FrameContainer window, final boolean focus) {
570
+    public void windowAdded(final Window parent, final Window window) {
573 571
         UIUtilities.invokeAndWait(new Runnable() {
574 572
 
575 573
             /** {@inheritDoc} */
@@ -586,13 +584,13 @@ public final class MainFrame extends JFrame implements WindowListener,
586 584
      * @param window The server to be added
587 585
      * @param index Index of the window to be added
588 586
      */
589
-    public void addWindow(final FrameContainer window, final int index) {
587
+    public void addWindow(final Window window, final int index) {
590 588
         UIUtilities.invokeAndWait(new Runnable() {
591 589
 
592 590
             /** {@inheritDoc} */
593 591
             @Override
594 592
             public void run() {
595
-                final JInternalFrame frame = (JInternalFrame) window.getFrame();
593
+                final JInternalFrame frame = (JInternalFrame) window;
596 594
 
597 595
                 // Add the frame
598 596
                 desktopPane.add(frame, index);
@@ -602,30 +600,17 @@ public final class MainFrame extends JFrame implements WindowListener,
602 600
 
603 601
     /** {@inheritDoc}. */
604 602
     @Override
605
-    public void delWindow(final FrameContainer window) {
603
+    public void windowDeleted(final Window parent, final Window window) {
606 604
         UIUtilities.invokeAndWait(new Runnable() {
607 605
 
608 606
             /** {@inheritDoc} */
609 607
             @Override
610 608
             public void run() {
611
-                final JInternalFrame frame = (JInternalFrame) window.getFrame();
609
+                final JInternalFrame frame = (JInternalFrame) window;
612 610
 
613 611
                 desktopPane.remove(frame);
614 612
             }
615 613
         });
616 614
     }
617 615
 
618
-    /** {@inheritDoc}. */
619
-    @Override
620
-    public void addWindow(final FrameContainer parent,
621
-            final FrameContainer window, final boolean focus) {
622
-        addWindow(window, focus);
623
-    }
624
-
625
-    /** {@inheritDoc}. */
626
-    @Override
627
-    public void delWindow(final FrameContainer parent,
628
-            final FrameContainer window) {
629
-        delWindow(window);
630
-    }
631
-}
616
+}

+ 21
- 7
src/com/dmdirc/addons/ui_swing/SwingController.java 查看文件

@@ -65,6 +65,7 @@ import com.dmdirc.logger.ErrorLevel;
65 65
 import com.dmdirc.logger.Logger;
66 66
 import com.dmdirc.plugins.Plugin;
67 67
 import com.dmdirc.ui.IconManager;
68
+import com.dmdirc.ui.WindowManager;
68 69
 import com.dmdirc.ui.core.dialogs.sslcertificate.SSLCertificateDialogModel;
69 70
 import com.dmdirc.ui.interfaces.ChannelWindow;
70 71
 import com.dmdirc.ui.interfaces.InputWindow;
@@ -123,6 +124,8 @@ public final class SwingController extends Plugin implements Serializable,
123 124
     private AtomicBoolean mainFrameCreated = new AtomicBoolean(false);
124 125
     /** Error dialog. */
125 126
     private ErrorListDialog errorDialog;
127
+    /** Window factory. */
128
+    private final SwingWindowFactory windowFactory = new SwingWindowFactory(this);
126 129
 
127 130
     /** Instantiates a new SwingController. */
128 131
     public SwingController() {
@@ -157,6 +160,16 @@ public final class SwingController extends Plugin implements Serializable,
157 160
         return getMainFrame();
158 161
     }
159 162
 
163
+    /**
164
+     * Returns the window factory used by this controller.
165
+     *
166
+     * @return This controller's window factory
167
+     * @since 0.6.4
168
+     */
169
+    public SwingWindowFactory getWindowFactory() {
170
+        return windowFactory;
171
+    }
172
+
160 173
     /**
161 174
      * Retrieves the main window used by this UI.
162 175
      *
@@ -189,7 +202,7 @@ public final class SwingController extends Plugin implements Serializable,
189 202
             /** {@inheritDoc} */
190 203
             @Override
191 204
             public void run() {
192
-                setObject(new ChannelFrame(channel, SwingController.this));
205
+                setObject(new ChannelFrame(SwingController.this, channel));
193 206
             }
194 207
         });
195 208
     }
@@ -202,7 +215,7 @@ public final class SwingController extends Plugin implements Serializable,
202 215
             /** {@inheritDoc} */
203 216
             @Override
204 217
             public void run() {
205
-                setObject(new ServerFrame(server, SwingController.this));
218
+                setObject(new ServerFrame(SwingController.this, server));
206 219
             }
207 220
         });
208 221
     }
@@ -215,27 +228,27 @@ public final class SwingController extends Plugin implements Serializable,
215 228
             /** {@inheritDoc} */
216 229
             @Override
217 230
             public void run() {
218
-                setObject(new QueryFrame(query, SwingController.this));
231
+                setObject(new QueryFrame(SwingController.this, query));
219 232
             }
220 233
         });
221 234
     }
222 235
 
223 236
     /** {@inheritDoc} */
224 237
     @Override
225
-    public Window getWindow(final FrameContainer owner) {
238
+    public Window getWindow(final FrameContainer<?> owner) {
226 239
         return UIUtilities.invokeAndWait(new ReturnableThread<CustomFrame>() {
227 240
 
228 241
             /** {@inheritDoc} */
229 242
             @Override
230 243
             public void run() {
231
-                setObject(new CustomFrame(owner, SwingController.this));
244
+                setObject(new CustomFrame(SwingController.this, owner));
232 245
             }
233 246
         });
234 247
     }
235 248
 
236 249
     /** {@inheritDoc} */
237 250
     @Override
238
-    public InputWindow getInputWindow(final WritableFrameContainer owner) {
251
+    public InputWindow getInputWindow(final WritableFrameContainer<?> owner) {
239 252
         LOGGER.finest("getInputWindow()");
240 253
 
241 254
         return UIUtilities.invokeAndWait(new ReturnableThread<CustomInputFrame>() {
@@ -244,7 +257,7 @@ public final class SwingController extends Plugin implements Serializable,
244 257
             @Override
245 258
             public void run() {
246 259
                 LOGGER.finest("getInputWindow(): run");
247
-                setObject(new CustomInputFrame(owner, SwingController.this));
260
+                setObject(new CustomInputFrame(SwingController.this, owner));
248 261
                 LOGGER.finest("getInputWindow(): object set: " + getObject());
249 262
             }
250 263
         });
@@ -665,6 +678,7 @@ public final class SwingController extends Plugin implements Serializable,
665 678
                     + "consider using the official JRE.").display();
666 679
         }
667 680
 
681
+        WindowManager.addFrameListener(windowFactory);
668 682
         Main.setUI(this);
669 683
     }
670 684
 

+ 185
- 0
src/com/dmdirc/addons/ui_swing/SwingWindowFactory.java 查看文件

@@ -0,0 +1,185 @@
1
+
2
+package com.dmdirc.addons.ui_swing;
3
+
4
+import com.dmdirc.FrameContainer;
5
+import com.dmdirc.addons.ui_swing.components.frames.ChannelFrame;
6
+import com.dmdirc.addons.ui_swing.components.frames.CustomFrame;
7
+import com.dmdirc.addons.ui_swing.components.frames.CustomInputFrame;
8
+import com.dmdirc.addons.ui_swing.components.frames.QueryFrame;
9
+import com.dmdirc.addons.ui_swing.components.frames.ServerFrame;
10
+import com.dmdirc.logger.ErrorLevel;
11
+import com.dmdirc.logger.Logger;
12
+import com.dmdirc.ui.interfaces.ChannelWindow;
13
+import com.dmdirc.ui.interfaces.FrameListener;
14
+import com.dmdirc.ui.interfaces.InputWindow;
15
+import com.dmdirc.ui.interfaces.QueryWindow;
16
+import com.dmdirc.ui.interfaces.ServerWindow;
17
+import com.dmdirc.ui.interfaces.Window;
18
+import com.dmdirc.util.ListenerList;
19
+
20
+import java.util.HashMap;
21
+import java.util.Map;
22
+
23
+/**
24
+ * Handles creation of windows in the Swing UI.
25
+ * 
26
+ * @since 0.6.4
27
+ * @author chris
28
+ */
29
+public class SwingWindowFactory implements FrameListener {
30
+
31
+    /** A map of known implementations of window interfaces. */
32
+    private static final Map<Class<? extends Window>, Class<? extends Window>> IMPLEMENTATIONS
33
+            = new HashMap<Class<? extends Window>, Class<? extends Window>>();
34
+
35
+    static {
36
+        IMPLEMENTATIONS.put(Window.class, CustomFrame.class);
37
+        IMPLEMENTATIONS.put(InputWindow.class, CustomInputFrame.class);
38
+        IMPLEMENTATIONS.put(ServerWindow.class, ServerFrame.class);
39
+        IMPLEMENTATIONS.put(QueryWindow.class, QueryFrame.class);
40
+        IMPLEMENTATIONS.put(ChannelWindow.class, ChannelFrame.class);
41
+    }
42
+
43
+    /** The controller that owns this window factory. */
44
+    private final SwingController controller;
45
+
46
+    /** Our list of listeners. */
47
+    private final ListenerList listeners = new ListenerList();
48
+
49
+    /**
50
+     * Creates a new window factory for the specified controller.
51
+     *
52
+     * @param controller The controller this factory is for
53
+     */
54
+    public SwingWindowFactory(final SwingController controller) {
55
+        this.controller = controller;
56
+    }
57
+
58
+    /**
59
+     * Registers a new listener which will be notified about the addition
60
+     * and deletion of all Swing UI windows.
61
+     *
62
+     * @param listener The listener to be added
63
+     */
64
+    public void addWindowListener(final SwingWindowListener listener) {
65
+        listeners.add(SwingWindowListener.class, listener);
66
+    }
67
+
68
+    /** {@inheritDoc} */
69
+    @Override
70
+    public void addWindow(final FrameContainer<?> window, final boolean focus) {
71
+        addWindow(null, window, focus);
72
+    }
73
+
74
+    /**
75
+     * Creates a new window for the specified container.
76
+     *
77
+     * @param <T> The type of window that should be created
78
+     * @param window The container that owns the window
79
+     * @param focus Whether the window should be focused initially
80
+     * @return The created window or null on error
81
+     */
82
+    @SuppressWarnings("unchecked")
83
+    protected <T extends Window> T doAddWindow(final FrameContainer<T> window,
84
+            final boolean focus) {
85
+        final Class<T> clazz;
86
+
87
+        if (IMPLEMENTATIONS.containsKey(window.getWindowClass())) {
88
+            clazz = (Class<T>) IMPLEMENTATIONS.get(window.getWindowClass());
89
+        } else {
90
+            clazz = window.getWindowClass();
91
+        }
92
+
93
+        try {
94
+            final T frame = (T) clazz.getConstructors()[0].newInstance(controller, window);
95
+            window.addWindow(frame);
96
+
97
+            return frame;
98
+        } catch (Exception ex) {
99
+            Logger.appError(ErrorLevel.HIGH, "Unable to create window", ex);
100
+            return null;
101
+        }
102
+    }
103
+
104
+    /**
105
+     * Retrieves a single Swing UI created window belonging to the specified
106
+     * container. Returns null if the container is null or no such window exists.
107
+     *
108
+     * @param window The container whose windows should be searched
109
+     * @return A relevant window or null
110
+     */
111
+    public Window getSwingWindow(final FrameContainer<?> window) {
112
+        if (window == null) {
113
+            return null;
114
+        }
115
+
116
+        for (Window child : window.getWindows()) {
117
+            if (child.getController() == controller) {
118
+                return child;
119
+            }
120
+        }
121
+
122
+        return null;
123
+    }
124
+
125
+    /** {@inheritDoc} */
126
+    @Override
127
+    public void delWindow(final FrameContainer<?> window) {
128
+        delWindow(null, window);
129
+    }
130
+
131
+    /** {@inheritDoc} */
132
+    @Override
133
+    public void addWindow(final FrameContainer<?> parent,
134
+            final FrameContainer<?> window, final boolean focus) {
135
+        final Window parentWindow = getSwingWindow(parent);
136
+        final Window childWindow = doAddWindow(window, focus);
137
+
138
+        if (childWindow == null) {
139
+            return;
140
+        }
141
+
142
+        for (SwingWindowListener listener : listeners.get(SwingWindowListener.class)) {
143
+            listener.windowAdded(parentWindow, childWindow);
144
+        }
145
+
146
+        if (focus) {
147
+            childWindow.open();
148
+        }
149
+    }
150
+
151
+    /** {@inheritDoc} */
152
+    @Override
153
+    public void delWindow(final FrameContainer<?> parent, final FrameContainer<?> window) {
154
+        final Window parentWindow = getSwingWindow(parent);
155
+        final Window childWindow = getSwingWindow(window);
156
+
157
+        for (SwingWindowListener listener : listeners.get(SwingWindowListener.class)) {
158
+            listener.windowDeleted(parentWindow, childWindow);
159
+        }
160
+    }
161
+
162
+    /**
163
+     * An interface for objects interested in Swing UI window events.
164
+     */
165
+    public static interface SwingWindowListener {
166
+
167
+        /**
168
+         * Called when a new window is added.
169
+         *
170
+         * @param parent The parent of the added window (may be null)
171
+         * @param window The window that was added
172
+         */
173
+        void windowAdded(final Window parent, final Window window);
174
+
175
+        /**
176
+         * Called when a new window was deleted.
177
+         *
178
+         * @param parent The parent of the added window (may be null)
179
+         * @param window The window that was deleted
180
+         */
181
+        void windowDeleted(final Window parent, final Window window);
182
+        
183
+    }
184
+
185
+}

+ 15
- 28
src/com/dmdirc/addons/ui_swing/components/MDIBar.java 查看文件

@@ -26,6 +26,8 @@ package com.dmdirc.addons.ui_swing.components;
26 26
 import com.dmdirc.addons.ui_swing.MainFrame;
27 27
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
28 28
 import com.dmdirc.FrameContainer;
29
+import com.dmdirc.addons.ui_swing.SwingController;
30
+import com.dmdirc.addons.ui_swing.SwingWindowFactory.SwingWindowListener;
29 31
 import com.dmdirc.config.ConfigManager;
30 32
 import com.dmdirc.config.IdentityManager;
31 33
 import com.dmdirc.interfaces.ConfigChangeListener;
@@ -33,7 +35,6 @@ import com.dmdirc.interfaces.SelectionListener;
33 35
 import com.dmdirc.ui.IconManager;
34 36
 import com.dmdirc.ui.WindowManager;
35 37
 import com.dmdirc.ui.interfaces.Window;
36
-import com.dmdirc.ui.interfaces.FrameListener;
37 38
 
38 39
 import java.awt.event.ActionEvent;
39 40
 import java.awt.event.ActionListener;
@@ -49,7 +50,7 @@ import net.miginfocom.swing.MigLayout;
49 50
 /**
50 51
  * Provides an MDI style bar for restore/minimise/close.
51 52
  */
52
-public class MDIBar extends JPanel implements FrameListener, SelectionListener,
53
+public class MDIBar extends JPanel implements SwingWindowListener, SelectionListener,
53 54
         PropertyChangeListener, ActionListener, ConfigChangeListener {
54 55
 
55 56
     private static final long serialVersionUID = -8028057596226636245L;
@@ -66,9 +67,10 @@ public class MDIBar extends JPanel implements FrameListener, SelectionListener,
66 67
     /**
67 68
      * Instantiates a new MDI bar.
68 69
      *
70
+     * @param controller The controller that owns this MDI bar
69 71
      * @param mainFrame Main frame instance
70 72
      */
71
-    public MDIBar(final MainFrame mainFrame) {
73
+    public MDIBar(final SwingController controller, final MainFrame mainFrame) {
72 74
         this.mainFrame = mainFrame;
73 75
         this.config = IdentityManager.getGlobalConfig();
74 76
         visibility = config.getOption("ui", "mdiBarVisibility");
@@ -86,8 +88,8 @@ public class MDIBar extends JPanel implements FrameListener, SelectionListener,
86 88
         add(restoreButton, "w 17!, h 17!, right");
87 89
         add(closeButton, "w 17!, h 17!, right");
88 90
 
91
+        controller.getWindowFactory().addWindowListener(this);
89 92
 
90
-        WindowManager.addFrameListener(this);
91 93
         WindowManager.addSelectionListener(this);
92 94
         closeButton.addActionListener(this);
93 95
         minimiseButton.addActionListener(this);
@@ -129,36 +131,20 @@ public class MDIBar extends JPanel implements FrameListener, SelectionListener,
129 131
 
130 132
     /** {@inheritDoc} */
131 133
     @Override
132
-    public void addWindow(final FrameContainer window, final boolean focus) {
133
-        if (window.getFrame() instanceof JInternalFrame) {
134
-            ((JInternalFrame) window.getFrame()).addPropertyChangeListener(
135
-                    "maximum", this);
136
-        }
137
-        check();
138
-    }
134
+    public void windowAdded(final Window parent, final Window window) {
135
+        ((JInternalFrame) window).addPropertyChangeListener(
136
+                "maximum", this);
139 137
 
140
-    /** {@inheritDoc} */
141
-    @Override
142
-    public void delWindow(final FrameContainer window) {
143
-        if (window.getFrame() instanceof JInternalFrame) {
144
-            ((JInternalFrame) window.getFrame()).removePropertyChangeListener(
145
-                    this);
146
-        }
147 138
         check();
148 139
     }
149 140
 
150 141
     /** {@inheritDoc} */
151 142
     @Override
152
-    public void addWindow(final FrameContainer parent,
153
-            final FrameContainer window, final boolean focus) {
154
-        addWindow(window, focus);
155
-    }
143
+    public void windowDeleted(final Window parent, final Window window) {
144
+        ((JInternalFrame) window).removePropertyChangeListener(
145
+                this);
156 146
 
157
-    /** {@inheritDoc} */
158
-    @Override
159
-    public void delWindow(final FrameContainer parent,
160
-                          final FrameContainer window) {
161
-        delWindow(window);
147
+        check();
162 148
     }
163 149
 
164 150
     /** {@inheritDoc} */
@@ -200,8 +186,9 @@ public class MDIBar extends JPanel implements FrameListener, SelectionListener,
200 186
         check();
201 187
     }
202 188
 
189
+    /** {@inheritDoc} */
203 190
     @Override
204
-    public void selectionChanged(FrameContainer window) {
191
+    public void selectionChanged(final FrameContainer<?> window) {
205 192
         activeFrame = window.getFrame();
206 193
         check();
207 194
     }

+ 3
- 3
src/com/dmdirc/addons/ui_swing/components/MenuBar.java 查看文件

@@ -98,7 +98,7 @@ public class MenuBar extends JMenuBar implements ActionListener, MenuListener {
98 98
         add(new WindowMenuFrameManager(controller));
99 99
         initHelpMenu();
100 100
         add(Box.createHorizontalGlue(), "growx, pushx");
101
-        add(new MDIBar(mainFrame));
101
+        add(new MDIBar(controller, mainFrame));
102 102
         add(Box.createHorizontalStrut(PlatformDefaults.getPanelInsets(1).getUnit()));
103 103
 
104 104
         getActionMap().setParent(null);
@@ -270,7 +270,7 @@ public class MenuBar extends JMenuBar implements ActionListener, MenuListener {
270 270
         } else if (e.getActionCommand().equals("feedback")) {
271 271
             FeedbackDialog.showFeedbackDialog(mainFrame);
272 272
         } else if (e.getActionCommand().equals("ChannelSettings")) {
273
-            final FrameContainer activeWindow = WindowManager.getActiveWindow();
273
+            final FrameContainer<?> activeWindow = WindowManager.getActiveWindow();
274 274
             if (activeWindow instanceof Channel) {
275 275
                 controller.showChannelSettingsDialog(((Channel) activeWindow));
276 276
             }
@@ -305,7 +305,7 @@ public class MenuBar extends JMenuBar implements ActionListener, MenuListener {
305 305
     /** {@inheritDoc} */
306 306
     @Override
307 307
     public void menuSelected(final MenuEvent e) {
308
-        final FrameContainer activeWindow = WindowManager.getActiveWindow();
308
+        final FrameContainer<?> activeWindow = WindowManager.getActiveWindow();
309 309
 
310 310
         ssd.setEnabled(activeWindow != null && activeWindow.getServer() != null
311 311
                 && activeWindow.getServer().getState() == ServerState.CONNECTED);

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/ToolTipPanel.java 查看文件

@@ -160,7 +160,7 @@ public class ToolTipPanel extends JPanel implements MouseListener {
160 160
     public void registerTooltipHandler(final JComponent component,
161 161
             final String tooltipText) {
162 162
         tooltips.put(component, tooltipText);
163
-        if (component instanceof JXLayer) {
163
+        if (component instanceof JXLayer<?>) {
164 164
             final LayerUI<JComponent> layerUI = new AbstractLayerUI<JComponent>() {
165 165
 
166 166
                 private static final long serialVersionUID =

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/TopicBar.java 查看文件

@@ -104,7 +104,7 @@ public class TopicBar extends JComponent implements ActionListener,
104 104
      * @param channelFrame Parent channel frame
105 105
      */
106 106
     public TopicBar(final ChannelFrame channelFrame) {
107
-        this.channel = channelFrame.getChannel();
107
+        this.channel = (Channel) channelFrame.getContainer();
108 108
         controller = channelFrame.getController();
109 109
         topicText = new TextPaneInputField();
110 110
         topicLengthMax = channel.getMaxTopicLength();

+ 22
- 34
src/com/dmdirc/addons/ui_swing/components/desktopPane/DMDircDesktopPane.java 查看文件

@@ -25,6 +25,8 @@ package com.dmdirc.addons.ui_swing.components.desktopPane;
25 25
 import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.addons.ui_swing.BackgroundOption;
27 27
 import com.dmdirc.addons.ui_swing.MainFrame;
28
+import com.dmdirc.addons.ui_swing.SwingController;
29
+import com.dmdirc.addons.ui_swing.SwingWindowFactory.SwingWindowListener;
28 30
 import com.dmdirc.addons.ui_swing.UIUtilities;
29 31
 import com.dmdirc.addons.ui_swing.components.TreeScroller;
30 32
 import com.dmdirc.addons.ui_swing.components.frames.InputTextFrame;
@@ -36,9 +38,7 @@ import com.dmdirc.interfaces.ConfigChangeListener;
36 38
 import com.dmdirc.interfaces.SelectionListener;
37 39
 import com.dmdirc.logger.ErrorLevel;
38 40
 import com.dmdirc.logger.Logger;
39
-import com.dmdirc.ui.WindowManager;
40 41
 import com.dmdirc.ui.interfaces.Window;
41
-import com.dmdirc.ui.interfaces.FrameListener;
42 42
 import com.dmdirc.util.ReturnableThread;
43 43
 import com.dmdirc.util.URLBuilder;
44 44
 
@@ -70,7 +70,7 @@ import javax.swing.tree.TreeSelectionModel;
70 70
 /**
71 71
  * DMDirc Extentions to JDesktopPane.
72 72
  */
73
-public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
73
+public class DMDircDesktopPane extends JDesktopPane implements SwingWindowListener,
74 74
         SelectionListener, PropertyChangeListener, ConfigChangeListener {
75 75
 
76 76
     /** Logger to use. */
@@ -91,7 +91,7 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
91 91
     /** The number of pixels each new internal frame is offset by. */
92 92
     private static final int FRAME_OPENING_OFFSET = 30;
93 93
     /** Node storage, used for adding and deleting nodes correctly. */
94
-    private final Map<FrameContainer, TreeViewNode> nodes;
94
+    private final Map<Window, TreeViewNode> nodes;
95 95
     /** Data model. */
96 96
     private final TreeViewModel model;
97 97
     /** Selected model. */
@@ -115,11 +115,13 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
115 115
 
116 116
     /**
117 117
      * Initialises the DMDirc desktop pane.
118
-     * 
118
+     *
119
+     * @param controller The controller that owns this desktop pane
119 120
      * @param mainFrame Main frame
120 121
      * @param domain Config domain
121 122
      */
122
-    public DMDircDesktopPane(final MainFrame mainFrame, final String domain) {
123
+    public DMDircDesktopPane(final SwingController controller,
124
+            final MainFrame mainFrame, final String domain) {
123 125
         super();
124 126
 
125 127
         this.mainFrame = mainFrame;
@@ -128,7 +130,7 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
128 130
         setBorder(BorderFactory.createEtchedBorder());
129 131
         setUI(new ProxyDesktopPaneUI(getUI(), this));
130 132
 
131
-        nodes = new HashMap<FrameContainer, TreeViewNode>();
133
+        nodes = new HashMap<Window, TreeViewNode>();
132 134
         model = new TreeViewModel(new TreeViewNode(null, null));
133 135
         selectionModel = new DefaultTreeSelectionModel();
134 136
         treeScroller = new TreeScroller(model, selectionModel, false) {
@@ -137,12 +139,13 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
137 139
             @Override
138 140
             protected void setPath(final TreePath path) {
139 141
                 super.setPath(path);
140
-                ((TreeViewNode) path.getLastPathComponent()).getFrameContainer().
142
+                ((TreeViewNode) path.getLastPathComponent()).getWindow().
141 143
                         activateFrame();
142 144
             }
143 145
         };
144 146
 
145
-        WindowManager.addFrameListener(this);
147
+        controller.getWindowFactory().addWindowListener(this);
148
+        
146 149
         IdentityManager.getGlobalConfig().addChangeListener(domain,
147 150
                 "desktopbackground", this);
148 151
         IdentityManager.getGlobalConfig().addChangeListener(domain,
@@ -220,22 +223,15 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
220 223
         });
221 224
     }
222 225
 
223
-    /** {@inheritDoc} */
224
-    @Override
225
-    public void addWindow(final FrameContainer window, final boolean focus) {
226
-        addWindow(model.getRootNode(), window);
227
-    }
228
-
229 226
     @Override
230
-    public void addWindow(final FrameContainer parent,
231
-            final FrameContainer window, final boolean focus) {
227
+    public void windowAdded(final Window parent, final Window window) {
232 228
         UIUtilities.invokeAndWait(new Runnable() {
233 229
 
234 230
             /** {@inheritDoc} */
235 231
             @Override
236 232
             public void run() {
237 233
                 synchronized (nodes) {
238
-                    addWindow(nodes.get(parent), window);
234
+                    addWindow(parent == null ? model.getRootNode() : nodes.get(parent), window);
239 235
                 }
240 236
             }
241 237
         });
@@ -243,14 +239,7 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
243 239
 
244 240
     /** {@inheritDoc} */
245 241
     @Override
246
-    public void delWindow(final FrameContainer parent,
247
-            final FrameContainer window) {
248
-        delWindow(window);
249
-    }
250
-
251
-    /** {@inheritDoc} */
252
-    @Override
253
-    public void delWindow(final FrameContainer window) {
242
+    public void windowDeleted(final Window parent, final Window window) {
254 243
         UIUtilities.invokeAndWait(new Runnable() {
255 244
 
256 245
             /** {@inheritDoc} */
@@ -269,8 +258,8 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
269 258
                     model.removeNodeFromParent(nodes.get(window));
270 259
                 }
271 260
                 nodes.remove(window);
272
-                window.removeSelectionListener(DMDircDesktopPane.this);
273
-                ((TextFrame) window.getFrame()).removePropertyChangeListener(
261
+                window.getContainer().removeSelectionListener(DMDircDesktopPane.this);
262
+                ((TextFrame) window).removePropertyChangeListener(
274 263
                         DMDircDesktopPane.this);
275 264
                 if (getAllFrames().length == 0) {
276 265
                     mainFrame.setTitle(null);
@@ -285,21 +274,20 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
285 274
      * @param parent Parent node
286 275
      * @param window Window to add
287 276
      */
288
-    public void addWindow(final TreeViewNode parent,
289
-            final FrameContainer window) {
277
+    public void addWindow(final TreeViewNode parent, final Window window) {
290 278
         UIUtilities.invokeAndWait(new Runnable() {
291 279
 
292 280
             /** {@inheritDoc} */
293 281
             @Override
294 282
             public void run() {
295
-                final TreeViewNode node = new TreeViewNode(null, window);
283
+                final TreeViewNode node = new TreeViewNode(null, window.getContainer());
296 284
                 synchronized (nodes) {
297 285
                     nodes.put(window, node);
298 286
                 }
299 287
                 node.setUserObject(window);
300 288
                 model.insertNodeInto(node, parent);
301
-                window.addSelectionListener(DMDircDesktopPane.this);
302
-                ((TextFrame) window.getFrame()).addPropertyChangeListener(
289
+                window.getContainer().addSelectionListener(DMDircDesktopPane.this);
290
+                ((TextFrame) window).addPropertyChangeListener(
303 291
                         DMDircDesktopPane.this);
304 292
             }
305 293
         });
@@ -317,7 +305,7 @@ public class DMDircDesktopPane extends JDesktopPane implements FrameListener,
317 305
 
318 306
     /** {@inheritDoc} */
319 307
     @Override
320
-    public void selectionChanged(final FrameContainer window) {
308
+    public void selectionChanged(final FrameContainer<?> window) {
321 309
         UIUtilities.invokeLater(new Runnable() {
322 310
 
323 311
             /** {@inheritDoc} */

+ 3
- 2
src/com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.java 查看文件

@@ -86,8 +86,8 @@ public final class ChannelFrame extends InputTextFrame implements ActionListener
86 86
      * @param owner The Channel object that owns this frame
87 87
      * @param controller Swing controller
88 88
      */
89
-    public ChannelFrame(final Channel owner, final SwingController controller) {
90
-        super(owner, controller);
89
+    public ChannelFrame(final SwingController controller, final Channel owner) {
90
+        super(controller, owner);
91 91
 
92 92
         parentChannel = owner;
93 93
 
@@ -157,6 +157,7 @@ public final class ChannelFrame extends InputTextFrame implements ActionListener
157 157
 
158 158
     /** {@inheritDoc} */
159 159
     @Override
160
+    @Deprecated
160 161
     public Channel getChannel() {
161 162
         return parentChannel;
162 163
     }

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/frames/CustomFrame.java 查看文件

@@ -49,7 +49,7 @@ public class CustomFrame extends TextFrame {
49 49
      * @param owner The frame container that owns this frame
50 50
      * @param controller Swing controller
51 51
      */
52
-    public CustomFrame(final FrameContainer owner, final SwingController controller) {
52
+    public CustomFrame(final SwingController controller, final FrameContainer<?> owner) {
53 53
         super(owner, controller);
54 54
 
55 55
         initComponents();

+ 5
- 3
src/com/dmdirc/addons/ui_swing/components/frames/CustomInputFrame.java 查看文件

@@ -26,6 +26,7 @@ import com.dmdirc.addons.ui_swing.SwingController;
26 26
 import com.dmdirc.commandparser.PopupType;
27 27
 import com.dmdirc.commandparser.parsers.CommandParser;
28 28
 import com.dmdirc.addons.ui_swing.components.SwingInputHandler;
29
+import com.dmdirc.ui.interfaces.InputWindow;
29 30
 
30 31
 import javax.swing.JPopupMenu;
31 32
 
@@ -52,8 +53,9 @@ public class CustomInputFrame extends InputTextFrame {
52 53
      * @param owner The frame container that owns this frame
53 54
      * @param controller Swing controller
54 55
      */
55
-    public CustomInputFrame(final WritableFrameContainer owner, final SwingController controller) {
56
-        super(owner, controller);
56
+    public CustomInputFrame(final SwingController controller,
57
+            final WritableFrameContainer<? extends InputWindow> owner) {
58
+        super(controller, owner);
57 59
 
58 60
         setInputHandler(new SwingInputHandler(getInputField(), owner.getCommandParser(), this));
59 61
 
@@ -63,7 +65,7 @@ public class CustomInputFrame extends InputTextFrame {
63 65
     /** {@inheritDoc} */
64 66
     @Override
65 67
     public final CommandParser getCommandParser() {
66
-        return ((WritableFrameContainer) frameParent).getCommandParser();
68
+        return ((WritableFrameContainer<? extends InputWindow>) frameParent).getCommandParser();
67 69
     }
68 70
 
69 71
     /**

+ 6
- 4
src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java 查看文件

@@ -98,8 +98,8 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
98 98
      * @param owner WritableFrameContainer owning this frame.
99 99
      * @param controller Swing controller
100 100
      */
101
-    public InputTextFrame(final WritableFrameContainer owner,
102
-            final SwingController controller) {
101
+    public InputTextFrame(final SwingController controller,
102
+            final WritableFrameContainer<? extends InputWindow> owner) {
103 103
         super(owner, controller);
104 104
 
105 105
         initComponents();
@@ -207,8 +207,8 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
207 207
      * @return This frame's container.
208 208
      */
209 209
     @Override
210
-    public WritableFrameContainer getContainer() {
211
-        return (WritableFrameContainer) super.getContainer();
210
+    public WritableFrameContainer<? extends InputWindow> getContainer() {
211
+        return (WritableFrameContainer<? extends InputWindow>) super.getContainer();
212 212
     }
213 213
 
214 214
     /**
@@ -229,6 +229,7 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
229 229
     public final void setInputHandler(final InputHandler newInputHandler) {
230 230
         this.inputHandler = newInputHandler;
231 231
         inputHandler.addValidationListener(inputField);
232
+        inputHandler.setTabCompleter(((WritableFrameContainer<?>) frameParent).getTabCompleter());
232 233
     }
233 234
 
234 235
     /**
@@ -264,6 +265,7 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
264 265
      * @param awayState away state
265 266
      */
266 267
     @Override
268
+    @Deprecated
267 269
     public void setAwayIndicator(final boolean awayState) {
268 270
         UIUtilities.invokeLater(new Runnable() {
269 271
 

+ 2
- 2
src/com/dmdirc/addons/ui_swing/components/frames/QueryFrame.java 查看文件

@@ -52,8 +52,8 @@ public final class QueryFrame extends InputTextFrame implements QueryWindow {
52 52
      * @param owner Parent Frame container
53 53
      * @param controller Swing controller
54 54
      */
55
-    public QueryFrame(final Query owner, final SwingController controller) {
56
-        super(owner, controller);
55
+    public QueryFrame(final SwingController controller, final Query owner) {
56
+        super(controller, owner);
57 57
 
58 58
         initComponents();
59 59
 

+ 2
- 2
src/com/dmdirc/addons/ui_swing/components/frames/ServerFrame.java 查看文件

@@ -62,8 +62,8 @@ public final class ServerFrame extends InputTextFrame implements ServerWindow,
62 62
      * @param owner Parent Frame container
63 63
      * @param controller Swing controller
64 64
      */
65
-    public ServerFrame(final Server owner, final SwingController controller) {
66
-        super(owner, controller);
65
+    public ServerFrame(final SwingController controller, final Server owner) {
66
+        super(controller, owner);
67 67
 
68 68
         initComponents();
69 69
         

+ 13
- 15
src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java 查看文件

@@ -113,7 +113,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
113 113
      */
114 114
     private static final long serialVersionUID = 5;
115 115
     /** The channel object that owns this frame. */
116
-    protected final FrameContainer frameParent;
116
+    protected final FrameContainer<?> frameParent;
117 117
     /** Frame output pane. */
118 118
     private TextPane textPane;
119 119
     /** search bar. */
@@ -137,7 +137,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
137 137
      * @param owner FrameContainer owning this frame.
138 138
      * @param controller Swing controller
139 139
      */
140
-    public TextFrame(final FrameContainer owner,
140
+    public TextFrame(final FrameContainer<?> owner,
141 141
             final SwingController controller) {
142 142
         super();
143 143
         this.controller = controller;
@@ -202,15 +202,6 @@ public abstract class TextFrame extends JInternalFrame implements Window,
202 202
         return panel;
203 203
     }
204 204
 
205
-    /**
206
-     * Returns this text frames swing controller.
207
-     * 
208
-     * @return Swing controller
209
-     */
210
-    public SwingController getController() {
211
-        return controller;
212
-    }
213
-
214 205
     /** {@inheritDoc} */
215 206
     @Override
216 207
     @Deprecated
@@ -738,11 +729,12 @@ public abstract class TextFrame extends JInternalFrame implements Window,
738 729
 
739 730
     /** {@inheritDoc} */
740 731
     @Override
741
-    public FrameContainer getContainer() {
732
+    public FrameContainer<?> getContainer() {
742 733
         return frameParent;
743 734
     }
744 735
 
745 736
     /** {@inheritDoc} */
737
+    @Deprecated
746 738
     @Override
747 739
     public ConfigManager getConfigManager() {
748 740
         return getContainer().getConfigManager();
@@ -1005,7 +997,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
1005 997
 
1006 998
     /** {@inheritDoc} */
1007 999
     @Override
1008
-    public void iconChanged(final FrameContainer window, final String icon) {
1000
+    public void iconChanged(final FrameContainer<?> window, final String icon) {
1009 1001
         UIUtilities.invokeLater(new Runnable() {
1010 1002
 
1011 1003
             /** {@inheritDoc} */
@@ -1018,13 +1010,13 @@ public abstract class TextFrame extends JInternalFrame implements Window,
1018 1010
 
1019 1011
     /** {@inheritDoc} */
1020 1012
     @Override
1021
-    public void nameChanged(final FrameContainer window, final String name) {
1013
+    public void nameChanged(final FrameContainer<?> window, final String name) {
1022 1014
         //Ignore
1023 1015
     }
1024 1016
 
1025 1017
     /** {@inheritDoc} */
1026 1018
     @Override
1027
-    public void titleChanged(final FrameContainer window, final String title) {
1019
+    public void titleChanged(final FrameContainer<?> window, final String title) {
1028 1020
         UIUtilities.invokeLater(new Runnable() {
1029 1021
 
1030 1022
             /** {@inheritDoc} */
@@ -1036,4 +1028,10 @@ public abstract class TextFrame extends JInternalFrame implements Window,
1036 1028
             }
1037 1029
         });
1038 1030
     }
1031
+
1032
+    /** {@inheritDoc} */
1033
+    @Override
1034
+    public SwingController getController() {
1035
+        return controller;
1036
+    }
1039 1037
 }

+ 2
- 2
src/com/dmdirc/addons/ui_swing/components/reorderablelist/ArrayListTransferable.java 查看文件

@@ -40,14 +40,14 @@ public final class ArrayListTransferable implements Transferable {
40 40
     /** Serial transfer flavour. */
41 41
     private final DataFlavor serialArrayListFlavor;
42 42
     /** Transferred ArrayList. */
43
-    private final ArrayList data; //NOPMD
43
+    private final ArrayList<?> data; //NOPMD
44 44
     
45 45
     /** 
46 46
      * Initialises the ArrayListTransferable. 
47 47
      *
48 48
      * @param alist ArrayList to transfer
49 49
      */
50
-    public ArrayListTransferable(final ArrayList alist) { //NOPMD
50
+    public ArrayListTransferable(final ArrayList<?> alist) { //NOPMD
51 51
         super();
52 52
         
53 53
         data = alist;

+ 20
- 20
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java 查看文件

@@ -71,9 +71,9 @@ public final class ButtonBar implements FrameManager, ActionListener,
71 71
      */
72 72
     private static final long serialVersionUID = 3;
73 73
     /** A map of parent containers to their respective windows. */
74
-    private final MapList<FrameContainer, FrameContainer> windows;
74
+    private final MapList<FrameContainer<?>, FrameContainer<?>> windows;
75 75
     /** A map of containers to the buttons we're using for them. */
76
-    private final Map<FrameContainer, JToggleButton> buttons;
76
+    private final Map<FrameContainer<?>, JToggleButton> buttons;
77 77
     /** The position of this frame manager. */
78 78
     private final FramemanagerPosition position;
79 79
     /** The parent for the manager. */
@@ -81,7 +81,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
81 81
     /** The panel used for our buttons. */
82 82
     private final JPanel panel;
83 83
     /** The currently selected window. */
84
-    private transient FrameContainer selected;
84
+    private transient FrameContainer<?> selected;
85 85
     /** Selected window. */
86 86
     private Window activeWindow;
87 87
     /** The number of buttons per row or column. */
@@ -95,8 +95,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
95 95
 
96 96
     /** Creates a new instance of DummyFrameManager. */
97 97
     public ButtonBar() {
98
-        windows = new MapList<FrameContainer, FrameContainer>();
99
-        buttons = new HashMap<FrameContainer, JToggleButton>();
98
+        windows = new MapList<FrameContainer<?>, FrameContainer<?>>();
99
+        buttons = new HashMap<FrameContainer<?>, JToggleButton>();
100 100
         position = FramemanagerPosition.getPosition(
101 101
                 IdentityManager.getGlobalConfig().getOption("ui", "framemanagerPosition"));
102 102
 
@@ -123,13 +123,13 @@ public final class ButtonBar implements FrameManager, ActionListener,
123 123
     private void relayout() {
124 124
         panel.removeAll();
125 125
 
126
-        for (Map.Entry<FrameContainer, List<FrameContainer>> entry : windows.entrySet()) {
126
+        for (Map.Entry<FrameContainer<?>, List<FrameContainer<?>>> entry : windows.entrySet()) {
127 127
             buttons.get(entry.getKey()).setPreferredSize(new Dimension(buttonWidth, buttonHeight));
128 128
             panel.add(buttons.get(entry.getKey()));
129 129
 
130 130
             Collections.sort(entry.getValue(), new FrameContainerComparator());
131 131
 
132
-            for (FrameContainer child : entry.getValue()) {
132
+            for (FrameContainer<?> child : entry.getValue()) {
133 133
                 buttons.get(child).setPreferredSize(new Dimension(buttonWidth, buttonHeight));
134 134
                 panel.add(buttons.get(child));
135 135
             }
@@ -143,7 +143,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
143 143
      *
144 144
      * @param source The Container to get title/icon info from
145 145
      */
146
-    private void addButton(final FrameContainer source) {
146
+    private void addButton(final FrameContainer<?> source) {
147 147
         final JToggleButton button = new JToggleButton(source.toString(),
148 148
                 IconManager.getIconManager().getIcon(source.getIcon()));
149 149
 
@@ -169,7 +169,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
169 169
 
170 170
     /** {@inheritDoc} */
171 171
     @Override
172
-    public void addWindow(final FrameContainer window, final boolean focus) {
172
+    public void addWindow(final FrameContainer<?> window, final boolean focus) {
173 173
         windows.add(window);
174 174
         //This window is a root window
175 175
         addButton(window);
@@ -182,7 +182,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
182 182
 
183 183
     /** {@inheritDoc} */
184 184
     @Override
185
-    public void delWindow(final FrameContainer window) {
185
+    public void delWindow(final FrameContainer<?> window) {
186 186
         windows.remove(window);
187 187
 
188 188
         relayout();
@@ -193,8 +193,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
193 193
 
194 194
     /** {@inheritDoc} */
195 195
     @Override
196
-    public void addWindow(final FrameContainer parent,
197
-            final FrameContainer window, final boolean focus) {
196
+    public void addWindow(final FrameContainer<?> parent,
197
+            final FrameContainer<?> window, final boolean focus) {
198 198
         windows.add(parent, window);
199 199
         //This window has a parent Window
200 200
         addButton(window);
@@ -207,7 +207,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
207 207
 
208 208
     /** {@inheritDoc} */
209 209
     @Override
210
-    public void delWindow(final FrameContainer parent, final FrameContainer window) {
210
+    public void delWindow(final FrameContainer<?> parent, final FrameContainer<?> window) {
211 211
         windows.remove(parent, window);
212 212
 
213 213
         relayout();
@@ -223,7 +223,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
223 223
      */
224 224
     @Override
225 225
     public void actionPerformed(final ActionEvent e) {
226
-        for (Map.Entry<FrameContainer, JToggleButton> entry : buttons.entrySet()) {
226
+        for (Map.Entry<FrameContainer<?>, JToggleButton> entry : buttons.entrySet()) {
227 227
             if (entry.getValue().equals(e.getSource())) {
228 228
                 if (entry.getKey().getFrame().equals(activeWindow)) {
229 229
                     entry.getValue().setSelected(true);
@@ -283,7 +283,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
283 283
 
284 284
     /** {@inheritDoc} */
285 285
     @Override
286
-    public void notificationSet(final FrameContainer window, final Color colour) {
286
+    public void notificationSet(final FrameContainer<?> window, final Color colour) {
287 287
         if (buttons.containsKey(window)) {
288 288
             buttons.get(window).setForeground(colour);
289 289
         }
@@ -291,13 +291,13 @@ public final class ButtonBar implements FrameManager, ActionListener,
291 291
 
292 292
     /** {@inheritDoc} */
293 293
     @Override
294
-    public void notificationCleared(final FrameContainer window) {
294
+    public void notificationCleared(final FrameContainer<?> window) {
295 295
         notificationSet(window, window.getNotification());
296 296
     }
297 297
 
298 298
     /** {@inheritDoc} */
299 299
     @Override
300
-    public void selectionChanged(final FrameContainer window) {
300
+    public void selectionChanged(final FrameContainer<?> window) {
301 301
         activeWindow = window.getFrame();
302 302
         if (selected != null && buttons.containsKey(selected)) {
303 303
             buttons.get(selected).setSelected(false);
@@ -312,19 +312,19 @@ public final class ButtonBar implements FrameManager, ActionListener,
312 312
 
313 313
     /** {@inheritDoc} */
314 314
     @Override
315
-    public void iconChanged(final FrameContainer window, final String icon) {
315
+    public void iconChanged(final FrameContainer<?> window, final String icon) {
316 316
         buttons.get(window).setIcon(IconManager.getIconManager().getIcon(icon));
317 317
     }
318 318
 
319 319
     /** {@inheritDoc} */
320 320
     @Override
321
-    public void nameChanged(final FrameContainer window, final String name) {
321
+    public void nameChanged(final FrameContainer<?> window, final String name) {
322 322
         buttons.get(window).setText(name);
323 323
     }
324 324
 
325 325
     /** {@inheritDoc} */
326 326
     @Override
327
-    public void titleChanged(final FrameContainer window, final String title) {
327
+    public void titleChanged(final FrameContainer<?> window, final String title) {
328 328
         // Do nothing
329 329
     }
330 330
 }

+ 15
- 16
src/com/dmdirc/addons/ui_swing/framemanager/tree/NodeLabel.java 查看文件

@@ -27,7 +27,6 @@ import com.dmdirc.interfaces.FrameInfoListener;
27 27
 import com.dmdirc.interfaces.NotificationListener;
28 28
 import com.dmdirc.interfaces.SelectionListener;
29 29
 import com.dmdirc.ui.IconManager;
30
-import com.dmdirc.ui.interfaces.Window;
31 30
 
32 31
 import java.awt.Color;
33 32
 import java.awt.Dimension;
@@ -49,7 +48,7 @@ public class NodeLabel extends JLabel implements SelectionListener,
49 48
      */
50 49
     private static final long serialVersionUID = 1;
51 50
     /** Node window. */
52
-    private final Window window;
51
+    private final FrameContainer<?> window;
53 52
     /** Rollover colours. */
54 53
     private boolean rollover;
55 54
     /** notification colour */
@@ -62,7 +61,7 @@ public class NodeLabel extends JLabel implements SelectionListener,
62 61
      * 
63 62
      * @param window Window for this node
64 63
      */
65
-    public NodeLabel(final Window window) {
64
+    public NodeLabel(final FrameContainer<?> window) {
66 65
         super();
67 66
 
68 67
         this.window = window;
@@ -78,11 +77,11 @@ public class NodeLabel extends JLabel implements SelectionListener,
78 77
             return;
79 78
         }
80 79
 
81
-        setText(window.getContainer().toString());
80
+        setText(window.toString());
82 81
 
83 82
         setOpaque(true);
84 83
         setToolTipText(null);
85
-        setIcon(IconManager.getIconManager().getIcon(window.getContainer().getIcon()));
84
+        setIcon(IconManager.getIconManager().getIcon(window.getIcon()));
86 85
         setBorder(BorderFactory.createEmptyBorder(1, 0, 2, 0));
87 86
 
88 87
         setPreferredSize(new Dimension(100000, getFont().getSize() +
@@ -94,8 +93,8 @@ public class NodeLabel extends JLabel implements SelectionListener,
94 93
 
95 94
     /** {@inheritDoc} */
96 95
     @Override
97
-    public void selectionChanged(final FrameContainer window) {
98
-        if (equals(window.getFrame())) {
96
+    public void selectionChanged(final FrameContainer<?> window) {
97
+        if (equals(window)) {
99 98
             selected = true;
100 99
         } else {
101 100
             selected = false;
@@ -104,39 +103,39 @@ public class NodeLabel extends JLabel implements SelectionListener,
104 103
 
105 104
     /** {@inheritDoc} */
106 105
     @Override
107
-    public void notificationSet(final FrameContainer window, final Color colour) {
108
-        if (equals(window.getFrame())) {
106
+    public void notificationSet(final FrameContainer<?> window, final Color colour) {
107
+        if (equals(window)) {
109 108
             notificationColour = colour;
110 109
         }
111 110
     }
112 111
 
113 112
     /** {@inheritDoc} */
114 113
     @Override
115
-    public void notificationCleared(final FrameContainer window) {
116
-        if (equals(window.getFrame())) {
114
+    public void notificationCleared(final FrameContainer<?> window) {
115
+        if (equals(window)) {
117 116
             notificationColour = null;
118 117
         }
119 118
     }
120 119
 
121 120
     /** {@inheritDoc} */
122 121
     @Override
123
-    public void iconChanged(final FrameContainer window, final String icon) {
124
-        if (equals(window.getFrame())) {
122
+    public void iconChanged(final FrameContainer<?> window, final String icon) {
123
+        if (equals(window)) {
125 124
             setIcon(IconManager.getIconManager().getIcon(icon));
126 125
         }
127 126
     }
128 127
 
129 128
     /** {@inheritDoc} */
130 129
     @Override
131
-    public void nameChanged(final FrameContainer window, final String name) {
132
-        if (equals(window.getFrame())) {
130
+    public void nameChanged(final FrameContainer<?> window, final String name) {
131
+        if (equals(window)) {
133 132
             setText(name);
134 133
         }
135 134
     }
136 135
 
137 136
     /** {@inheritDoc} */
138 137
     @Override
139
-    public void titleChanged(final FrameContainer window, final String title) {
138
+    public void titleChanged(final FrameContainer<?> window, final String title) {
140 139
         // Do nothing
141 140
     }
142 141
 

+ 32
- 19
src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java 查看文件

@@ -30,6 +30,7 @@ import com.dmdirc.addons.ui_swing.components.TreeScroller;
30 30
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
31 31
 import com.dmdirc.logger.ErrorLevel;
32 32
 import com.dmdirc.logger.Logger;
33
+import com.dmdirc.ui.interfaces.Window;
33 34
 
34 35
 import java.awt.Rectangle;
35 36
 import java.awt.event.ActionEvent;
@@ -110,13 +111,13 @@ public class Tree extends JTree implements MouseMotionListener,
110 111
                             new IllegalArgumentException("Last component == null"));
111 112
                     return;
112 113
                 }
113
-                if (((TreeViewNode) path.getLastPathComponent()).getFrameContainer() == null) {
114
+                if (((TreeViewNode) path.getLastPathComponent()).getWindow() == null) {
114 115
                     Logger.appError(ErrorLevel.HIGH, "Unable to change focus",
115 116
                             new IllegalArgumentException("Frame is null"));
116 117
                     return;
117 118
                 }
118 119
                 super.setPath(path);
119
-                ((TreeViewNode) path.getLastPathComponent()).getFrameContainer().
120
+                ((TreeViewNode) path.getLastPathComponent()).getWindow().
120 121
                         activateFrame();
121 122
             }
122 123
         };
@@ -193,7 +194,7 @@ public class Tree extends JTree implements MouseMotionListener,
193 194
             final TreeViewNode node = getNodeForLocation(e.getX(), e.getY());
194 195
             if (node != null) {
195 196
                 ((TreeViewNode) new TreePath(node.getPath()).
196
-                        getLastPathComponent()).getFrameContainer().
197
+                        getLastPathComponent()).getWindow().
197 198
                         activateFrame();
198 199
             }
199 200
         }
@@ -232,7 +233,7 @@ public class Tree extends JTree implements MouseMotionListener,
232 233
             final TreePath selectedPath = getPathForLocation(e.getX(), e.getY());
233 234
             if (selectedPath != null) {
234 235
                 ((TreeViewNode) selectedPath.getLastPathComponent()).
235
-                        getFrameContainer().activateFrame();
236
+                        getWindow().activateFrame();
236 237
             }
237 238
         }
238 239
         processMouseEvents(e);
@@ -277,26 +278,38 @@ public class Tree extends JTree implements MouseMotionListener,
277 278
         final TreePath localPath = getPathForLocation(e.getX(), e.getY());
278 279
         if (localPath != null) {
279 280
             if (e.isPopupTrigger()) {
280
-                final TextFrame frame = (TextFrame) ((TreeViewNode) localPath.
281
-                        getLastPathComponent()).getFrameContainer().
282
-                        getFrame();
281
+                TextFrame frame = null;
282
+
283
+                for (Window window : ((TreeViewNode) localPath.
284
+                        getLastPathComponent()).getWindow().getWindows()) {
285
+                    if (window instanceof TextFrame) {
286
+                        frame = (TextFrame) window;
287
+                        break;
288
+                    }
289
+                }
290
+
291
+                if (frame == null) {
292
+                    return;
293
+                }
294
+
283 295
                 final JPopupMenu popupMenu = frame.getPopupMenu(null, "");
284 296
                 frame.addCustomPopupItems(popupMenu);
285 297
                 if (popupMenu.getComponentCount() > 0) {
286 298
                     popupMenu.addSeparator();
287 299
                 }
288
-                    final TreeViewNodeMenuItem moveUp =
289
-                            new TreeViewNodeMenuItem("Move Up", "Up",
290
-                            (TreeViewNode) localPath.getLastPathComponent());
291
-                    final TreeViewNodeMenuItem moveDown =
292
-                            new TreeViewNodeMenuItem("Move Down", "Down",
293
-                            (TreeViewNode) localPath.getLastPathComponent());
294
-
295
-                    moveUp.addActionListener(this);
296
-                    moveDown.addActionListener(this);
297
-
298
-                    popupMenu.add(moveUp);
299
-                    popupMenu.add(moveDown);
300
+
301
+                final TreeViewNodeMenuItem moveUp =
302
+                        new TreeViewNodeMenuItem("Move Up", "Up",
303
+                        (TreeViewNode) localPath.getLastPathComponent());
304
+                final TreeViewNodeMenuItem moveDown =
305
+                        new TreeViewNodeMenuItem("Move Down", "Down",
306
+                        (TreeViewNode) localPath.getLastPathComponent());
307
+
308
+                moveUp.addActionListener(this);
309
+                moveDown.addActionListener(this);
310
+
311
+                popupMenu.add(moveUp);
312
+                popupMenu.add(moveDown);
300 313
                 popupMenu.add(new JMenuItem(new CloseFrameContainerAction(frame.
301 314
                         getContainer())));
302 315
                 popupMenu.show(this, e.getX(), e.getY());

+ 12
- 14
src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeFrameManager.java 查看文件

@@ -72,11 +72,11 @@ public final class TreeFrameManager implements FrameManager,
72 72
     /** data model. */
73 73
     private final TreeViewModel model;
74 74
     /** node storage, used for adding and deleting nodes correctly. */
75
-    private final Map<FrameContainer, TreeViewNode> nodes;
75
+    private final Map<FrameContainer<?>, TreeViewNode> nodes;
76 76
 
77 77
     /** creates a new instance of the TreeFrameManager. */
78 78
     public TreeFrameManager() {
79
-        nodes = new HashMap<FrameContainer, TreeViewNode>();
79
+        nodes = new HashMap<FrameContainer<?>, TreeViewNode>();
80 80
         model = new TreeViewModel(new TreeViewNode(null, null));
81 81
         tree = new Tree(this, model);
82 82
 
@@ -126,27 +126,27 @@ public final class TreeFrameManager implements FrameManager,
126 126
 
127 127
     /** {@inheritDoc} */
128 128
     @Override
129
-    public void addWindow(final FrameContainer window, final boolean focus) {
129
+    public void addWindow(final FrameContainer<?> window, final boolean focus) {
130 130
         addWindow(model.getRootNode(), window);
131 131
     }
132 132
 
133 133
     /** {@inheritDoc} */
134 134
     @Override
135
-    public void addWindow(final FrameContainer parent,
136
-            final FrameContainer window, final boolean focus) {
135
+    public void addWindow(final FrameContainer<?> parent,
136
+            final FrameContainer<?> window, final boolean focus) {
137 137
         addWindow(nodes.get(parent), window);
138 138
     }
139 139
 
140 140
     /** {@inheritDoc} */
141 141
     @Override
142
-    public void delWindow(final FrameContainer parent,
143
-            final FrameContainer window) {
142
+    public void delWindow(final FrameContainer<?> parent,
143
+            final FrameContainer<?> window) {
144 144
         delWindow(window);
145 145
     }
146 146
 
147 147
     /** {@inheritDoc} */
148 148
     @Override
149
-    public void delWindow(final FrameContainer window) {
149
+    public void delWindow(final FrameContainer<?> window) {
150 150
         UIUtilities.invokeAndWait(new Runnable() {
151 151
 
152 152
             /** {@inheritDoc} */
@@ -182,14 +182,14 @@ public final class TreeFrameManager implements FrameManager,
182 182
      * @param window Window to add
183 183
      */
184 184
     public void addWindow(final TreeViewNode parent,
185
-            final FrameContainer window) {
185
+            final FrameContainer<?> window) {
186 186
         UIUtilities.invokeAndWait(new Runnable() {
187 187
 
188 188
             /** {@inheritDoc} */
189 189
             @Override
190 190
             public void run() {
191 191
                 final TreeViewNode node =
192
-                        new TreeViewNode(new NodeLabel(window.getFrame()),
192
+                        new TreeViewNode(new NodeLabel(window),
193 193
                         window);
194 194
                 synchronized (nodes) {
195 195
                     nodes.put(window, node);
@@ -283,11 +283,9 @@ public final class TreeFrameManager implements FrameManager,
283 283
                 ((DefaultTreeModel) tree.getModel()).setRoot(new TreeViewNode(
284 284
                         null, null));
285 285
 
286
-                final FrameContainer[] rootWindows = WindowManager.getRootWindows();
287
-
288
-                for (FrameContainer window : rootWindows) {
286
+                for (FrameContainer<?> window : WindowManager.getRootWindows()) {
289 287
                     addWindow(window, false);
290
-                    final Collection<FrameContainer> childWindows = window.getChildren();
288
+                    final Collection<FrameContainer<?>> childWindows = window.getChildren();
291 289
                     for (FrameContainer childWindow : childWindows) {
292 290
                         addWindow(window, childWindow, false);
293 291
                     }

+ 5
- 5
src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewModel.java 查看文件

@@ -101,7 +101,7 @@ public class TreeViewModel extends DefaultTreeModel {
101 101
      * @return index where new node is to be inserted.
102 102
      */
103 103
     private int getIndex(final TreeViewNode newChild, final TreeViewNode parent) {
104
-        if (newChild.getFrameContainer() instanceof GlobalWindow) {
104
+        if (newChild.getWindow() instanceof GlobalWindow) {
105 105
             return 0;
106 106
         }
107 107
 
@@ -139,8 +139,8 @@ public class TreeViewModel extends DefaultTreeModel {
139 139
      */
140 140
     private boolean sortBefore(final TreeViewNode newChild,
141 141
             final TreeViewNode child) {
142
-        return comparator.compare(newChild.getFrameContainer(), child.
143
-                getFrameContainer()) <= -1;
142
+        return comparator.compare(newChild.getWindow(), child.
143
+                getWindow()) <= -1;
144 144
     }
145 145
 
146 146
     /**
@@ -154,8 +154,8 @@ public class TreeViewModel extends DefaultTreeModel {
154 154
      */
155 155
     private boolean sortAfter(final TreeViewNode newChild,
156 156
             final TreeViewNode child) {
157
-        return comparator.compare(newChild.getFrameContainer(), child.
158
-                getFrameContainer()) >= 1;
157
+        return comparator.compare(newChild.getWindow(), child.
158
+                getWindow()) >= 1;
159 159
     }
160 160
 
161 161
     /**

+ 6
- 5
src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeViewNode.java 查看文件

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.addons.ui_swing.framemanager.tree;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
+import com.dmdirc.ui.interfaces.Window;
26 27
 import javax.swing.tree.DefaultMutableTreeNode;
27 28
 
28 29
 /**
@@ -39,21 +40,21 @@ public class TreeViewNode extends DefaultMutableTreeNode {
39 40
     /** Node's label. */
40 41
     private NodeLabel label;
41 42
     /** Node's frame container. */
42
-    private FrameContainer frameContainer;
43
+    private FrameContainer<?> window;
43 44
     
44
-    public TreeViewNode(final NodeLabel label, final FrameContainer frameContainer) {
45
+    public TreeViewNode(final NodeLabel label, final FrameContainer<?> window) {
45 46
         super();
46 47
         
47 48
         this.label = label;
48
-        this.frameContainer = frameContainer;
49
+        this.window = window;
49 50
     }
50 51
     
51 52
     public NodeLabel getLabel() {
52 53
         return label;
53 54
     }
54 55
     
55
-    public FrameContainer getFrameContainer() {
56
-        return frameContainer;
56
+    public FrameContainer<?> getWindow() {
57
+        return window;
57 58
     }
58 59
 
59 60
 }

+ 2
- 2
src/com/dmdirc/addons/ui_web/WebInterfaceUI.java 查看文件

@@ -157,13 +157,13 @@ public class WebInterfaceUI implements UIController {
157 157
 
158 158
     /** {@inheritDoc} */
159 159
     @Override
160
-    public Window getWindow(final FrameContainer owner) {
160
+    public Window getWindow(final FrameContainer<?> owner) {
161 161
         return new WebWindow(owner);
162 162
     }
163 163
 
164 164
     /** {@inheritDoc} */
165 165
     @Override
166
-    public InputWindow getInputWindow(final WritableFrameContainer owner) {
166
+    public InputWindow getInputWindow(final WritableFrameContainer<?> owner) {
167 167
         return new WebInputWindow(owner, owner.getCommandParser());
168 168
     }
169 169
 

+ 5
- 5
src/com/dmdirc/addons/ui_web/uicomponents/WebFrameManager.java 查看文件

@@ -58,22 +58,22 @@ public class WebFrameManager implements FrameManager {
58 58
 
59 59
     /** {@inheritDoc} */
60 60
     @Override
61
-    public void addWindow(final FrameContainer window, final boolean focus) {
61
+    public void addWindow(final FrameContainer<?> window, final boolean focus) {
62 62
         DynamicRequestHandler.addEvent(new Event("newwindow", window.getFrame()));
63 63
         WebInterfaceUI.active = (WebWindow) window.getFrame();
64 64
     }
65 65
 
66 66
     /** {@inheritDoc} */
67 67
     @Override
68
-    public void delWindow(final FrameContainer window) {
68
+    public void delWindow(final FrameContainer<?> window) {
69 69
         //TODO FIXME
70 70
         throw new UnsupportedOperationException("Not supported yet.");
71 71
     }
72 72
 
73 73
     /** {@inheritDoc} */
74 74
     @Override
75
-    public void addWindow(final FrameContainer parent, 
76
-            final FrameContainer window, final boolean focus) {
75
+    public void addWindow(final FrameContainer<?> parent,
76
+            final FrameContainer<?> window, final boolean focus) {
77 77
         DynamicRequestHandler.addEvent(new Event("newchildwindow", new Object[]{
78 78
             parent.getFrame(), window.getFrame()
79 79
         }));
@@ -82,7 +82,7 @@ public class WebFrameManager implements FrameManager {
82 82
 
83 83
     /** {@inheritDoc} */
84 84
     @Override
85
-    public void delWindow(final FrameContainer parent, final FrameContainer window) {
85
+    public void delWindow(final FrameContainer<?> parent, final FrameContainer<?> window) {
86 86
         //TODO FIXME
87 87
         throw new UnsupportedOperationException("Not supported yet.");
88 88
     }

+ 4
- 3
src/com/dmdirc/addons/ui_web/uicomponents/WebInputWindow.java 查看文件

@@ -36,7 +36,7 @@ import java.util.Map;
36 36
  */
37 37
 public class WebInputWindow extends WebWindow implements InputWindow {
38 38
     
39
-    private final WritableFrameContainer parent;
39
+    private final WritableFrameContainer<?> parent;
40 40
     
41 41
     private final CommandParser commandparser;
42 42
     
@@ -45,7 +45,7 @@ public class WebInputWindow extends WebWindow implements InputWindow {
45 45
     private final Map<String, WebInputHandler> inputHandlers
46 46
             = new HashMap<String, WebInputHandler>();
47 47
 
48
-    public WebInputWindow(WritableFrameContainer parent, CommandParser parser) {
48
+    public WebInputWindow(WritableFrameContainer<?> parent, CommandParser parser) {
49 49
         super(parent);
50 50
         this.parent = parent;
51 51
         this.commandparser = parser;
@@ -98,13 +98,14 @@ public class WebInputWindow extends WebWindow implements InputWindow {
98 98
 
99 99
     /** {@inheritDoc} */
100 100
     @Override
101
+    @Deprecated
101 102
     public void setAwayIndicator(boolean isAway) {
102 103
         // Do nothing
103 104
     }
104 105
 
105 106
     /** {@inheritDoc} */
106 107
     @Override
107
-    public WritableFrameContainer getContainer() {
108
+    public WritableFrameContainer<?> getContainer() {
108 109
         return parent;
109 110
     }
110 111
 

+ 13
- 3
src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java 查看文件

@@ -33,6 +33,7 @@ import com.dmdirc.util.StringTranscoder;
33 33
 import com.dmdirc.addons.ui_web.DynamicRequestHandler;
34 34
 import com.dmdirc.addons.ui_web.Event;
35 35
 import com.dmdirc.addons.ui_web.Message;
36
+import com.dmdirc.ui.interfaces.UIController;
36 37
 
37 38
 import java.awt.Color;
38 39
 import java.awt.font.TextAttribute;
@@ -60,13 +61,13 @@ public class WebWindow implements Window {
60 61
     
61 62
     protected int myID = ++counter;
62 63
     
63
-    private final FrameContainer parent;
64
+    private final FrameContainer<?> parent;
64 65
     
65 66
     private List<String> messages = new ArrayList<String>();
66 67
     
67 68
     private String title;
68 69
     
69
-    public WebWindow(final FrameContainer parent) {
70
+    public WebWindow(final FrameContainer<?> parent) {
70 71
         super();
71 72
         
72 73
         this.parent = parent;
@@ -126,13 +127,14 @@ public class WebWindow implements Window {
126 127
 
127 128
     /** {@inheritDoc} */
128 129
     @Override
130
+    @Deprecated
129 131
     public ConfigManager getConfigManager() {
130 132
         return parent.getConfigManager();
131 133
     }
132 134
 
133 135
     /** {@inheritDoc} */
134 136
     @Override
135
-    public FrameContainer getContainer() {
137
+    public FrameContainer<?> getContainer() {
136 138
         return parent;
137 139
     }
138 140
 
@@ -150,6 +152,7 @@ public class WebWindow implements Window {
150 152
 
151 153
     /** {@inheritDoc} */
152 154
     @Override
155
+    @Deprecated
153 156
     public String getTitle() {
154 157
         return title;
155 158
     }
@@ -333,4 +336,11 @@ public class WebWindow implements Window {
333 336
         throw new UnsupportedOperationException("Not supported yet.");
334 337
     }
335 338
 
339
+    /** {@inheritDoc} */
340
+    @Override
341
+    public UIController getController() {
342
+        //TODO FIXME
343
+        return null;
344
+    }
345
+
336 346
 }

+ 1
- 1
src/com/dmdirc/addons/urlcatcher/UrlCatcherPlugin.java 查看文件

@@ -85,7 +85,7 @@ public class UrlCatcherPlugin extends Plugin implements ActionListener,
85 85
             return;
86 86
         }
87 87
 
88
-        final String message = ((FrameContainer) arguments[0]).getStyliser()
88
+        final String message = ((FrameContainer<?>) arguments[0]).getStyliser()
89 89
                 .doLinks((String) arguments[1]);
90 90
         
91 91
         if (message.indexOf(Styliser.CODE_HYPERLINK) > -1) {

+ 1
- 1
src/com/dmdirc/addons/urlcatcher/UrlListCommand.java 查看文件

@@ -44,7 +44,7 @@ public class UrlListCommand extends GlobalCommand implements IntelligentCommand
44 44
 
45 45
     /** {@inheritDoc} */
46 46
     @Override
47
-    public void execute(final FrameContainer origin, final boolean isSilent,
47
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
48 48
             final CommandArguments args) {
49 49
         final String[] headers = {"URL", "Count"};
50 50
         final Map<String, Integer> map = plugin.getURLS();

+ 2
- 2
src/com/dmdirc/addons/userlevel/AccessLevelComponent.java 查看文件

@@ -41,13 +41,13 @@ public class AccessLevelComponent implements ActionComponent {
41 41
 
42 42
     /** {@inheritDoc} */
43 43
     @Override    
44
-    public Class appliesTo() {
44
+    public Class<?> appliesTo() {
45 45
         return ClientInfo.class;
46 46
     }
47 47
 
48 48
     /** {@inheritDoc} */
49 49
     @Override    
50
-    public Class getType() {
50
+    public Class<?> getType() {
51 51
         return Integer.class;
52 52
     }
53 53
 

+ 2
- 2
src/com/dmdirc/addons/userlevel/ChannelAccessLevelComponent.java 查看文件

@@ -48,13 +48,13 @@ public class ChannelAccessLevelComponent implements ActionComponent {
48 48
 
49 49
     /** {@inheritDoc} */
50 50
     @Override    
51
-    public Class appliesTo() {
51
+    public Class<?> appliesTo() {
52 52
         return ChannelClientInfo.class;
53 53
     }
54 54
 
55 55
     /** {@inheritDoc} */
56 56
     @Override    
57
-    public Class getType() {
57
+    public Class<?> getType() {
58 58
         return Integer.class;
59 59
     }
60 60
 

+ 3
- 3
src/com/dmdirc/addons/windowstatus/WindowStatusPlugin.java 查看文件

@@ -108,7 +108,7 @@ public final class WindowStatusPlugin extends Plugin implements ActionListener,
108 108
     @Override
109 109
     public void processEvent(final ActionType type, final StringBuffer format, final Object... arguments) {
110 110
         if (type.equals(CoreActionType.CLIENT_FRAME_CHANGED)) {
111
-            updateStatus((FrameContainer) arguments[0]);
111
+            updateStatus((FrameContainer<?>) arguments[0]);
112 112
         }
113 113
     }
114 114
 
@@ -123,7 +123,7 @@ public final class WindowStatusPlugin extends Plugin implements ActionListener,
123 123
      * Update the window status using the current active window.
124 124
      */
125 125
     public void updateStatus() {
126
-        final FrameContainer active = WindowManager.getActiveWindow();
126
+        final FrameContainer<?> active = WindowManager.getActiveWindow();
127 127
 
128 128
         if (active != null) {
129 129
             updateStatus(active);
@@ -135,7 +135,7 @@ public final class WindowStatusPlugin extends Plugin implements ActionListener,
135 135
      *
136 136
      * @param current Window to use when adding status.
137 137
      */
138
-    public void updateStatus(final FrameContainer current) {
138
+    public void updateStatus(final FrameContainer<?> current) {
139 139
         if (current == null) {
140 140
             return;
141 141
         }

+ 1
- 1
test/com/dmdirc/addons/redirect/RedirectCommandTest.java 查看文件

@@ -45,7 +45,7 @@ public class RedirectCommandTest {
45 45
     @Test
46 46
     public void testExecute() {
47 47
         final RedirectCommand command = new RedirectCommand();
48
-        final MessageTarget target = mock(MessageTarget.class);
48
+        final MessageTarget<?> target = mock(MessageTarget.class);
49 49
         final InputWindow window = mock(InputWindow.class);
50 50
         when(target.getFrame()).thenReturn(window);
51 51
         final CommandParser parser = new ServerCommandParser();

+ 6
- 6
test/com/dmdirc/addons/ui_swing/components/frames/InputTextFrameTest.java 查看文件

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.addons.ui_swing.components.frames;
24 24
 
25 25
 import com.dmdirc.Main;
26
-import com.dmdirc.commandparser.parsers.GlobalCommandParser;
27 26
 import com.dmdirc.config.ConfigManager;
28 27
 import com.dmdirc.config.IdentityManager;
29 28
 import com.dmdirc.config.InvalidIdentityFileException;
@@ -35,6 +34,7 @@ import com.dmdirc.addons.ui_swing.SwingController;
35 34
 import com.dmdirc.addons.ui_swing.UIUtilities;
36 35
 import com.dmdirc.addons.ui_swing.components.TextAreaInputField;
37 36
 import com.dmdirc.plugins.PluginManager;
37
+import com.dmdirc.ui.interfaces.InputWindow;
38 38
 
39 39
 import java.awt.event.KeyEvent;
40 40
 
@@ -54,7 +54,7 @@ public class InputTextFrameTest {
54 54
     static FrameFixture mainframe;
55 55
     static JInternalFrameFixture window;
56 56
     static TestConfigManagerMap cmmap;
57
-    static TestWritableFrameContainer owner;
57
+    static TestWritableFrameContainer<InputWindow> owner;
58 58
     static SwingController controller;
59 59
 
60 60
     @BeforeClass
@@ -81,14 +81,14 @@ public class InputTextFrameTest {
81 81
         cmmap = new TestConfigManagerMap();
82 82
         cmmap.settings.put("ui.pasteProtectionLimit", "1");
83 83
 
84
-        owner = new TestWritableFrameContainer(512, cmmap);
84
+        owner = new TestWritableFrameContainer<InputWindow>(512, cmmap, InputWindow.class);
85 85
         setupWindow(cmmap);
86 86
     }
87 87
 
88 88
     @After
89 89
     public void tearDown() {
90 90
         window.close();
91
-        owner.window.close();
91
+        owner.getFrame().close();
92 92
         WindowManager.removeWindow(owner);
93 93
     }
94 94
 
@@ -149,10 +149,10 @@ public class InputTextFrameTest {
149 149
     }
150 150
 
151 151
     protected void setupWindow(final ConfigManager configManager) {
152
-        final CustomInputFrame titf = new CustomInputFrame(owner, controller);
152
+        final CustomInputFrame titf = new CustomInputFrame(controller, owner);
153 153
 
154 154
         owner.setTitle("testing123");
155
-        owner.window = titf;
155
+        owner.addWindow(titf);
156 156
 
157 157
         WindowManager.addWindow(owner);
158 158
 

+ 1
- 1
test/com/dmdirc/addons/urlcatcher/UrlCatcherPluginTest.java 查看文件

@@ -35,7 +35,7 @@ import static org.mockito.Mockito.*;
35 35
 
36 36
 public class UrlCatcherPluginTest {
37 37
     
38
-    private static FrameContainer container;
38
+    private static FrameContainer<?> container;
39 39
 
40 40
     @BeforeClass
41 41
     public static void setupClass() {

正在加载...
取消
保存