|
@@ -62,6 +62,7 @@ import com.dmdirc.ui.interfaces.InputWindow;
|
62
|
62
|
import com.dmdirc.ui.MainFrame;
|
63
|
63
|
import com.dmdirc.ui.ServerFrame;
|
64
|
64
|
import com.dmdirc.ui.input.TabCompleter;
|
|
65
|
+import com.dmdirc.ui.interfaces.ServerWindow;
|
65
|
66
|
import com.dmdirc.ui.interfaces.Window;
|
66
|
67
|
import com.dmdirc.ui.messages.Formatter;
|
67
|
68
|
|
|
@@ -109,8 +110,8 @@ public final class Server extends WritableFrameContainer implements
|
109
|
110
|
private IRCParser parser;
|
110
|
111
|
/** The raw frame used for this server instance. */
|
111
|
112
|
private Raw raw;
|
112
|
|
- /** The ServerFrame corresponding to this server. */
|
113
|
|
- private ServerFrame frame;
|
|
113
|
+ /** The ServerWindow corresponding to this server. */
|
|
114
|
+ private ServerWindow window;
|
114
|
115
|
|
115
|
116
|
/** The name of the server we're connecting to. */
|
116
|
117
|
private String server;
|
|
@@ -163,13 +164,16 @@ public final class Server extends WritableFrameContainer implements
|
163
|
164
|
|
164
|
165
|
configManager = new ConfigManager("", "", server);
|
165
|
166
|
|
166
|
|
- frame = new ServerFrame(this);
|
167
|
|
- frame.setTitle(server + ":" + port);
|
168
|
|
- frame.getInputHandler().setTabCompleter(tabCompleter);
|
169
|
|
- frame.addInternalFrameListener(this);
|
170
|
|
- MainFrame.getMainFrame().addChild(frame);
|
|
167
|
+ window = new ServerFrame(this);
|
171
|
168
|
|
172
|
|
- frame.open();
|
|
169
|
+ window.setTitle(server + ":" + port);
|
|
170
|
+
|
|
171
|
+ window.getInputHandler().setTabCompleter(tabCompleter);
|
|
172
|
+
|
|
173
|
+ ((ServerFrame) window).addInternalFrameListener(this);
|
|
174
|
+ MainFrame.getMainFrame().addChild(window);
|
|
175
|
+
|
|
176
|
+ window.open();
|
173
|
177
|
|
174
|
178
|
tabCompleter.addEntries(CommandManager.getServerCommandNames());
|
175
|
179
|
tabCompleter.addEntries(CommandManager.getGlobalCommandNames());
|
|
@@ -223,9 +227,10 @@ public final class Server extends WritableFrameContainer implements
|
223
|
227
|
imageURL = cldr.getResource("com/dmdirc/res/server.png");
|
224
|
228
|
}
|
225
|
229
|
imageIcon = new ImageIcon(imageURL);
|
226
|
|
- frame.setFrameIcon(imageIcon);
|
227
|
230
|
|
228
|
|
- frame.addLine("serverConnecting", server, port);
|
|
231
|
+ window.setFrameIcon(imageIcon);
|
|
232
|
+
|
|
233
|
+ window.addLine("serverConnecting", server, port);
|
229
|
234
|
|
230
|
235
|
final MyInfo myInfo = new MyInfo();
|
231
|
236
|
myInfo.setNickname(profile.getOption("profile", "nickname"));
|
|
@@ -262,7 +267,7 @@ public final class Server extends WritableFrameContainer implements
|
262
|
267
|
|
263
|
268
|
away = false;
|
264
|
269
|
awayMessage = null;
|
265
|
|
- frame.setAway(false);
|
|
270
|
+ ((ServerFrame) window).setAway(false);
|
266
|
271
|
|
267
|
272
|
try {
|
268
|
273
|
new Thread(parser).start();
|
|
@@ -472,7 +477,7 @@ public final class Server extends WritableFrameContainer implements
|
472
|
477
|
|
473
|
478
|
/** {@inheritDoc} */
|
474
|
479
|
public InputWindow getFrame() {
|
475
|
|
- return frame;
|
|
480
|
+ return window;
|
476
|
481
|
}
|
477
|
482
|
|
478
|
483
|
/** {@inheritDoc} */
|
|
@@ -494,9 +499,9 @@ public final class Server extends WritableFrameContainer implements
|
494
|
499
|
parser.getCallbackManager().delAllCallback(this);
|
495
|
500
|
}
|
496
|
501
|
|
497
|
|
- if (frame != null) {
|
|
502
|
+ if (window != null) {
|
498
|
503
|
// Unregister frame callbacks
|
499
|
|
- frame.removeInternalFrameListener(this);
|
|
504
|
+ ((ServerFrame) window).removeInternalFrameListener(this);
|
500
|
505
|
}
|
501
|
506
|
|
502
|
507
|
// Disconnect from the server
|
|
@@ -512,13 +517,12 @@ public final class Server extends WritableFrameContainer implements
|
512
|
517
|
// Unregister ourselves with the server manager
|
513
|
518
|
ServerManager.getServerManager().unregisterServer(this);
|
514
|
519
|
|
515
|
|
- if (frame != null) {
|
|
520
|
+ if (window != null) {
|
516
|
521
|
SwingUtilities.invokeLater(new Runnable() {
|
517
|
522
|
public void run() {
|
518
|
|
- // Close our own window
|
519
|
|
- frame.setVisible(false);
|
520
|
|
- MainFrame.getMainFrame().delChild(frame);
|
521
|
|
- frame = null;
|
|
523
|
+ window.setVisible(false);
|
|
524
|
+ MainFrame.getMainFrame().delChild(window);
|
|
525
|
+ window = null;
|
522
|
526
|
}
|
523
|
527
|
});
|
524
|
528
|
}
|
|
@@ -663,7 +667,7 @@ public final class Server extends WritableFrameContainer implements
|
663
|
667
|
@Override
|
664
|
668
|
public boolean ownsFrame(final Window target) {
|
665
|
669
|
// Check if it's our server frame
|
666
|
|
- if (frame != null && frame.equals(target)) { return true; }
|
|
670
|
+ if (window != null && window.equals(target)) { return true; }
|
667
|
671
|
// Check if it's the raw frame
|
668
|
672
|
if (raw != null && raw.ownsFrame(target)) { return true; }
|
669
|
673
|
// Check if it's a channel frame
|
|
@@ -717,7 +721,7 @@ public final class Server extends WritableFrameContainer implements
|
717
|
721
|
query.getFrame().addLine(messageType, args);
|
718
|
722
|
}
|
719
|
723
|
|
720
|
|
- frame.addLine(messageType, args);
|
|
724
|
+ window.addLine(messageType, args);
|
721
|
725
|
}
|
722
|
726
|
|
723
|
727
|
/**
|
|
@@ -859,17 +863,17 @@ public final class Server extends WritableFrameContainer implements
|
859
|
863
|
|
860
|
864
|
/** {@inheritDoc} */
|
861
|
865
|
public void onMOTDStart(final IRCParser tParser, final String sData) {
|
862
|
|
- frame.addLine("motdStart", sData);
|
|
866
|
+ window.addLine("motdStart", sData);
|
863
|
867
|
}
|
864
|
868
|
|
865
|
869
|
/** {@inheritDoc} */
|
866
|
870
|
public void onMOTDLine(final IRCParser tParser, final String sData) {
|
867
|
|
- frame.addLine("motdLine", sData);
|
|
871
|
+ window.addLine("motdLine", sData);
|
868
|
872
|
}
|
869
|
873
|
|
870
|
874
|
/** {@inheritDoc} */
|
871
|
875
|
public void onMOTDEnd(final IRCParser tParser, final boolean noMOTD) {
|
872
|
|
- frame.addLine("motdEnd", "End of server's MOTD.");
|
|
876
|
+ window.addLine("motdEnd", "End of server's MOTD.");
|
873
|
877
|
}
|
874
|
878
|
|
875
|
879
|
/** {@inheritDoc} */
|
|
@@ -918,7 +922,7 @@ public final class Server extends WritableFrameContainer implements
|
918
|
922
|
ActionManager.processEvent(CoreActionType.SERVER_USERMODES, format,
|
919
|
923
|
this, setter, sModes);
|
920
|
924
|
|
921
|
|
- frame.addLine(format, setterParts[0], setterParts[1], setterParts[2],
|
|
925
|
+ window.addLine(format, setterParts[0], setterParts[1], setterParts[2],
|
922
|
926
|
sModes);
|
923
|
927
|
}
|
924
|
928
|
|
|
@@ -937,7 +941,7 @@ public final class Server extends WritableFrameContainer implements
|
937
|
941
|
ActionManager.processEvent(CoreActionType.SERVER_BACK, null, this);
|
938
|
942
|
}
|
939
|
943
|
|
940
|
|
- frame.setAway(away);
|
|
944
|
+ ((ServerFrame) window).setAway(away);
|
941
|
945
|
}
|
942
|
946
|
|
943
|
947
|
/** {@inheritDoc} */
|