summaryrefslogtreecommitdiff
path: root/NET/worlds/console/DuplexPart.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/console/DuplexPart.java')
-rw-r--r--NET/worlds/console/DuplexPart.java1083
1 files changed, 1083 insertions, 0 deletions
diff --git a/NET/worlds/console/DuplexPart.java b/NET/worlds/console/DuplexPart.java
new file mode 100644
index 0000000..41a04ba
--- /dev/null
+++ b/NET/worlds/console/DuplexPart.java
@@ -0,0 +1,1083 @@
+/* */ package NET.worlds.console;
+/* */
+/* */ import NET.worlds.core.IniFile;
+/* */ import NET.worlds.scape.FrameEvent;
+/* */ import java.awt.Color;
+/* */ import java.awt.Container;
+/* */ import java.awt.Event;
+/* */ import java.awt.TextField;
+/* */ import java.util.Observer;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public abstract class DuplexPart
+/* */ implements FramePart
+/* */ {
+/* */ private boolean classicTextArea;
+/* */
+/* */ public DuplexPart()
+/* */ {
+/* 906 */ this(true);
+/* */ }
+/* */
+/* */ public DuplexPart(boolean isShared) {
+/* 910 */ this(isShared, 3);
+/* */ }
+/* */
+/* */ public DuplexPart(boolean isShared, int height) {
+/* 914 */ this.classicTextArea = (IniFile.gamma().getIniInt("classicChatBox", 1) == 1);
+/* 915 */ if (this.classicTextArea) {
+/* 916 */ this.listen = new ClassicSharedTextArea(height, 30, isShared);
+/* 917 */ this.listen.setBackground(Color.white);
+/* */ } else {
+/* 919 */ this.listen = new NewSharedTextArea(height, 30, isShared);
+/* */
+/* 921 */ this.listen.setBackground(GammaTextArea.getBackgroundColor());
+/* */ }
+/* */
+/* 924 */ this.listen.setForeground(Color.black);
+/* */ }
+/* */
+/* */ public void forceTakeFocus() {
+/* 928 */ ((FocusPreservingTextField)this.line).takeNextFocus();
+/* */ }
+/* */
+/* */ public synchronized void activate(Console c, Container f, Console prev) {
+/* 932 */ if ((this instanceof ChatPart)) {
+/* 933 */ ((FocusPreservingTextField)this.line).isChatLine();
+/* */ }
+/* */
+/* 936 */ if (!this.classicTextArea) {
+/* 937 */ Color bg = GammaTextArea.getBackgroundColor();
+/* 938 */ this.line.setBackground(bg);
+/* 939 */ this.listen.setBackground(bg);
+/* 940 */ this.line.setForeground(Color.black);
+/* 941 */ this.listen.setForeground(Color.black);
+/* 942 */ this.line.repaint();
+/* 943 */ this.listen.repaint();
+/* */ } else {
+/* 945 */ this.listen.setBackground(Color.white);
+/* 946 */ this.listen.setForeground(Color.black);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* 953 */ public TextField line = new FocusPreservingTextField();
+/* */
+/* */
+/* */ public SharedTextArea listen;
+/* */
+/* */
+/* */ public void deactivate() {}
+/* */
+/* */
+/* */ public void println(String msg)
+/* */ {
+/* 964 */ this.listen.println(msg);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public synchronized void trigger()
+/* */ {
+/* 971 */ this.talkVec.addElement(this.line.getText());
+/* 972 */ this.line.setText("");
+/* */ }
+/* */
+/* */ public synchronized void say(String s) {
+/* 976 */ this.talkVec.addElement(s);
+/* */ }
+/* */
+/* */ public void scrollToBottom() {
+/* 980 */ this.listen.scrollToBottom();
+/* */ }
+/* */
+/* */
+/* */
+/* */ @Deprecated
+/* */ public boolean action(Event event, Object what)
+/* */ {
+/* 988 */ if (event.target == this.line) {
+/* 989 */ trigger();
+/* 990 */ return true;
+/* */ }
+/* */
+/* 993 */ return false;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void enableLogging(String fileName, String title, boolean append)
+/* */ {
+/* 1007 */ this.listen.enableLogging(fileName, title, append);
+/* */ }
+/* */
+/* */ public void disableLogging()
+/* */ {
+/* 1012 */ this.listen.disableLogging();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public static void addLogObserver(Observer o)
+/* */ {
+/* 1020 */ NewSharedTextArea.addLogObserver(o);
+/* 1021 */ ClassicSharedTextArea.addLogObserver(o);
+/* */ }
+/* */
+/* */ public static void deleteLogObserver(Observer o)
+/* */ {
+/* 1026 */ NewSharedTextArea.deleteLogObserver(o);
+/* 1027 */ ClassicSharedTextArea.addLogObserver(o);
+/* */ }
+/* */
+/* 1030 */ private Vector<String> talkVec = new Vector();
+/* */
+/* */
+/* */
+/* */ public synchronized boolean handle(FrameEvent f)
+/* */ {
+/* 1036 */ this.listen.poll();
+/* 1037 */ while (this.talkVec.size() > 0) {
+/* 1038 */ String text = null;
+/* 1039 */ synchronized (this) {
+/* 1040 */ text = (String)this.talkVec.firstElement();
+/* 1041 */ this.talkVec.removeElementAt(0);
+/* */ }
+/* 1043 */ if (text != null)
+/* 1044 */ sendText(text);
+/* */ }
+/* 1046 */ return true;
+/* */ }
+/* */
+/* */ public static String toHtml(String s)
+/* */ {
+/* 1051 */ assert (s != null);
+/* 1052 */ String h = "";
+/* 1053 */ for (int i = 0; i < s.length(); i++) {
+/* 1054 */ char c = s.charAt(i);
+/* 1055 */ switch (c) {
+/* */ case '<':
+/* 1057 */ h = h + "&lt;";
+/* 1058 */ break;
+/* */ case '>':
+/* 1060 */ h = h + "&gt;";
+/* 1061 */ break;
+/* */ case '"':
+/* 1063 */ h = h + "&quot;";
+/* 1064 */ break;
+/* */ case '&':
+/* 1066 */ h = h + "&amp;";
+/* 1067 */ break;
+/* */ default:
+/* 1069 */ h = h + c;
+/* */ }
+/* */
+/* */ }
+/* 1073 */ return h;
+/* */ }
+/* */
+/* */ protected abstract void sendText(String paramString);
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\DuplexPart.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file