Browse Source

Plugin support for FrameContainer changes.

Change-Id: I3c0dc4b6cf42b5c6b69a499ac11195271c0aa846
Depends-On: I0dc9f767840ce0989739ea28f08254c78ef0d565
Reviewed-on: http://gerrit.dmdirc.com/3465
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
changes/65/3465/2
Chris Smith 10 years ago
parent
commit
d54425fb09

+ 6
- 1
src/com/dmdirc/addons/dcc/ChatContainer.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.addons.dcc;
24 24
 
25
+import com.dmdirc.FrameContainer;
25 26
 import com.dmdirc.actions.ActionManager;
26 27
 import com.dmdirc.addons.dcc.actions.DCCActions;
27 28
 import com.dmdirc.addons.dcc.io.DCCChat;
@@ -36,6 +37,8 @@ import com.google.common.eventbus.EventBus;
36 37
 
37 38
 import java.util.Arrays;
38 39
 
40
+import javax.annotation.Nullable;
41
+
39 42
 /**
40 43
  * This class links DCC Chat objects to a window.
41 44
  */
@@ -51,6 +54,7 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
51 54
     /**
52 55
      * Creates a new instance of DCCChatWindow with a given DCCChat object.
53 56
      *
57
+     * @param parent              The parent of this frame container, if any.
54 58
      * @param dcc                 The DCCChat object this window wraps around
55 59
      * @param configManager       Config manager
56 60
      * @param commandController   The controller to use in the command parser.
@@ -63,6 +67,7 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
63 67
      * @param eventBus            The bus to despatch events on.
64 68
      */
65 69
     public ChatContainer(
70
+            @Nullable final FrameContainer parent,
66 71
             final DCCChat dcc,
67 72
             final AggregateConfigProvider configManager,
68 73
             final CommandController commandController,
@@ -73,7 +78,7 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
73 78
             final MessageSinkManager messageSinkManager,
74 79
             final URLBuilder urlBuilder,
75 80
             final EventBus eventBus) {
76
-        super(title, "dcc-chat-inactive", configManager,
81
+        super(parent, title, "dcc-chat-inactive", configManager,
77 82
                 new DCCCommandParser(configManager, commandController),
78 83
                 messageSinkManager,
79 84
                 tabCompleterFactory,

+ 12
- 3
src/com/dmdirc/addons/dcc/DCCCommand.java View File

@@ -175,9 +175,18 @@ public class DCCCommand extends Command implements IntelligentCommand {
175 175
             final String target, final boolean isSilent) {
176 176
         final DCCChat chat = new DCCChat();
177 177
         if (myPlugin.listen(chat)) {
178
-            final ChatContainer window = new ChatContainer(chat, origin.getConfigManager(),
179
-                    getController(), "*Chat: " + target, myNickname, target, tabCompleterFactory,
180
-                    messageSinkManager, urlBuilder, eventBus);
178
+            final ChatContainer window = new ChatContainer(
179
+                    myPlugin.getContainer(),
180
+                    chat,
181
+                    origin.getConfigManager(),
182
+                    getController(),
183
+                    "*Chat: " + target,
184
+                    myNickname,
185
+                    target,
186
+                    tabCompleterFactory,
187
+                    messageSinkManager,
188
+                    urlBuilder,
189
+                    eventBus);
181 190
             windowManager.addWindow(myPlugin.getContainer(), window);
182 191
             parser.sendCTCP(target, "DCC", "CHAT chat " + DCC.ipToLong(
183 192
                     myPlugin.getListenIP(parser)) + " " + chat.getPort());

+ 5
- 1
src/com/dmdirc/addons/dcc/DCCFrameContainer.java View File

@@ -34,6 +34,8 @@ import com.google.common.eventbus.EventBus;
34 34
 
35 35
 import java.util.Collection;
36 36
 
37
+import javax.annotation.Nullable;
38
+
37 39
 /**
38 40
  * This class links DCC objects to a window.
39 41
  */
@@ -45,6 +47,7 @@ public abstract class DCCFrameContainer extends FrameContainer {
45 47
     /**
46 48
      * Creates a new instance of DCCFrame.
47 49
      *
50
+     * @param parent              The parent of this frame container, if any.
48 51
      * @param title               The title of this window
49 52
      * @param icon                The icon to use
50 53
      * @param configManager       Config manager
@@ -56,6 +59,7 @@ public abstract class DCCFrameContainer extends FrameContainer {
56 59
      * @param components          The UI components that this frame requires
57 60
      */
58 61
     public DCCFrameContainer(
62
+            @Nullable final FrameContainer parent,
59 63
             final String title,
60 64
             final String icon,
61 65
             final AggregateConfigProvider configManager,
@@ -65,7 +69,7 @@ public abstract class DCCFrameContainer extends FrameContainer {
65 69
             final URLBuilder urlBuilder,
66 70
             final EventBus eventBus,
67 71
             final Collection<String> components) {
68
-        super(icon, title, title, configManager, urlBuilder, parser,
72
+        super(parent, icon, title, title, configManager, urlBuilder, parser,
69 73
                 tabCompleterFactory.getTabCompleter(configManager),
70 74
                 messageSinkManager,
71 75
                 eventBus,

+ 12
- 3
src/com/dmdirc/addons/dcc/DCCManager.java View File

@@ -437,9 +437,18 @@ public class DCCManager implements ActionListener {
437 437
             }
438 438
             final String myNickname = ((Connection) arguments[0]).getParser()
439 439
                     .getLocalClient().getNickname();
440
-            final DCCFrameContainer f = new ChatContainer(chat, config, commandController,
441
-                    "Chat: " + nickname, myNickname, nickname, tabCompleterFactory,
442
-                    messageSinkManager, urlBuilder, eventBus);
440
+            final DCCFrameContainer f = new ChatContainer(
441
+                    getContainer(),
442
+                    chat,
443
+                    config,
444
+                    commandController,
445
+                    "Chat: " + nickname,
446
+                    myNickname,
447
+                    nickname,
448
+                    tabCompleterFactory,
449
+                    messageSinkManager,
450
+                    urlBuilder,
451
+                    eventBus);
443 452
             windowManager.addWindow(getContainer(), f);
444 453
             f.addLine("DCCChatStarting", nickname, chat.getHost(),
445 454
                     chat.getPort());

+ 1
- 1
src/com/dmdirc/addons/dcc/PlaceholderContainer.java View File

@@ -59,7 +59,7 @@ public class PlaceholderContainer extends FrameContainer {
59 59
             final Window parentWindow,
60 60
             final URLBuilder urlBuilder,
61 61
             final EventBus eventBus) {
62
-        super("dcc", "DCCs", "DCCs", config, urlBuilder, eventBus,
62
+        super(null, "dcc", "DCCs", "DCCs", config, urlBuilder, eventBus,
63 63
                 Arrays.asList("com.dmdirc.addons.dcc.ui.PlaceholderPanel"));
64 64
         this.plugin = plugin;
65 65
         this.parentWindow = parentWindow;

+ 1
- 1
src/com/dmdirc/addons/dcc/TransferContainer.java View File

@@ -89,7 +89,7 @@ public class TransferContainer extends FrameContainer implements
89 89
             final AggregateConfigProvider config, final String title,
90 90
             final String targetNick, final Connection connection,
91 91
             final URLBuilder urlBuilder, final EventBus eventBus) {
92
-        super(dcc.getType() == DCCTransfer.TransferType.SEND
92
+        super(plugin.getContainer(), dcc.getType() == DCCTransfer.TransferType.SEND
93 93
                 ? "dcc-send-inactive" : "dcc-receive-inactive",
94 94
                 title, title, config, urlBuilder, eventBus,
95 95
                 Arrays.asList("com.dmdirc.addons.dcc.ui.TransferPanel"));

+ 1
- 1
src/com/dmdirc/addons/logging/HistoryWindow.java View File

@@ -54,7 +54,7 @@ public class HistoryWindow extends FrameContainer {
54 54
             final URLBuilder urlBuilder,
55 55
             final EventBus eventBus,
56 56
             final int numLines) {
57
-        super("raw", title, title, parent.getConfigManager(), urlBuilder, eventBus,
57
+        super(parent, "raw", title, title, parent.getConfigManager(), urlBuilder, eventBus,
58 58
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier()));
59 59
 
60 60
         final int frameBufferSize = parent.getConfigManager().getOptionInt(

+ 2
- 1
src/com/dmdirc/addons/parserdebug/DebugWindow.java View File

@@ -62,7 +62,8 @@ public class DebugWindow extends FrameContainer {
62 62
             final Connection connection,
63 63
             final URLBuilder urlBuilder,
64 64
             final EventBus eventBus) {
65
-        super("raw", "Parser Debug", title, connection.getWindowModel().getConfigManager(),
65
+        super(connection.getWindowModel(), "raw", "Parser Debug", title,
66
+                connection.getWindowModel().getConfigManager(),
66 67
                 urlBuilder, eventBus, Arrays.asList(WindowComponent.TEXTAREA.getIdentifier()));
67 68
         this.listener = listener;
68 69
         this.parser = parser;

+ 1
- 1
src/com/dmdirc/addons/redirect/FakeWriteableFrameContainer.java View File

@@ -54,7 +54,7 @@ public class FakeWriteableFrameContainer extends FrameContainer {
54 54
             final MessageSinkManager messageSinkManager,
55 55
             final EventBus eventBus,
56 56
             final URLBuilder urlBuilder) {
57
-        super(target.getIcon(), target.getName(), target.getTitle(),
57
+        super(target, target.getIcon(), target.getName(), target.getTitle(),
58 58
                 target.getConfigManager(), urlBuilder, target.getCommandParser(),
59 59
                 target.getTabCompleter(), messageSinkManager, eventBus,
60 60
                 Collections.<String>emptyList());

Loading…
Cancel
Save