From 8a996c69ad5ce5e47bce725f3b1ebe2378ef8d7b Mon Sep 17 00:00:00 2001 From: nobody Date: Sat, 10 Jan 1998 20:14:34 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'main_to_poa_merge_8'. --- java/apps/NexusII/README | 58 --- java/apps/NexusII/classes/ClientHandler.class | Bin 7017 -> 0 bytes java/apps/NexusII/classes/FrameHandler.class | Bin 851 -> 0 bytes java/apps/NexusII/classes/ImageCanvas.class | Bin 2771 -> 0 bytes java/apps/NexusII/classes/NexusClientApplet.class | Bin 9297 -> 0 bytes java/apps/NexusII/classes/NexusIIserver.class | Bin 1566 -> 0 bytes java/apps/NexusII/classes/Room.class | Bin 2138 -> 0 bytes java/apps/NexusII/classes/RoomFactory.class | Bin 1686 -> 0 bytes java/apps/NexusII/classes/RoomFrame.class | Bin 3878 -> 0 bytes java/apps/NexusII/classes/RoomThread.class | Bin 1076 -> 0 bytes java/apps/NexusII/classes/awtCommand/CApplet.class | Bin 2239 -> 0 bytes java/apps/NexusII/classes/awtCommand/CApplet.java | 199 --------- java/apps/NexusII/classes/awtCommand/CButton.class | Bin 698 -> 0 bytes java/apps/NexusII/classes/awtCommand/CButton.java | 41 -- java/apps/NexusII/classes/awtCommand/CCanvas.class | Bin 4128 -> 0 bytes java/apps/NexusII/classes/awtCommand/CCanvas.java | 381 ---------------- java/apps/NexusII/classes/awtCommand/CFrame.class | Bin 5174 -> 0 bytes java/apps/NexusII/classes/awtCommand/CFrame.java | 486 -------------------- java/apps/NexusII/classes/awtCommand/CList.class | Bin 1236 -> 0 bytes java/apps/NexusII/classes/awtCommand/CList.java | 96 ---- java/apps/NexusII/classes/awtCommand/CPanel.class | Bin 4125 -> 0 bytes java/apps/NexusII/classes/awtCommand/CPanel.java | 381 ---------------- .../NexusII/classes/awtCommand/CTextArea.class | Bin 1048 -> 0 bytes .../apps/NexusII/classes/awtCommand/CTextArea.java | 93 ---- .../NexusII/classes/awtCommand/CTextField.class | Bin 1225 -> 0 bytes .../NexusII/classes/awtCommand/CTextField.java | 110 ----- java/apps/NexusII/classes/awtCommand/Command.class | Bin 253 -> 0 bytes java/apps/NexusII/classes/awtCommand/Command.java | 25 -- java/apps/NexusII/classes/commandHandler.class | Bin 1310 -> 0 bytes java/apps/NexusII/classes/commandParser.class | Bin 1974 -> 0 bytes java/apps/NexusII/classes/connectionHandler.class | Bin 4632 -> 0 bytes java/apps/NexusII/classes/joinHandler.class | Bin 3229 -> 0 bytes java/apps/NexusII/classes/roomHandler.class | Bin 2371 -> 0 bytes java/apps/NexusII/classes/textHandler.class | Bin 2227 -> 0 bytes java/apps/NexusII/src/Consumer.java | 74 --- java/apps/NexusII/src/MT_Bounded_Queue.java | 226 ---------- java/apps/NexusII/src/MT_Bounded_Queue_Group.java | 79 ---- java/apps/NexusII/src/NexusClientApplet.java | 494 --------------------- java/apps/NexusII/src/NexusIIserver.java | 280 ------------ java/apps/NexusII/src/Producer.java | 87 ---- java/apps/NexusII/src/Room.java | 97 ---- java/apps/NexusII/src/RoomFrame.java | 297 ------------- java/apps/NexusII/src/RoomSpace.java | 110 ----- java/apps/NexusII/src/Timed_Wait.java | 86 ---- java/apps/NexusII/src/Timer.java | 31 -- java/apps/NexusII/src/commandHandler.java | 44 -- java/apps/NexusII/src/commandParser.java | 124 ------ java/apps/NexusII/src/connectionHandler.java | 236 ---------- java/apps/NexusII/src/consts.java | 40 -- java/apps/NexusII/src/dataPacket.java | 124 ------ java/apps/NexusII/src/joinHandler.java | 181 -------- java/apps/NexusII/src/makefile | 15 - java/apps/NexusII/src/nexusDemuxThread.java | 97 ---- java/apps/NexusII/src/roomHandler.java | 125 ------ java/apps/NexusII/src/socketReaderThread.java | 126 ------ java/apps/NexusII/src/socketWriterThread.java | 119 ----- java/apps/NexusII/src/url_to_url.java | 33 -- java/apps/NexusII/start | 27 -- java/apps/NexusII/start.html | 3 - 59 files changed, 5025 deletions(-) delete mode 100644 java/apps/NexusII/README delete mode 100644 java/apps/NexusII/classes/ClientHandler.class delete mode 100644 java/apps/NexusII/classes/FrameHandler.class delete mode 100644 java/apps/NexusII/classes/ImageCanvas.class delete mode 100644 java/apps/NexusII/classes/NexusClientApplet.class delete mode 100644 java/apps/NexusII/classes/NexusIIserver.class delete mode 100644 java/apps/NexusII/classes/Room.class delete mode 100644 java/apps/NexusII/classes/RoomFactory.class delete mode 100644 java/apps/NexusII/classes/RoomFrame.class delete mode 100644 java/apps/NexusII/classes/RoomThread.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CApplet.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CApplet.java delete mode 100644 java/apps/NexusII/classes/awtCommand/CButton.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CButton.java delete mode 100644 java/apps/NexusII/classes/awtCommand/CCanvas.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CCanvas.java delete mode 100644 java/apps/NexusII/classes/awtCommand/CFrame.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CFrame.java delete mode 100644 java/apps/NexusII/classes/awtCommand/CList.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CList.java delete mode 100644 java/apps/NexusII/classes/awtCommand/CPanel.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CPanel.java delete mode 100644 java/apps/NexusII/classes/awtCommand/CTextArea.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CTextArea.java delete mode 100644 java/apps/NexusII/classes/awtCommand/CTextField.class delete mode 100644 java/apps/NexusII/classes/awtCommand/CTextField.java delete mode 100644 java/apps/NexusII/classes/awtCommand/Command.class delete mode 100644 java/apps/NexusII/classes/awtCommand/Command.java delete mode 100644 java/apps/NexusII/classes/commandHandler.class delete mode 100644 java/apps/NexusII/classes/commandParser.class delete mode 100644 java/apps/NexusII/classes/connectionHandler.class delete mode 100644 java/apps/NexusII/classes/joinHandler.class delete mode 100644 java/apps/NexusII/classes/roomHandler.class delete mode 100644 java/apps/NexusII/classes/textHandler.class delete mode 100644 java/apps/NexusII/src/Consumer.java delete mode 100644 java/apps/NexusII/src/MT_Bounded_Queue.java delete mode 100644 java/apps/NexusII/src/MT_Bounded_Queue_Group.java delete mode 100644 java/apps/NexusII/src/NexusClientApplet.java delete mode 100644 java/apps/NexusII/src/NexusIIserver.java delete mode 100644 java/apps/NexusII/src/Producer.java delete mode 100644 java/apps/NexusII/src/Room.java delete mode 100644 java/apps/NexusII/src/RoomFrame.java delete mode 100644 java/apps/NexusII/src/RoomSpace.java delete mode 100644 java/apps/NexusII/src/Timed_Wait.java delete mode 100644 java/apps/NexusII/src/Timer.java delete mode 100644 java/apps/NexusII/src/commandHandler.java delete mode 100644 java/apps/NexusII/src/commandParser.java delete mode 100644 java/apps/NexusII/src/connectionHandler.java delete mode 100644 java/apps/NexusII/src/consts.java delete mode 100644 java/apps/NexusII/src/dataPacket.java delete mode 100644 java/apps/NexusII/src/joinHandler.java delete mode 100644 java/apps/NexusII/src/makefile delete mode 100644 java/apps/NexusII/src/nexusDemuxThread.java delete mode 100644 java/apps/NexusII/src/roomHandler.java delete mode 100644 java/apps/NexusII/src/socketReaderThread.java delete mode 100644 java/apps/NexusII/src/socketWriterThread.java delete mode 100644 java/apps/NexusII/src/url_to_url.java delete mode 100755 java/apps/NexusII/start delete mode 100644 java/apps/NexusII/start.html (limited to 'java/apps/NexusII') diff --git a/java/apps/NexusII/README b/java/apps/NexusII/README deleted file mode 100644 index 60a630cef5a..00000000000 --- a/java/apps/NexusII/README +++ /dev/null @@ -1,58 +0,0 @@ -Nexus II - A chat application in Java with image support --------------------------------------------------------- - - Rajeev Bector (rajeev@cs.wustl.edu) - Aravind Gopalan (aravind@cs.wustl.edu) - Sumedh Mungee (sumedh@cs.wustl.edu) - -This is the README file. This distribution contains the NexusII -server, which is a java application that can be started by a command -similar to the one contained in the sample "start" shell-script. - -It also contains a "start.html" file, which serves as an example on how -a client applet can be included within a .html file. - -A sample use of this, alongwith a simple users manual, can be found at -http://cumbia.cs.wustl.edu/NexusII/ - -Compiling (optional, all the class files are already present) -------------------------------------------------------------- - -All the source .java files, alongwith the makefile should be placed in -the same directory, and can then be compiled using make. - -The client/server use the following packages: - - awtCommand: This package provides a GUI toolkit for the applet - ACE: This is used both by the client/server for - networking. ACE documentation can be found at: - http://www.cs.wustl.edu/~schmidt/ACE.html - -Running -------- - -See the "start" and "start.html" files for examples on how to run the -server and client applet, respectively. The "mywebaddress" variable is -the "temporary" URL of the server, and the "mywebdir" variable is the -temporary directory in which images are cached by the server. Make -sure that both these exist and are world-readable. The "mywebdir" -should be writable to by the server. The "mywebdir" and "mywebaddress" -variables should thus point to the same location, of which mywebdir -contains the path, and mywebaddress contains the URL. - -See "start" for an example on how to do this. - -If you only want to use an existing running server, all you need to -know is the server host-name and port number, and you can directly run -the start.html file via appletviewer. - -Notes ------ - -1. You can compile the client and server using the same makefile. -2. The client applet MUST reside on the same host as the server is running on. -4. run the server using start script. Change the paramters in the start script, - suitable to your configurations. The start script contains further - information on this. - - diff --git a/java/apps/NexusII/classes/ClientHandler.class b/java/apps/NexusII/classes/ClientHandler.class deleted file mode 100644 index c6bf722c54f..00000000000 Binary files a/java/apps/NexusII/classes/ClientHandler.class and /dev/null differ diff --git a/java/apps/NexusII/classes/FrameHandler.class b/java/apps/NexusII/classes/FrameHandler.class deleted file mode 100644 index 72d0c67ce70..00000000000 Binary files a/java/apps/NexusII/classes/FrameHandler.class and /dev/null differ diff --git a/java/apps/NexusII/classes/ImageCanvas.class b/java/apps/NexusII/classes/ImageCanvas.class deleted file mode 100644 index eefcfe0f323..00000000000 Binary files a/java/apps/NexusII/classes/ImageCanvas.class and /dev/null differ diff --git a/java/apps/NexusII/classes/NexusClientApplet.class b/java/apps/NexusII/classes/NexusClientApplet.class deleted file mode 100644 index 8157ac32759..00000000000 Binary files a/java/apps/NexusII/classes/NexusClientApplet.class and /dev/null differ diff --git a/java/apps/NexusII/classes/NexusIIserver.class b/java/apps/NexusII/classes/NexusIIserver.class deleted file mode 100644 index f8e566ce282..00000000000 Binary files a/java/apps/NexusII/classes/NexusIIserver.class and /dev/null differ diff --git a/java/apps/NexusII/classes/Room.class b/java/apps/NexusII/classes/Room.class deleted file mode 100644 index a9d0d4f97bb..00000000000 Binary files a/java/apps/NexusII/classes/Room.class and /dev/null differ diff --git a/java/apps/NexusII/classes/RoomFactory.class b/java/apps/NexusII/classes/RoomFactory.class deleted file mode 100644 index c1f92d83728..00000000000 Binary files a/java/apps/NexusII/classes/RoomFactory.class and /dev/null differ diff --git a/java/apps/NexusII/classes/RoomFrame.class b/java/apps/NexusII/classes/RoomFrame.class deleted file mode 100644 index 4b648e1a8cc..00000000000 Binary files a/java/apps/NexusII/classes/RoomFrame.class and /dev/null differ diff --git a/java/apps/NexusII/classes/RoomThread.class b/java/apps/NexusII/classes/RoomThread.class deleted file mode 100644 index 829fa4175cb..00000000000 Binary files a/java/apps/NexusII/classes/RoomThread.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CApplet.class b/java/apps/NexusII/classes/awtCommand/CApplet.class deleted file mode 100644 index 3af0361de76..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/CApplet.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CApplet.java b/java/apps/NexusII/classes/awtCommand/CApplet.java deleted file mode 100644 index a8680d9abf3..00000000000 --- a/java/apps/NexusII/classes/awtCommand/CApplet.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 1996 Jan Newmarch, University of Canberra. - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The author - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -package awtCommand; - -import java.awt.*; -import java.applet.*; - -public class CApplet extends Applet { - - protected Command gotFocusCommand = null, - lostFocusCommand = null; - protected Command mouseDownCommand = null, - mouseDragCommand = null, - mouseEnterCommand = null, - mouseExitCommand = null, - mouseMoveCommand = null, - mouseUpCommand = null; - protected Command keyUpCommand = null, - keyDownCommand = null; - - /** - * Constructs a new CApplet. - */ - public CApplet() { - super(); - } - - /* - * event handling methods - */ - - /** - * Called if the window gains focus. This results in a call to - * the gotFocusCommand object with what set to null. - */ - public boolean gotFocus(Event evt, Object what) { - if (gotFocusCommand != null) - gotFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the window loses focus. This results in a call to - * the lostFocusCommand object with what set to null. - */ - public boolean lostFocus(Event evt, Object what) { - if (lostFocusCommand != null) - lostFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the mouse is down. - * This results in a call to the mouseDownCommand object with - * what set to Point(x, y) - */ - public boolean mouseDown(Event evt, int x, int y) { - if (mouseDownCommand != null) - mouseDownCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse is dragged. - * This results in a call to the mouseDragCommand object with - * what set to Point(x, y) - */ - public boolean mouseDrag(Event evt, int x, int y) { - if (mouseDragCommand != null) - mouseDragCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse enters the window. - * This results in a call to the mouseEnterCommand object with - * what set to Point(x, y) - */ - public boolean mouseEnter(Event evt, int x, int y) { - if (mouseEnterCommand != null) - mouseEnterCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse moves inside the window. - * This results in a call to the mouseMoveCommand object with - * what set to Point(x, y) - */ - public boolean mouseMove(Event evt, int x, int y) { - if (mouseExitCommand != null) - mouseExitCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse is up. - * This results in a call to the mouseUpCommand object with - * what set to Point(x, y) - */ - public boolean mouseUp(Event evt, int x, int y) { - if (mouseUpCommand != null) - mouseUpCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if a character is pressed. - * This results in a call to the keyDownCommand object with - * what set to Integer(key). - */ - public boolean keyDown(Event evt, int key) { - if (keyDownCommand != null) - keyDownCommand.execute(this, evt, new Integer(key)); - return false; - } - - /** - * Called if a character is released. - * This results in a call to the keyUpCommand object with - * what set to Integer(key). - */ - public boolean keyUp(Event evt, int key) { - if (keyUpCommand != null) - keyUpCommand.execute(this, evt, new Integer(key)); - return false; - } - - - /* - * set...Command methods - */ - - - /** - * Sets the mouseDownCommand object. - */ - public void setMouseDownCommand(Command c) { - mouseDownCommand = c; - } - - /** - * Sets the moueDragCommand object. - */ - public void setMouseDragCommand(Command c) { - mouseDragCommand = c; - } - - /** - * Sets the mouseEnterCommand object. - */ - public void setMouseEnterCommand(Command c) { - mouseEnterCommand = c; - } - - /** - * Sets the mouseExitCommand object. - */ - public void setMouseExitCommand(Command c) { - mouseExitCommand = c; - } - - /** - * Sets the mouseMoveCommand object. - */ - public void setMouseMoveCommand(Command c) { - mouseMoveCommand = c; - } - - /** - * Sets the mouseUpCommand object. - */ - public void setMouseUpCommand(Command c) { - mouseUpCommand = c; - } - - /** - * Sets the keyDownCommand object. - */ - public void setKeyDownCommand(Command c) { - keyDownCommand = c; - } - - /** - * Sets the keyUpCommand object. - */ - public void setKeyUpCommand(Command c) { - keyUpCommand = c; - } -} diff --git a/java/apps/NexusII/classes/awtCommand/CButton.class b/java/apps/NexusII/classes/awtCommand/CButton.class deleted file mode 100644 index b64fecd5bbf..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/CButton.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CButton.java b/java/apps/NexusII/classes/awtCommand/CButton.java deleted file mode 100644 index ff0f3385bad..00000000000 --- a/java/apps/NexusII/classes/awtCommand/CButton.java +++ /dev/null @@ -1,41 +0,0 @@ - -package awtCommand; - -import java.lang.*; -import java.awt.*; - -public class CButton extends java.awt.Button { - protected Command actionCommand = null; - - /** - * Constructs a CButton. - */ - public CButton() { - super(); - } - - /** - * Constructs a CButton with the given name. - */ - public CButton(String name) { - super(name); - } - - /** - * Sets the actionCommand object. - */ - public void setActionCommand(Command action) { - actionCommand = action; - } - - /** - * Called when the button is selected.. - * This results in a call to the actionCommand object - * with what set to the button's label. - */ - public boolean action(Event evt, Object what) { - if (actionCommand != null) - actionCommand.execute(this, evt, what); - return false; - } -} diff --git a/java/apps/NexusII/classes/awtCommand/CCanvas.class b/java/apps/NexusII/classes/awtCommand/CCanvas.class deleted file mode 100644 index 5d697017b5b..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/CCanvas.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CCanvas.java b/java/apps/NexusII/classes/awtCommand/CCanvas.java deleted file mode 100644 index 837b6f56f7a..00000000000 --- a/java/apps/NexusII/classes/awtCommand/CCanvas.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright 1996 Jan Newmarch, University of Canberra. - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The author - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -package awtCommand; - -import java.awt.*; - -public class CCanvas extends Canvas { - - protected Command gotFocusCommand = null, - lostFocusCommand = null; - protected Command mouseDownCommand = null, - mouseDragCommand = null, - mouseEnterCommand = null, - mouseExitCommand = null, - mouseMoveCommand = null, - mouseUpCommand = null; - protected Command keyUpCommand = null, - keyDownCommand = null; - protected Command actionCommand = null; - protected Command scrollAbsoluteCommand = null, - lineDownCommand = null, - lineUpCommand = null, - pageDownCommand = null, - pageUpCommand = null; - protected Command selectCommand = null, - deselectCommand = null; - - - /** - * Constructs a new CCanvas. - */ - public CCanvas() { - super(); - } - - /** - * Handles the event. - * Calls methods for variousL events and passes - * others to its superclass method. - */ - public boolean handleEvent(Event evt) { - switch (evt.id) { - case Event.SCROLL_ABSOLUTE: - return scrollAbsolute(evt, evt.arg); - case Event.SCROLL_LINE_DOWN: - return lineDown(evt, evt.arg); - case Event.SCROLL_LINE_UP: - return lineUp(evt, evt.arg); - case Event.SCROLL_PAGE_DOWN: - return pageDown(evt, evt.arg); - case Event.SCROLL_PAGE_UP: - return pageUp(evt, evt.arg); - case Event.LIST_SELECT: - return select(evt, evt.arg); - case Event.LIST_DESELECT: - return deselect(evt, evt.arg); - default: - return super.handleEvent(evt); - } - } - - - /* - * event handling methods - */ - - /** - * Called if the window gains focus. This results in a call to - * the gotFocusCommand object with what set to null. - */ - public boolean gotFocus(Event evt, Object what) { - if (gotFocusCommand != null) - gotFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the window loses focus. This results in a call to - * the lostFocusCommand object with what set to null. - */ - public boolean lostFocus(Event evt, Object what) { - if (lostFocusCommand != null) - lostFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the mouse is down. - * This results in a call to the mouseDownCommand object with - * what set to Point(x, y) - */ - public boolean mouseDown(Event evt, int x, int y) { - if (mouseDownCommand != null) - mouseDownCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse is dragged. - * This results in a call to the mouseDragCommand object with - * what set to Point(x, y) - */ - public boolean mouseDrag(Event evt, int x, int y) { - if (mouseDragCommand != null) - mouseDragCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse enters the window. - * This results in a call to the mouseEnterCommand object with - * what set to Point(x, y) - */ - public boolean mouseEnter(Event evt, int x, int y) { - if (mouseEnterCommand != null) - mouseEnterCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse moves inside the window. - * This results in a call to the mouseMoveCommand object with - * what set to Point(x, y) - */ - public boolean mouseMove(Event evt, int x, int y) { - if (mouseExitCommand != null) - mouseExitCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse is up. - * This results in a call to the mouseUpCommand object with - * what set to Point(x, y) - */ - public boolean mouseUp(Event evt, int x, int y) { - if (mouseUpCommand != null) - mouseUpCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if a character is pressed. - * This results in a call to the keyDownCommand object with - * what set to Integer(key). - */ - public boolean keyDown(Event evt, int key) { - if (keyDownCommand != null) - keyDownCommand.execute(this, evt, new Integer(key)); - return false; - } - - /** - * Called if a character is released. - * This results in a call to the keyUpCommand object with - * what set to Integer(key). - */ - public boolean keyUp(Event evt, int key) { - if (keyUpCommand != null) - keyUpCommand.execute(this, evt, new Integer(key)); - return false; - } - - /** - * Called when an ACTION_EVENT is generated. - * This results in a call to the actionCommand object - * with what set to the event's arg. - */ - public boolean action(Event evt, Object what) { - if (actionCommand != null) - actionCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is dragged. - * This results in a call to the scrollAbsoluteCommand object - * with what set to the slider location value. - */ - public boolean scrollAbsolute(Event evt, Object what) { - if (scrollAbsoluteCommand != null) - scrollAbsoluteCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is incremented down. - * This results in a call to the lineDownCommand object - * with what set to the slider location value. - */ - public boolean lineDown(Event evt, Object what) { - if (lineDownCommand != null) - lineDownCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is incremented up. - * This results in a call to the lineUpCommand object - * with what set to the slider location value. - */ - public boolean lineUp(Event evt, Object what) { - if (lineUpCommand != null) - lineUpCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar pages up. - * This results in a call to the pageUpCommand object - * with what set to the slider location value. - */ - public boolean pageUp(Event evt, Object what) { - if (pageUpCommand != null) - pageUpCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar pages down. - * This results in a call to the pageDownCommand object - * with what set to the slider location value. - */ - public boolean pageDown(Event evt, Object what) { - if (pageDownCommand != null) - pageDownCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the mouse selects an item in a List. - * This results in a call to the selectCommand object - * with what set to the selected index. - */ - public boolean select(Event evt, Object what) { - if (selectCommand != null) - selectCommand.execute(this, evt, what); - return false; - } - - - /** - * Called if the mouse deselects an item in a List. - * This results in a call to the deselectCommand object - * with what set to the deselected index. - */ - public boolean deselect(Event evt, Object what) { - if (deselectCommand != null) - deselectCommand.execute(this, evt, what); - return false; - } - - - /* - * set...Command methods - */ - - - - /** - * Sets the mouseDownCommand object. - */ - public void setMouseDownCommand(Command c) { - mouseDownCommand = c; - } - - /** - * Sets the moueDragCommand object. - */ - public void setMouseDragCommand(Command c) { - mouseDragCommand = c; - } - - /** - * Sets the mouseEnterCommand object. - */ - public void setMouseEnterCommand(Command c) { - mouseEnterCommand = c; - } - - /** - * Sets the mouseExitCommand object. - */ - public void setMouseExitCommand(Command c) { - mouseExitCommand = c; - } - - /** - * Sets the mouseMoveCommand object. - */ - public void setMouseMoveCommand(Command c) { - mouseMoveCommand = c; - } - - /** - * Sets the mouseUpCommand object. - */ - public void setMouseUpCommand(Command c) { - mouseUpCommand = c; - } - - /** - * Sets the keyDownCommand object. - */ - public void setKeyDownCommand(Command c) { - keyDownCommand = c; - } - - /** - * Sets the keyUpCommand object. - */ - public void setKeyUpCommand(Command c) { - keyUpCommand = c; - } - - /** - * Sets the actionCommand object. - */ - public void setActionCommand(Command action) { - actionCommand = action; - } - - /** - * Sets the scrollAbsoluteCommand. - */ - public void setScrollAbsoluteCommand(Command c) { - scrollAbsoluteCommand = c; - } - - /** - * Sets the lineUpCommand. - */ - public void setLineUpCommand(Command c) { - lineUpCommand = c; - } - - /** - * Sets the lineDownCommand. - */ - public void setLineDownCommand(Command c) { - lineDownCommand = c; - } - - /** - * Sets the pageUpCommand. - */ - public void setPageUpCommand(Command c) { - pageUpCommand = c; - } - - /** - * Sets the pageDownCommand. - */ - public void setPageDownCommand(Command c) { - pageDownCommand = c; - } - - /** - * Sets the selectCommand. - */ - public void setSelectCommand(Command select) { - selectCommand = select; - } - - /** - * Sets the deselectCommand. - */ - public void setDeselectCommand(Command deselect) { - deselectCommand = deselect; - } - -} diff --git a/java/apps/NexusII/classes/awtCommand/CFrame.class b/java/apps/NexusII/classes/awtCommand/CFrame.class deleted file mode 100644 index 66f25773c76..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/CFrame.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CFrame.java b/java/apps/NexusII/classes/awtCommand/CFrame.java deleted file mode 100644 index f63d3ce8b9a..00000000000 --- a/java/apps/NexusII/classes/awtCommand/CFrame.java +++ /dev/null @@ -1,486 +0,0 @@ -/* - * Copyright 1996 Jan Newmarch, University of Canberra. - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The author - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -package awtCommand; - -import java.awt.*; - -public class CFrame extends Frame { - - protected Command destroyCommand = null, - deiconifyCommand = null, - iconifyCommand = null, - movedCommand = null; - protected Command gotFocusCommand = null, - lostFocusCommand = null; - protected Command mouseDownCommand = null, - mouseDragCommand = null, - mouseEnterCommand = null, - mouseExitCommand = null, - mouseMoveCommand = null, - mouseUpCommand = null; - protected Command keyUpCommand = null, - keyDownCommand = null; - protected Command actionCommand = null; - protected Command scrollAbsoluteCommand = null, - lineDownCommand = null, - lineUpCommand = null, - pageDownCommand = null, - pageUpCommand = null; - protected Command selectCommand = null, - deselectCommand = null; - - /** - * Constructs a new, initially invisible CFrame. - */ - public CFrame() { - super(); - } - - /** - * Constructs a new, initially invisible CFrame with the - * specified title. - */ - public CFrame(String title) { - super(title); - } - - /** - * Handles the event - */ - public boolean handleEvent(Event evt) { - switch (evt.id) { - case Event.WINDOW_DESTROY: - return windowDestroy(evt); - case Event.WINDOW_DEICONIFY: - return windowDeiconify(evt); - case Event.WINDOW_ICONIFY: - return windowIconify(evt); - case Event.WINDOW_MOVED: - return windowMoved(evt); - case Event.SCROLL_ABSOLUTE: - return scrollAbsolute(evt, evt.arg); - case Event.SCROLL_LINE_DOWN: - return lineDown(evt, evt.arg); - case Event.SCROLL_LINE_UP: - return lineUp(evt, evt.arg); - case Event.SCROLL_PAGE_DOWN: - return pageDown(evt, evt.arg); - case Event.SCROLL_PAGE_UP: - return pageUp(evt, evt.arg); - case Event.LIST_SELECT: - return select(evt, evt.arg); - case Event.LIST_DESELECT: - return deselect(evt, evt.arg); - default: - return super.handleEvent(evt); - } - } - - /* - * event handling methods - */ - - /** - * Called if the dialog's window is destroyed. This results in a call to - * the destroyCommand object with what set to null - */ - public boolean windowDestroy(Event evt) { - if (destroyCommand != null) - destroyCommand.execute(this, evt, null); - return false; - } - - /** - * Called if the dialog's window is deiconified. This results in a call to - * the deiconifyCommand object with what set to null - */ - public boolean windowDeiconify(Event evt) { - if (deiconifyCommand != null) - deiconifyCommand.execute(this, evt, null); - return false; - } - - /** - * Called if the dialog is iconified. This results in a call to - * the iconifyCommand object with what set to null - */ - public boolean windowIconify(Event evt) { - if (iconifyCommand != null) - iconifyCommand.execute(this, evt, null); - return false; - } - - /** - * Called if the dialog's window is moved. This results in a call to - * the movedCommand object with what set to Point(x, y) - */ - public boolean windowMoved(Event evt) { - if (movedCommand != null) - movedCommand.execute(this, evt, new Point(evt.x, evt.y)); - return false; - } - - /* - * I don't know where what objects this next set should belong - * to. Putting them at the top is ok for now - */ - - /** - * Called if the window gains focus. This results in a call to - * the gotFocusCommand object with what set to null. - */ - public boolean gotFocus(Event evt, Object what) { - if (gotFocusCommand != null) - gotFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the window loses focus. This results in a call to - * the lostFocusCommand object with what set to null. - */ - public boolean lostFocus(Event evt, Object what) { - if (lostFocusCommand != null) - lostFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the mouse is down. - * This results in a call to the mouseDownCommand object with - * what set to Point(x, y) - */ - public boolean mouseDown(Event evt, int x, int y) { - if (mouseDownCommand != null) - mouseDownCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse is dragged. - * This results in a call to the mouseDragCommand object with - * what set to Point(x, y) - */ - public boolean mouseDrag(Event evt, int x, int y) { - if (mouseDragCommand != null) - mouseDragCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse enters the window. - * This results in a call to the mouseEnterCommand object with - * what set to Point(x, y) - */ - public boolean mouseEnter(Event evt, int x, int y) { - if (mouseEnterCommand != null) - mouseEnterCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse moves inside the window. - * This results in a call to the mouseMoveCommand object with - * what set to Point(x, y) - */ - public boolean mouseMove(Event evt, int x, int y) { - if (mouseExitCommand != null) - mouseExitCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse is up. - * This results in a call to the mouseUpCommand object with - * what set to Point(x, y) - */ - public boolean mouseUp(Event evt, int x, int y) { - if (mouseUpCommand != null) - mouseUpCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if a character is pressed. - * This results in a call to the keyDownCommand object with - * what set to Integer(key). - */ - public boolean keyDown(Event evt, int key) { - if (keyDownCommand != null) - keyDownCommand.execute(this, evt, new Integer(key)); - return false; - } - - /** - * Called if a character is released. - * This results in a call to the keyUpCommand object with - * what set to Integer(key). - */ - public boolean keyUp(Event evt, int key) { - if (keyUpCommand != null) - keyUpCommand.execute(this, evt, new Integer(key)); - return false; - } - - - /** - * Called when an ACTION_EVENT is generated. - * This results in a call to the actionCommand object - * with what set to the event's arg. - */ - public boolean action(Event evt, Object what) { - if (actionCommand != null) - actionCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is dragged. - * This results in a call to the scrollAbsoluteCommand object - * with what set to the slider location value. - */ - public boolean scrollAbsolute(Event evt, Object what) { - if (scrollAbsoluteCommand != null) - scrollAbsoluteCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is incremented down. - * This results in a call to the lineDownCommand object - * with what set to the slider location value. - */ - public boolean lineDown(Event evt, Object what) { - if (lineDownCommand != null) - lineDownCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is incremented up. - * This results in a call to the lineUpCommand object - * with what set to the slider location value. - */ - public boolean lineUp(Event evt, Object what) { - if (lineUpCommand != null) - lineUpCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar pages up. - * This results in a call to the pageUpCommand object - * with what set to the slider location value. - */ - public boolean pageUp(Event evt, Object what) { - if (pageUpCommand != null) - pageUpCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar pages down. - * This results in a call to the pageDownCommand object - * with what set to the slider location value. - */ - public boolean pageDown(Event evt, Object what) { - if (pageDownCommand != null) - pageDownCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the mouse selects an item in a List. - * This results in a call to the selectCommand object - * with what set to the selected index. - */ - public boolean select(Event evt, Object what) { - if (selectCommand != null) - selectCommand.execute(this, evt, what); - return false; - } - - - /** - * Called if the mouse deselects an item in a List. - * This results in a call to the deselectCommand object - * with what set to the deselected index. - */ - public boolean deselect(Event evt, Object what) { - if (deselectCommand != null) - deselectCommand.execute(this, evt, what); - return false; - } - - - /* - * set...Command methods - */ - - - /** - * Sets the destroyCommand object. - */ - public void setDestroyCommand(Command c) { - destroyCommand = c; - } - - /** - * Sets the deiconifyCommand object. - */ - public void setDeiconifyCommand(Command c) { - deiconifyCommand = c; - } - - /** - * Sets the iconifyCommand object. - */ - public void setIconifyCommand(Command c) { - iconifyCommand = c; - } - - /** - * Sets the movedCommand object. - */ - public void setMovedCommand(Command c) { - movedCommand = c; - } - - /** - * Sets the mouseDownCommand object. - */ - public void setMouseDownCommand(Command c) { - mouseDownCommand = c; - } - - /** - * Sets the moueDragCommand object. - */ - public void setMouseDragCommand(Command c) { - mouseDragCommand = c; - } - - /** - * Sets the mouseEnterCommand object. - */ - public void setMouseEnterCommand(Command c) { - mouseEnterCommand = c; - } - - /** - * Sets the mouseExitCommand object. - */ - public void setMouseExitCommand(Command c) { - mouseExitCommand = c; - } - - /** - * Sets the mouseMoveCommand object. - */ - public void setMouseMoveCommand(Command c) { - mouseMoveCommand = c; - } - - /** - * Sets the mouseUpCommand object. - */ - public void setMouseUpCommand(Command c) { - mouseUpCommand = c; - } - - /** - * Sets the keyDownCommand object. - */ - public void setKeyDownCommand(Command c) { - keyDownCommand = c; - } - - /** - * Sets the keyUpCommand object. - */ - public void setKeyUpCommand(Command c) { - keyUpCommand = c; - } - - /** - * Sets the actionCommand object. - */ - public void setActionCommand(Command action) { - actionCommand = action; - } - - /** - * Sets the scrollAbsoluteCommand. - */ - public void setScrollAbsoluteCommand(Command c) { - scrollAbsoluteCommand = c; - } - - /** - * Sets the lineUpCommand. - */ - public void setLineUpCommand(Command c) { - lineUpCommand = c; - } - - /** - * Sets the lineDownCommand. - */ - public void setLineDownCommand(Command c) { - lineDownCommand = c; - } - - /** - * Sets the pageUpCommand. - */ - public void setPageUpCommand(Command c) { - pageUpCommand = c; - } - - /** - * Sets the pageDownCommand. - */ - public void setPageDownCommand(Command c) { - pageDownCommand = c; - } - - /** - * Sets the selectCommand. - */ - public void setSelectCommand(Command select) { - selectCommand = select; - } - - public void setGotFocusCommand(Command c) { - gotFocusCommand = c ; - } - /** - * Sets the deselectCommand. - */ - public void setDeselectCommand(Command deselect) { - deselectCommand = deselect; - } - -} - - - - - - - - - - - - - diff --git a/java/apps/NexusII/classes/awtCommand/CList.class b/java/apps/NexusII/classes/awtCommand/CList.class deleted file mode 100644 index c595ce7786b..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/CList.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CList.java b/java/apps/NexusII/classes/awtCommand/CList.java deleted file mode 100644 index 110e6a01db2..00000000000 --- a/java/apps/NexusII/classes/awtCommand/CList.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 1996 Jan Newmarch, University of Canberra. - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The author - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - - -package awtCommand; - -import java.awt.*; - -public class CList extends List { - protected Command selectCommand = null; - protected Command deselectCommand = null; - protected Command actionCommand = null; - - /** - * Handles the event - */ - public boolean handleEvent(Event evt) { - switch (evt.id) { - case Event.LIST_SELECT: - return select(evt, evt.arg); - case Event.LIST_DESELECT: - return deselect(evt, evt.arg); - default: - return super.handleEvent(evt); - } - } - - /* - * event handling methods - */ - - - /** - * Called if the Enter key is pressed. - * This results in a call to the actionCommand object - * with what set to the selected item. - */ - public boolean action(Event evt, Object what) { - if (actionCommand != null) - actionCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the mouse selects an item. - * This results in a call to the selectCommand object - * with what set to the selected index. - */ - public boolean select(Event evt, Object what) { - if (selectCommand != null) - selectCommand.execute(this, evt, what); - return false; - } - - - /** - * Called if the mouse deselects an item. - * This results in a call to the deselectCommand object - * with what set to the deselected index. - */ - public boolean deselect(Event evt, Object what) { - if (deselectCommand != null) - deselectCommand.execute(this, evt, what); - return false; - } - - - /** - * Sets the actionCommand. - */ - public void setActionCommand(Command action) { - actionCommand = action; - } - - /** - * Sets the selectCommand. - */ - public void setSelectCommand(Command select) { - selectCommand = select; - } - - /** - * Sets the deselectCommand. - */ - public void setDeselectCommand(Command deselect) { - deselectCommand = deselect; - } -} diff --git a/java/apps/NexusII/classes/awtCommand/CPanel.class b/java/apps/NexusII/classes/awtCommand/CPanel.class deleted file mode 100644 index d00477a30f5..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/CPanel.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CPanel.java b/java/apps/NexusII/classes/awtCommand/CPanel.java deleted file mode 100644 index 1c8d39f8537..00000000000 --- a/java/apps/NexusII/classes/awtCommand/CPanel.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright 1996 Jan Newmarch, University of Canberra. - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The author - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -package awtCommand; - -import java.awt.*; - -public class CPanel extends Panel { - - protected Command gotFocusCommand = null, - lostFocusCommand = null; - protected Command mouseDownCommand = null, - mouseDragCommand = null, - mouseEnterCommand = null, - mouseExitCommand = null, - mouseMoveCommand = null, - mouseUpCommand = null; - protected Command keyUpCommand = null, - keyDownCommand = null; - protected Command actionCommand = null; - protected Command scrollAbsoluteCommand = null, - lineDownCommand = null, - lineUpCommand = null, - pageDownCommand = null, - pageUpCommand = null; - protected Command selectCommand = null, - deselectCommand = null; - - /** - * Constructs a new CPanel. - */ - public CPanel() { - super(); - } - - - /** - * Handles the event. - * Calls methods for variousL events and passes - * others to its superclass method. - */ - public boolean handleEvent(Event evt) { - switch (evt.id) { - case Event.SCROLL_ABSOLUTE: - return scrollAbsolute(evt, evt.arg); - case Event.SCROLL_LINE_DOWN: - return lineDown(evt, evt.arg); - case Event.SCROLL_LINE_UP: - return lineUp(evt, evt.arg); - case Event.SCROLL_PAGE_DOWN: - return pageDown(evt, evt.arg); - case Event.SCROLL_PAGE_UP: - return pageUp(evt, evt.arg); - case Event.LIST_SELECT: - return select(evt, evt.arg); - case Event.LIST_DESELECT: - return deselect(evt, evt.arg); - default: - return super.handleEvent(evt); - } - } - - /* - * event handling methods - */ - - /** - * Called if the window gains focus. This results in a call to - * the gotFocusCommand object with what set to null. - */ - public boolean gotFocus(Event evt, Object what) { - if (gotFocusCommand != null) - gotFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the window loses focus. This results in a call to - * the lostFocusCommand object with what set to null. - */ - public boolean lostFocus(Event evt, Object what) { - if (lostFocusCommand != null) - lostFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the mouse is down. - * This results in a call to the mouseDownCommand object with - * what set to Point(x, y) - */ - public boolean mouseDown(Event evt, int x, int y) { - if (mouseDownCommand != null) - mouseDownCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse is dragged. - * This results in a call to the mouseDragCommand object with - * what set to Point(x, y) - */ - public boolean mouseDrag(Event evt, int x, int y) { - if (mouseDragCommand != null) - mouseDragCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse enters the window. - * This results in a call to the mouseEnterCommand object with - * what set to Point(x, y) - */ - public boolean mouseEnter(Event evt, int x, int y) { - if (mouseEnterCommand != null) - mouseEnterCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse moves inside the window. - * This results in a call to the mouseMoveCommand object with - * what set to Point(x, y) - */ - public boolean mouseMove(Event evt, int x, int y) { - if (mouseExitCommand != null) - mouseExitCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if the mouse is up. - * This results in a call to the mouseUpCommand object with - * what set to Point(x, y) - */ - public boolean mouseUp(Event evt, int x, int y) { - if (mouseUpCommand != null) - mouseUpCommand.execute(this, evt, new Point(x, y)); - return false; - } - - /** - * Called if a character is pressed. - * This results in a call to the keyDownCommand object with - * what set to Integer(key). - */ - public boolean keyDown(Event evt, int key) { - if (keyDownCommand != null) - keyDownCommand.execute(this, evt, new Integer(key)); - return false; - } - - /** - * Called if a character is released. - * This results in a call to the keyUpCommand object with - * what set to Integer(key). - */ - public boolean keyUp(Event evt, int key) { - if (keyUpCommand != null) - keyUpCommand.execute(this, evt, new Integer(key)); - return false; - } - - - /** - * Called when an ACTION_EVENT is generated. - * This results in a call to the actionCommand object - * with what set to the event's arg. - */ - public boolean action(Event evt, Object what) { - if (actionCommand != null) - actionCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is dragged. - * This results in a call to the scrollAbsoluteCommand object - * with what set to the slider location value. - */ - public boolean scrollAbsolute(Event evt, Object what) { - if (scrollAbsoluteCommand != null) - scrollAbsoluteCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is incremented down. - * This results in a call to the lineDownCommand object - * with what set to the slider location value. - */ - public boolean lineDown(Event evt, Object what) { - if (lineDownCommand != null) - lineDownCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar is incremented up. - * This results in a call to the lineUpCommand object - * with what set to the slider location value. - */ - public boolean lineUp(Event evt, Object what) { - if (lineUpCommand != null) - lineUpCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar pages up. - * This results in a call to the pageUpCommand object - * with what set to the slider location value. - */ - public boolean pageUp(Event evt, Object what) { - if (pageUpCommand != null) - pageUpCommand.execute(this, evt, what); - return false; - } - - /** - * Called when a scrollbar pages down. - * This results in a call to the pageDownCommand object - * with what set to the slider location value. - */ - public boolean pageDown(Event evt, Object what) { - if (pageDownCommand != null) - pageDownCommand.execute(this, evt, what); - return false; - } - - /** - * Called if the mouse selects an item in a List. - * This results in a call to the selectCommand object - * with what set to the selected index. - */ - public boolean select(Event evt, Object what) { - if (selectCommand != null) - selectCommand.execute(this, evt, what); - return false; - } - - - /** - * Called if the mouse deselects an item in a List. - * This results in a call to the deselectCommand object - * with what set to the deselected index. - */ - public boolean deselect(Event evt, Object what) { - if (deselectCommand != null) - deselectCommand.execute(this, evt, what); - return false; - } - - /* - * set...Command methods - */ - - - - /** - * Sets the mouseDownCommand object. - */ - public void setMouseDownCommand(Command c) { - mouseDownCommand = c; - } - - /** - * Sets the moueDragCommand object. - */ - public void setMouseDragCommand(Command c) { - mouseDragCommand = c; - } - - /** - * Sets the mouseEnterCommand object. - */ - public void setMouseEnterCommand(Command c) { - mouseEnterCommand = c; - } - - /** - * Sets the mouseExitCommand object. - */ - public void setMouseExitCommand(Command c) { - mouseExitCommand = c; - } - - /** - * Sets the mouseMoveCommand object. - */ - public void setMouseMoveCommand(Command c) { - mouseMoveCommand = c; - } - - /** - * Sets the mouseUpCommand object. - */ - public void setMouseUpCommand(Command c) { - mouseUpCommand = c; - } - - /** - * Sets the keyDownCommand object. - */ - public void setKeyDownCommand(Command c) { - keyDownCommand = c; - } - - /** - * Sets the keyUpCommand object. - */ - public void setKeyUpCommand(Command c) { - keyUpCommand = c; - } - - - /** - * Sets the actionCommand object. - */ - public void setActionCommand(Command action) { - actionCommand = action; - } - - /** - * Sets the scrollAbsoluteCommand. - */ - public void setScrollAbsoluteCommand(Command c) { - scrollAbsoluteCommand = c; - } - - /** - * Sets the lineUpCommand. - */ - public void setLineUpCommand(Command c) { - lineUpCommand = c; - } - - /** - * Sets the lineDownCommand. - */ - public void setLineDownCommand(Command c) { - lineDownCommand = c; - } - - /** - * Sets the pageUpCommand. - */ - public void setPageUpCommand(Command c) { - pageUpCommand = c; - } - - /** - * Sets the pageDownCommand. - */ - public void setPageDownCommand(Command c) { - pageDownCommand = c; - } - - /** - * Sets the selectCommand. - */ - public void setSelectCommand(Command select) { - selectCommand = select; - } - - /** - * Sets the deselectCommand. - */ - public void setDeselectCommand(Command deselect) { - deselectCommand = deselect; - } - -} diff --git a/java/apps/NexusII/classes/awtCommand/CTextArea.class b/java/apps/NexusII/classes/awtCommand/CTextArea.class deleted file mode 100644 index 9ec6e238cdf..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/CTextArea.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CTextArea.java b/java/apps/NexusII/classes/awtCommand/CTextArea.java deleted file mode 100644 index eacaf526929..00000000000 --- a/java/apps/NexusII/classes/awtCommand/CTextArea.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 1996 Jan Newmarch, University of Canberra. - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The author - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -package awtCommand; - -import java.awt.*; - -public class CTextArea extends TextArea { - - protected Command gotFocusCommand = null, - lostFocusCommand = null; - - /** - * Constructs a new TextArea. - */ - public CTextArea() { - super(); - } - - /** - * Constructs a new TextArea with the specified number of rows and columns. - * @param rows the number of rows - * @param cols the number of columns - */ - public CTextArea(int rows, int cols) { - super(rows, cols); - } - - /** - * Constructs a new TextArea with the specified text displayed. - * @param text the text to be displayed - */ - public CTextArea(String text) { - super(text); - } - - /** - * Constructs a new TextArea with the specified text and the - * specified number of rows - * and columns. - * @param text the text to be displayed - * @param rows the number of rows - * @param cols the number of cols - */ - public CTextArea(String text, int rows, int cols) { - super(text, rows, cols); - } - - - /** - * Called when the text area gains the focus. - * This results in a call to the gotFocusCommand object - * with what set to null. - */ - public boolean gotFocus(Event evt, Object what) { - if (gotFocusCommand != null) - gotFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called when the text area loses the focus. - * This results in a call to the lostFocusCommand object - * with what set to null. - */ - public boolean lostFocus(Event evt, Object what) { - if (lostFocusCommand != null) - lostFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Sets the gotFocusCommand object. - */ - public void setGotFocusCommand(Command c) { - gotFocusCommand = c; - } - - /** - * Sets the lostFocusCommand object. - */ - public void setLostFocusCommand(Command c) { - lostFocusCommand = c; - } -} diff --git a/java/apps/NexusII/classes/awtCommand/CTextField.class b/java/apps/NexusII/classes/awtCommand/CTextField.class deleted file mode 100644 index 6f298a43348..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/CTextField.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/CTextField.java b/java/apps/NexusII/classes/awtCommand/CTextField.java deleted file mode 100644 index 146f13206e5..00000000000 --- a/java/apps/NexusII/classes/awtCommand/CTextField.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 1996 Jan Newmarch, University of Canberra. - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The author - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -package awtCommand; - -import java.awt.*; - -public class CTextField extends TextField { - - protected Command actionCommand = null, - gotFocusCommand = null, - lostFocusCommand = null; - - /** - * Constructs a new CTextField. - */ - public CTextField() { - super(); - } - - /** - * Constructs a new CTextField initialized with the specified columns. - * @param cols the number of columns - */ - public CTextField(int cols) { - super(cols); - } - - /** - * Constructs a new CTextField initialized with the specified text. - * @param text the text to be displayed - */ - public CTextField(String text) { - super(text); - } - - - /** - * Constructs a new CTextField initialized with the specified text and columns. - * @param text the text to be displayed - * @param cols the number of columns - */ - public CTextField(String text, int cols) { - super(text, cols); - } - - - /** - * Called when Enter is pressed in the text field. - * This results in a call to the actionCommand object - * with what set to the text contents. - */ - public boolean action(Event evt, Object what) { - if (actionCommand != null) - actionCommand.execute(this, evt, what); - return false; - } - - /** - * Called when the text field gains the focus. - * This results in a call to the gotFocusCommand object - * with what set to null. - */ - public boolean gotFocus(Event evt, Object what) { - if (gotFocusCommand != null) - gotFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Called when the text field loses the focus. - * This results in a call to the lostFocusCommand object - * with what set to null. - */ - public boolean lostFocus(Event evt, Object what) { - if (lostFocusCommand != null) - lostFocusCommand.execute(this, evt, what); - return false; - } - - /** - * Sets the actionCommand object. - */ - public void setActionCommand(Command c) { - actionCommand = c; - } - - - /** - * Sets the gotFocusCommand object. - */ - public void setGotFocusCommand(Command c) { - gotFocusCommand = c; - } - - /** - * Sets the lostFocusCommand object. - */ - public void setLostFocusCommand(Command c) { - lostFocusCommand = c; - } -} diff --git a/java/apps/NexusII/classes/awtCommand/Command.class b/java/apps/NexusII/classes/awtCommand/Command.class deleted file mode 100644 index 6b3c12c24f7..00000000000 Binary files a/java/apps/NexusII/classes/awtCommand/Command.class and /dev/null differ diff --git a/java/apps/NexusII/classes/awtCommand/Command.java b/java/apps/NexusII/classes/awtCommand/Command.java deleted file mode 100644 index 373c7a363cf..00000000000 --- a/java/apps/NexusII/classes/awtCommand/Command.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 1996 Jan Newmarch, University of Canberra. - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The author - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - - - -package awtCommand; - -import java.awt.*; - -public interface Command { - - /** - * Executes application logic. - * Called by events occurring in associated objects - */ - public abstract void execute(Object target, Event evt, Object what); -} diff --git a/java/apps/NexusII/classes/commandHandler.class b/java/apps/NexusII/classes/commandHandler.class deleted file mode 100644 index 53033fb6b6b..00000000000 Binary files a/java/apps/NexusII/classes/commandHandler.class and /dev/null differ diff --git a/java/apps/NexusII/classes/commandParser.class b/java/apps/NexusII/classes/commandParser.class deleted file mode 100644 index 62da40871e6..00000000000 Binary files a/java/apps/NexusII/classes/commandParser.class and /dev/null differ diff --git a/java/apps/NexusII/classes/connectionHandler.class b/java/apps/NexusII/classes/connectionHandler.class deleted file mode 100644 index 8708229c0eb..00000000000 Binary files a/java/apps/NexusII/classes/connectionHandler.class and /dev/null differ diff --git a/java/apps/NexusII/classes/joinHandler.class b/java/apps/NexusII/classes/joinHandler.class deleted file mode 100644 index 7669e7faed7..00000000000 Binary files a/java/apps/NexusII/classes/joinHandler.class and /dev/null differ diff --git a/java/apps/NexusII/classes/roomHandler.class b/java/apps/NexusII/classes/roomHandler.class deleted file mode 100644 index 9eaa6cc0899..00000000000 Binary files a/java/apps/NexusII/classes/roomHandler.class and /dev/null differ diff --git a/java/apps/NexusII/classes/textHandler.class b/java/apps/NexusII/classes/textHandler.class deleted file mode 100644 index c52764a236b..00000000000 Binary files a/java/apps/NexusII/classes/textHandler.class and /dev/null differ diff --git a/java/apps/NexusII/src/Consumer.java b/java/apps/NexusII/src/Consumer.java deleted file mode 100644 index 84df9b3a3ae..00000000000 --- a/java/apps/NexusII/src/Consumer.java +++ /dev/null @@ -1,74 +0,0 @@ - -// This class encapsulates a Consumer. The consumer dq's from the queue -// Supports both a timed and blocking consumer. -// Each instance of this class creates a different thread of control. -// On timeout, the producer returns. -// The producer tries to dq "iteration" number of times, unless it times out - -//package NexusII.util ; - -public class Consumer extends Thread -{ -public static final int DEFAULT_ITERATIONS = 1 ; -public Consumer(MT_Bounded_Queue queue) - { - this.queue_ = queue ; - this.iterations_ = new Integer(DEFAULT_ITERATIONS); - this.time_out_ = -1 ; - } - -public Consumer(MT_Bounded_Queue queue, String name) - { - super(name); - this.queue_ = queue ; - this.iterations_ = new Integer(DEFAULT_ITERATIONS); - this.time_out_ = -1 ; - } - - -public Consumer(MT_Bounded_Queue queue, String name, Integer iterations) - { - super(name); - this.queue_ = queue ; - this.iterations_ = iterations ; - this.time_out_ = -1 ; - } - - -public Consumer(MT_Bounded_Queue queue, String name, Integer iterations, long msec_timeout) - { - super(name); - this.queue_ = queue ; - this.iterations_ = iterations ; - this.time_out_ = msec_timeout ; - } - - - -public void run() - { - for(int i=0;i - -import java.net.*; -import java.io.*; -import java.util.*; -import ACE.OS.*; -import ACE.SOCK_SAP.*; - -public class NexusIIserver implements consts { - - // Entry point into the server - public static void main(String args[]) throws IOException { - - if(args.length != 1) { - System.out.println("Usage: java NexusIIserver "); - return; - } - - // Create a "Hotel", which is a factory to generate Rooms - // as and when required. - RoomFactory Hotel = new RoomFactory(); - - System.out.println("NexusII server booting"); - SOCKAcceptor sacceptor = new SOCKAcceptor( (new Integer(args[0])).intValue()); - - System.out.println("NexusII is now accepting connections on port " + (new Integer(args[0])).intValue()); - - for(;;) { - - SOCKStream s = new SOCKStream(); - sacceptor.accept(s); - // Accepted connection - // construct a client handler.. - // Pass in the connected socket as an argument, - // and a reference to the Hotel, in case it needs - // to create rooms.. - // and away you go.. - new Thread(new ClientHandler(s, Hotel)).start(); - - } - } -} - - -// This thread handles the clients.. -// It uses 2 additional threads for read/write network operations -// These threads are dedicated to read/write from the -// respective read/write queues.. -class ClientHandler implements Runnable,consts { - - private SOCKStream s_; - private RoomFactory Hotel_; - private MT_Bounded_Queue rq_ = new MT_Bounded_Queue(QUEUE_SIZE); - private MT_Bounded_Queue wq_ = new MT_Bounded_Queue(QUEUE_SIZE); - private String my_name_; - private Vector roomlist_ = new Vector(); - private boolean finished_ = false; - private String init_image_; - - public ClientHandler(SOCKStream s, RoomFactory h) { - s_ = s; - Hotel_ = h; - init_image_ = new String(System.getProperty("mywebaddress") + NEXUS_LOGO); - } - - public void run() { - // Construct the reader/writer threads with the queues and the - // corresponding socket data streams as parameters. - Thread r_ = new socketReaderThread(rq_, new DataInputStream(s_.inputStream())); - Thread w_ = new socketWriterThread(wq_, new DataOutputStream(s_.outputStream())); - r_.start(); - w_.start(); - - // now start parsing the messages, and take action.. - // todo: optimize the below.. - - while(!finished_) { - dataPacket d = (dataPacket) rq_.dq(); - if(d.contentType().startsWith("INIT")) - nexus_init(d); - if(d.contentType().startsWith("JOIN")) - nexus_join(d); - if(d.contentType().startsWith("LEAVE")) - nexus_leave(d); - if(d.contentType().startsWith("QUIT")) - nexus_quit(d); - if(d.contentType().startsWith("TEXT")) - nexus_text(d); - if(d.contentType().startsWith("LUSERS")) - nexus_lusers(d); - if(d.contentType().startsWith("LROOMS")) - nexus_lrooms(d); - if(d.contentType().startsWith("NICK")) - nexus_nick(d); - if(d.contentType().startsWith("URL")) - nexus_url(d); - } - } - - // The following classes implement the server functions.. - - private void nexus_init(dataPacket packet) { - my_name_ = new String(packet.clientName()); - wq_.nq(packet); - } - - private void nexus_join(dataPacket packet) { - Room r = Hotel_.getRoom(packet.content()); - if(r.checkClient(this)) - return; - r.addClient(this); - roomlist_.addElement(r); - writeRoom(r, my_name_ + " has joined the room "); - String contenttype = new String("url"); - dataPacket d = new dataPacket(my_name_, packet.content(), contenttype, (new Integer(init_image_.length())).toString() , init_image_); - wq_.nq(d); - } - - private void nexus_text(dataPacket packet) { - Room r = Hotel_.getRoom(packet.destination()); - r.getQ().nq(packet); - } - - private void nexus_lusers(dataPacket packet) { - - Room r = Hotel_.getRoom(packet.content()); - Enumeration e = r.clientList(); - StringBuffer sb = new StringBuffer(); - while(e.hasMoreElements()) - sb.append(" " + ((ClientHandler)e.nextElement()).getName() + " "); - dataPacket d = new dataPacket(my_name_, packet.destination(), packet.contentType(), (new Integer(sb.length())).toString(), sb.toString()); - wq_.nq(d); - } - - private void nexus_lrooms(dataPacket packet) { - String s = Hotel_.listRooms(); - dataPacket d = new dataPacket(my_name_, packet.destination(), packet.contentType(), (new Integer(s.length())).toString(), s.toString()); - wq_.nq(d); - } - - private void nexus_nick(dataPacket packet) { - Enumeration e = roomlist_.elements(); - while(e.hasMoreElements()) - writeRoom((Room)e.nextElement(), my_name_ + " is now known as " + packet.content()); - - my_name_ = new String(packet.content()); - } - - private void nexus_leave(dataPacket packet) { - - Room r = Hotel_.getRoom(packet.content()); - writeRoom(r, my_name_ + " has left the room " + packet.content()); - if(r.delClient(this)) Hotel_.delRoom(r); - roomlist_.removeElement(r); - } - - private void nexus_quit(dataPacket packet) { - - Enumeration e = roomlist_.elements(); - while(e.hasMoreElements()) { - Room r = (Room)e.nextElement(); - writeRoom(r, my_name_ + " has quit " ); - r.delClient(this); - } - finished_ = true; - } - - private void nexus_url(dataPacket packet) { - try { - URL u = new URL(packet.content()); - - // first extract the filename stripped of its path. - int index = u.getFile().lastIndexOf("/"); - String infilename = u.getFile().substring(index + 1); - - // next construct the name of the temporary file - String outfilename = (System.getProperty("mywebdir") + "_" + packet.destination() + "." + infilename); - - // now the temporary URL assigned to this request - String imageURL = new String(System.getProperty("mywebaddress") + "_" + packet.destination() + "." + infilename); - - // Open temporary file for writing - FileOutputStream fout = new FileOutputStream(outfilename); - - // Now contact alien ship - InputStream i = u.openStream(); - byte[] buffer = new byte[1024]; - - // And download the image - for(;;) { - int num = i.read(buffer); - if(num < 0) - break; - fout.write(buffer, 0, num); - } - - fout.close(); - i.close(); - - // Get room for which this request was issued - Room r = Hotel_.getRoom(packet.destination()); - - // invalidate previous entry - File f = new File(r.getLastImageName()); - if(f.exists()) f.delete(); - - // add new image name - r.putNextImageName(outfilename); - writeRoom(r,"Asynchronously transferring image " + packet.content() + " from " + my_name_ ); - dataPacket d = new dataPacket(my_name_, packet.destination(), packet.contentType(), (new Integer(imageURL.length())).toString(), imageURL); - r.getQ().nq(d); // multicast this imageURL onto the room.. - - } - catch(java.net.MalformedURLException ue) { - System.out.println("warning:Invalid URL requested"); - } - catch(java.io.IOException e) { - System.out.println("warning: IOException occurred"); - } - - } - - // Sends a "system" message msg onto room r - private void writeRoom(Room r, String msg) { - StringBuffer sb = new StringBuffer(); - sb.append("==>"); - sb.append(msg); - dataPacket d = new dataPacket(my_name_, r.getName() , "TEXT" , (new Integer(sb.length())).toString(), sb.toString()); - r.getQ().nq(d); - } - - public String getName() { - return my_name_; - } - - public MT_Bounded_Queue getQ() { - return wq_; - } - -} -// ---------------------------------------------------------------------- -/** This class implements a room factory. getRoom returns an existing room, - or else creates it and returns a reference to a new room. - -**/ -class RoomFactory implements consts { - - private Vector Hotel_; - public RoomFactory() { - Hotel_ = new Vector(); - } - public synchronized Room getRoom(String name) { - Enumeration e = Hotel_.elements(); - while(e.hasMoreElements()) { - Room r = (Room) e.nextElement(); - if(r.getName().equals(name)) - return r; - } - addRoom(name); - return getRoom(name); - } - - private synchronized void addRoom(String name) { - Room r = new Room(name); - Hotel_.addElement(r); - } - public synchronized void delRoom(Room r) { - Hotel_.removeElement(r); - } - public synchronized String listRooms() { - Enumeration e = Hotel_.elements(); - StringBuffer sb = new StringBuffer(); - while(e.hasMoreElements()) - sb.append(" " + ((Room)e.nextElement()).getName() + " "); - return sb.toString(); - } -} - - diff --git a/java/apps/NexusII/src/Producer.java b/java/apps/NexusII/src/Producer.java deleted file mode 100644 index 4153f7d79df..00000000000 --- a/java/apps/NexusII/src/Producer.java +++ /dev/null @@ -1,87 +0,0 @@ -// This class encapsulates a Producer. Each new instance of this class -// creates a different thread which tries to nq into the queue -// Currently queues random values generated by the Random class -// If timeout expires, the Producer instance returns - -//package NexusII.util ; - -import java.util.Random ; - -public class Producer extends Thread -{ - -// If no time out is desired, timeout value is set to one. so the run method -// knows which nq to call - -public Producer(MT_Bounded_Queue queue) - { - this.queue_ = queue ; - this.iterations_ = new Integer(DEFAULT_ITERATIONS); - this.time_out_ = -1 ; - } - -// Include the name of the thread as a parameter -public Producer(MT_Bounded_Queue queue, String name) - { - super(name); - this.queue_ = queue ; - this.iterations_ = new Integer(DEFAULT_ITERATIONS); - this.time_out_ = -1 ; - } - -// If the number of iterations are also included -- -public Producer(MT_Bounded_Queue queue, String name, Integer iterations) - { - super(name); - this.queue_ = queue ; - iterations_ = iterations ; - this.time_out_ = -1 ; - } - -// Finally, if the timeout period is also included - -public Producer(MT_Bounded_Queue queue, String name, Integer iterations, long msec_timeout) - { - super(name); - this.queue_ = queue ; - iterations_ = iterations ; - this.time_out_ = msec_timeout ; - } - -// The hook method called by start() - -public void run() - { - // Initialize the random number generator - Random rand = new Random(); - for(int i=0;i - - -import java.util.*; -import java.io.File; - -// This class(&thread) is responsible for multicasting -// packets on its incoming "client" queues, onto one or -// more outgoing queues, which are picked up by the client. -class RoomThread implements Runnable, consts { - - private MT_Bounded_Queue rq_; - private Vector clientlist_; - - public RoomThread(MT_Bounded_Queue rq, Vector clientlist) { - rq_ = rq; - clientlist_ = clientlist; - } - - public void run() { - for(;;) { - dataPacket d = (dataPacket) rq_.dq(); // Extract packet - Enumeration e = clientlist_.elements(); // Iterate over clients - while(e.hasMoreElements()) - ((ClientHandler)e.nextElement()).getQ().nq(d); // Enqueue packet - } - } -} - - -public class Room implements consts { - - private String name_; // name of this "room" - private String last_image_ = new String("NexusII.gif"); // filename of the last image broadcast - private Thread roomthread_; - private MT_Bounded_Queue rq_ = new MT_Bounded_Queue(); - private Vector clientlist_ = new Vector(); - - // Constructors - public Room(String name) { - int i; - name_ = new String(name); - roomthread_ = new Thread(new RoomThread(rq_, clientlist_)); - roomthread_.start(); - } - - // Client management methods follow.. - - public synchronized void addClient(ClientHandler client) { - clientlist_.addElement(client); - } - // Returns true if this room has now become empty - public synchronized boolean delClient(ClientHandler client) { - clientlist_.removeElement(client); - return clientlist_.isEmpty(); - } - - public synchronized boolean checkClient(ClientHandler client) { - return clientlist_.contains(client); - } - - public synchronized Enumeration clientList() { - return clientlist_.elements(); - } - - public String getName() { - return name_; - } - - public MT_Bounded_Queue getQ() { - return rq_; - } - - public synchronized String getLastImageName() { - return last_image_; - } - - public synchronized void putNextImageName(String s) { - last_image_ = s; - } - - protected void finalize() { - roomthread_.stop(); - File f = new File(last_image_); - if(f.exists()) - f.delete(); - roomthread_ = null; - } -} - - - - - - - diff --git a/java/apps/NexusII/src/RoomFrame.java b/java/apps/NexusII/src/RoomFrame.java deleted file mode 100644 index e9da19b31d6..00000000000 --- a/java/apps/NexusII/src/RoomFrame.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:02 sumedh - Added the Nexus II source code files. - -# Revision 1.2 1996/12/07 06:25:18 rajeev -# backup -# -# Revision 1.1 1996/12/07 06:15:12 rajeev -# Initial revision -# - - -*/ -import java.awt.*; -import awtCommand.*; -import java.util.* ; - -//import NexusII.client.* ; -//import NexusII.util.* ; -//import NexusII.networking.*; - -class RoomFrame extends CFrame implements consts { - private static String rcsId = new String("$Id$"); - - // Graphics Objects - private CTextField tfInput ; - private CTextArea taOutput ; - private CButton bLeave ; - private ImageCanvas icOutput; - private Font normalFont = new Font("Helvetica", Font.PLAIN, 14); - private Font boldFont = new Font("Helvetica", Font.BOLD, 14); - private Font italicFont = new Font("Helvetica", Font.ITALIC, 14); - private static final int LINE_LENGTH = 70; - - // Other required objects - private MT_Bounded_Queue write_q_ ; - private NexusClientApplet applet_ ; - private String myName_ ; - - public RoomFrame(MT_Bounded_Queue write_q, - NexusClientApplet applet, - String name) { - super(name); - write_q_ = write_q ; - applet_ = applet ; - myName_ = name ; - SetUpGraphics(); - this.pack(); - this.show(); - } - - void SetUpGraphics() { - // Initialize the graphics objects - // The input text line - tfInput = new CTextField(LINE_LENGTH); - textHandler handlerT = new textHandler(write_q_,applet_,myName_); - tfInput.setActionCommand(handlerT); - // The leave button - bLeave = new CButton(LEAVE_STR); - bLeave.setActionCommand(applet_.nexusJoiner); - - icOutput = new ImageCanvas(myName_); - taOutput = new CTextArea(10,LINE_LENGTH); - - GridBagLayout gbl = new GridBagLayout(); - GridBagConstraints gbc = new GridBagConstraints(); - setFont(normalFont); - setLayout (gbl); - - gbc.insets = new Insets(5,5,5,5); - gbc.ipadx = 5; - gbc.ipady = 5; - gbc.weightx = 1.0; - gbc.weighty = 1.0; - - // First the Image so that sizes are fixed - gbc.gridx = 1; - gbc.gridy = 0; - gbc.anchor = GridBagConstraints.CENTER; - gbc.fill = GridBagConstraints.BOTH; - gbl.setConstraints(icOutput, gbc); - add(icOutput); - - // The Text Output Area - gbc.gridx = 0; - gbc.gridy = 0; - gbc.weighty = 0.0; - gbc.anchor = GridBagConstraints.SOUTH; - gbc.fill = GridBagConstraints.BOTH; - gbl.setConstraints(taOutput,gbc); - taOutput.setEditable(false); - add(taOutput); - - // The Text Input Field - gbc.gridx = 0; - gbc.gridy = 1; - gbc.weighty = 0.0; - gbc.anchor = GridBagConstraints.NORTH; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbl.setConstraints(tfInput,gbc); - add(tfInput); - - // The Leave Button - gbc.gridx = 1; - gbc.gridy = 1; - gbc.anchor = GridBagConstraints.NORTH; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbl.setConstraints(bLeave,gbc); - add(bLeave); - - resize(800,280); - setResizable(true); // Allow the user to resize - validate(); - } - - public boolean handleEvent(Event event) { - if (event.id == Event.WINDOW_DESTROY) - dispose(); - return super.handleEvent(event); - } - - // This function will be called by the RoomHandler when it receives - // anything for this room and will add the data - public void addText(String tobeadded) { - if (false) { - String speaker = null; - String msg = null; - int pos = tobeadded.indexOf(':'); - if (pos >= 0) - speaker = tobeadded.substring(0,pos+1); - else - speaker = new String(""); - msg = tobeadded.substring(pos+1); - Font oldf = taOutput.getFont(); - taOutput.setFont(boldFont); - taOutput.appendText(speaker); - taOutput.setFont(italicFont); - taOutput.appendText(msg+"\n"); - taOutput.setFont(oldf); - } - else { - taOutput.appendText(tobeadded+"\n"); - } - return; - } - - // This function will also be called by the RoomHandler whenit receives - // Image data for this room. - public void updateImage(Image im) { - if(DEBUG) { - System.out.println("Room : I got an image"); - } - icOutput.setImage(im); - } - - -} - - - -/** - * The ImageCanvas Class -- for the image in the class - */ -class ImageCanvas extends Canvas implements consts { - - Image image_ = null; - int defWidth_ = 128; - int defHeight_ = 128; - int margin = 5; - - String name_ = new String("Nexus Room"); - Font nameFont = new Font("Helvetica",0,14); - - public ImageCanvas(String s) - { - name_ = s; - } - - public Dimension preferredSize() { - return minimumSize(); - } - public Dimension minimumSize() { - return new Dimension(defWidth_, defHeight_); - } - - public void setImage(Image newIm) { - image_ = newIm; - repaint(); - } - public Image getImage() { - return image_; - } - - public void name(String n) { - name_ = n; - } - public String name() { - return name_; - } - - public void paint(Graphics g) { - Dimension d = size(); - int width = d.width; - int height = d.height; - - if (DEBUG) - System.out.println("ImageCanvas:: width = "+width+ " height="+height); - - g.setColor(Color.black); - g.fillRect(0,0,width-1,height-1); - g.setColor(Color.white); - g.fillRect(margin,margin,width-2*margin,height-2*margin); - // Create image if reqd - if (image_ == null) - image_ = createImage(width-2*margin,height-2*margin); - - g.drawImage(image_, margin, margin, - width-2*margin, height-2*margin, Color.white, this); - g.setColor(Color.blue); - g.setFont(nameFont); - FontMetrics fm = g.getFontMetrics(); - g.drawString(name_,(width - fm.stringWidth(name_))/2, - (int)(height*0.9 - fm.getMaxDescent())); - validate(); - return; - } - - public void update(Graphics g) { - paint(g); - } - -} // End of the Image Canvas Class - - - -// this is the event handler for the textfield -- whenever anything is typed -class textHandler implements Command,consts,Runnable { - private MT_Bounded_Queue write_q_ ; - private NexusClientApplet applet_ ; - private String name_ ; - Object what_ ; - - public textHandler(MT_Bounded_Queue write_q, - NexusClientApplet applet, - String name) { - write_q_ = write_q ; - applet_ = applet ; - name_ = name ; - } - - public void execute(Object target, Event evt, Object what) { - // get the string and send it across in a different thread - what_ = what ; - // clear the field in the gui - ((TextField)target).setText(""); - // send it off - new Thread(this).start(); - } - - // send off the string in a different thread - public void run() { - String data = (String)what_; - // check if data begins with / and is followed by url - if(!data.startsWith("/url")) { - - String user = NexusClientApplet.myName ; - String command = user + ":" + data ; - String len = Integer.toString(command.length()); - dataPacket packet = new dataPacket(NexusClientApplet.myName,name_, - "TEXT",len,command); - write_q_.nq(packet); - } - else { - // it is /url - StringTokenizer t = new StringTokenizer(data); - // take out the /url from here - String ur = t.nextToken(); - // data now - String command = t.nextToken(); - String len = Integer.toString(command.length()); - dataPacket packet = new dataPacket(NexusClientApplet.myName,name_, - "URL",len,command); - write_q_.nq(packet); - } - } -} // end of class - - - diff --git a/java/apps/NexusII/src/RoomSpace.java b/java/apps/NexusII/src/RoomSpace.java deleted file mode 100644 index 9afb78ddff1..00000000000 --- a/java/apps/NexusII/src/RoomSpace.java +++ /dev/null @@ -1,110 +0,0 @@ -import java.awt.*; - -class RoomFrame extends Frame // implements Runnable -{ - - // Graphics Objects - private Panel panel = new Panel(); - private TextField tfInput = new TextField(80); - private TextArea taOutput = new TextArea(80,10); - Button bLeave = new Button("Leave"); - ImageCanvas icOutput = new ImageCanvas(); - - void InitGraphics() - { - GridBagLayout gbl = new GridBagLayout(); - GridBagConstraints gbc = new GridBagConstraints(); - setFont(new Font("Helvetica", Font.PLAIN, 14)); - panel.setLayout (gbl); - - gbc.weightx = 1.0; - gbc.weighty = 1.0; - - // First the Image so that sizes are fixed - gbc.gridx = 1; - gbc.gridy = 0; - gbc.anchor = GridBagConstraints.CENTER; - gbc.fill = GridBagConstraints.NONE; - gbl.setConstraints(icOutput, gbc); - panel.add(icOutput); - - // The Text Output Area - gbc.gridx = 0; - gbc.gridy = 0; - gbc.anchor = GridBagConstraints.WEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbl.setConstraints(taOutput,gbc); - taOutput.setEditable(false); - panel.add(taOutput); - - // The Text Input Field - gbc.gridx = 0; - gbc.gridy = 1; - gbc.anchor = GridBagConstraints.WEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbl.setConstraints(tfInput,gbc); - panel.add(tfInput); - - // The Leave Button - gbc.gridx = 1; - gbc.gridy = 1; - gbc.anchor = GridBagConstraints.WEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbl.setConstraints(bLeave,gbc); - panel.add(bLeave); - } - - - public RoomFrame() - { - this("Anonymous"); - } - - public RoomFrame(String s) - { - InitGraphics(); - super(s); - this.pack(); - this.show(); - } - - public boolean handleEvent(Event event) - { - if (event.id == Event.WINDOW_DESTROY) - dispose(); - return super.handleEvent(event); - } - -} - -class ImageCanvas extends Canvas { - - Image image_; - int imgWidth_ = 128; - int imgHeight_ = 128; - - public Dimension preferredSize() { - return minimumSize(); - } - - public Dimension minimumSize() { - return new Dimension(imgWidth_, imgHeight_); - } - - public void image(Image newIm) { - image_ = newIm; - } - - public Image image() { - return image_; - } - - public void paint(Graphics g) { - g.drawImage(image_,0,0,this); - } - - public void update() { - paint(); - } - -} // End of the Image Canvas Class diff --git a/java/apps/NexusII/src/Timed_Wait.java b/java/apps/NexusII/src/Timed_Wait.java deleted file mode 100644 index 792db39ceb9..00000000000 --- a/java/apps/NexusII/src/Timed_Wait.java +++ /dev/null @@ -1,86 +0,0 @@ -// package NexusII.util ; - - -// Subclass the Exception class to get TimeoutException - -class TimeoutException extends Exception -{ - public TimeoutException() - { - super(); - } - - public TimeoutException(String s) - { - super(s); - } - -} - -// Timed_wait class. This can used by enq and deq to do timed_waits -public abstract class Timed_Wait -{ - // By default the object is itself -public Timed_Wait () - { - object_ = this; - } - // If the calling class specifies objects, delegate to it. -public Timed_Wait (Object obj) - { - object_ = obj; - } - - // This is the object we delegate to if a - // subclass gives us a particular object, - // otherwise, we ``delegate'' to ourself - // (i.e., to this). -protected Object object_; - - // This hook method must be overridden - // by a subclass to provide the condition. - -public abstract boolean condition (); - - // This will borrow the monitor lock from the calling class - -public final void timed_wait(long msec_timeout) -throws InterruptedException, TimeoutException - { - // wait if the condition is false - if (!condition()) - { - long start = System.currentTimeMillis() ; - long wait_time = msec_timeout ; - - for(;;) - { - // anyway have to wait atleast till waittime - object_.wait(wait_time); - - // on coming out check for the condition again - if(!condition()) - { - long now = System.currentTimeMillis() ; - long time_so_far = now - start ; - - // if timed out - if(time_so_far >= msec_timeout) - throw new TimeoutException() ; - else - // retry !! we have some time left - wait_time = msec_timeout - time_so_far ; - } - else // the condition is true here - break ; - } - } - } - - // Notify all threads waiting on the object_. -public final void broadcast () - { - object_.notifyAll (); - } -} - diff --git a/java/apps/NexusII/src/Timer.java b/java/apps/NexusII/src/Timer.java deleted file mode 100644 index df781274913..00000000000 --- a/java/apps/NexusII/src/Timer.java +++ /dev/null @@ -1,31 +0,0 @@ -// This class encapsulates a Timer mechanism -// Can be used for Profiling of parts of code and gathering statistics - -package NexusII ; - -public class Timer { - -public Timer() -{ - start_ = 0 ; -} - -public void start() - -{ - start_ = System.currentTimeMillis(); -} - -public long elapsed_time() -{ - return System.currentTimeMillis() - start_ ; -} - -public void stop() -{ - start_ = 0 ; -} - -private long start_ = 0 ; - -} diff --git a/java/apps/NexusII/src/commandHandler.java b/java/apps/NexusII/src/commandHandler.java deleted file mode 100644 index 4cf80d04235..00000000000 --- a/java/apps/NexusII/src/commandHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -// To handle the events generated by command-line. The user will be saying -// /nick - -import java.awt.* ; -import java.util.* ; - -//import NexusII.client.* ; - -import awtCommand.* ; - - -public class commandHandler implements Command,consts { - NexusClientApplet applet_ ; - // will handle the /nick command for now -- urgent - public commandHandler(NexusClientApplet applet ) { - applet_ = applet ; - } - - public void execute(Object target,Event evt,Object what) { - // Right now assume that it is just a nick command - if(DEBUG) { - System.out.println("Nick typed in ---- "); - } - StringTokenizer t = new StringTokenizer((String)what) ; - // string for holding /nick and - String command = null ; - if(t.hasMoreTokens()) { - command = t.nextToken(); - } - - if(command.equalsIgnoreCase("/nick")) { - if(t.hasMoreTokens()) { - // have to send a nick packet to server - applet_.myName = new String(t.nextToken()); - applet_.sendNickToServer(applet_.myName); - - } - } - // clear the field in the gui - ((TextField)target).setText(""); - - } -} -// of class diff --git a/java/apps/NexusII/src/commandParser.java b/java/apps/NexusII/src/commandParser.java deleted file mode 100644 index 64e6da66122..00000000000 --- a/java/apps/NexusII/src/commandParser.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:06 sumedh - Added the Nexus II source code files. - -# Revision 1.1 1996/12/07 06:27:38 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:05:08 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:02:24 rajeev -# Initial revision -# - -*/ -// why not use java utilities !! - -import java.util.* ; -import java.lang.* ; -import java.awt.* ; - - - -//import NexusII.client.* ; -//import NexusII.util.* ; -//import NexusII.networking.* ; - - - -import awtCommand.* ; - -// This class takes a command parses it and packetizes it and puts it in the -// global send queue. It works in its own thread of control and after nqing -// its run() method falls off. It does its work and dies -// Will act as an eventHandler for TextField most probably - -public class commandParser implements Command,consts,Runnable { - - String command ; - MT_Bounded_Queue q_ ; - NexusClientApplet applet_ ; - // constructor - - public commandParser(MT_Bounded_Queue write_q,NexusClientApplet applet) { - // create a reference to the write_q - q_ = write_q ; - // note the applet name - applet_ = applet ; - - } - - - public void execute(Object target, Event evt, Object what) { - // Get the text which was entered there -- - command = new String((String) what) ; - // run in a separate thread - Thread main = new Thread(this); - main.start(); - } - - // The parser etc. run here - public synchronized void run() { - String actual_command = new String(); - String data = new String(); - String data_len = new String(); - if(DEBUG) { - System.out.println("commandParser thread running --- \n"); - } - - // Do the parsing first - if(command.equalsIgnoreCase(LUSERS_STR)) { - actual_command = new String("LUSERS") ; - data = applet_.GetRoomName() ; - data_len = new String(String.valueOf(data.length())); - if(data.length() == 0) - return ; - } - - else if(command.equalsIgnoreCase(LROOMS_STR)) { - actual_command = new String("LROOMS") ; - data = new String("") ; - data_len = new String("0") ; - } - - String room = new String("ROOT"); - - if(DEBUG) { - System.out.println("The room is " + room + "\n"); - } - - /* - StringBuffer databuffer = new StringBuffer(); - - // Get the data - while(t.hasMoreTokens()) { - databuffer.append(t.nextToken()); - } - String data = new String(databuffer); - if(DEBUG) { - System.out.println("The data is " + data + "\n"); - } - - // data length - String data_len = String.valueOf(data.length()); - // Now make a packet - */ - - dataPacket pack = new dataPacket(NexusClientApplet.myName,room,actual_command,data_len,data); - // enqueue it now - q_.nq(pack); - - } // my job is over - -} -// of class - diff --git a/java/apps/NexusII/src/connectionHandler.java b/java/apps/NexusII/src/connectionHandler.java deleted file mode 100644 index 5e9d3823a68..00000000000 --- a/java/apps/NexusII/src/connectionHandler.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:07 sumedh - Added the Nexus II source code files. - -# Revision 1.1 1996/12/07 06:27:38 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:05:30 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:02:24 rajeev -# Initial revision -# - -*/ -// This class will handle the event generated when user presses "connect/dis -// connect" button. It will maintain all the state associated with a -// connection ; -// In particular, it will create reader,writer and demux threads and stop -// them when user pressed disconnect. It also sends the init and quit -// packet to the server -// -- Rajeev Bector 11/26/96 - -// package NexusII.networking ; - -import awtCommand.* ; - -import java.net.* ; -import java.awt.* ; -import java.io.* ; -import java.util.* ; -import ACE.OS.*; -import ACE.SOCK_SAP.*; - -public class connectionHandler implements Command,consts,Runnable { - - // The socket for reading and writing - // private Socket nexusSocket; - private SOCKConnector nexusConnector_ = new SOCKConnector(); - private SOCKStream nexusStream_ = new SOCKStream(); - - // Threads which will do reading and writing from Socket - private Thread readerThread ; - private Thread writerThread ; - - // Threads which demuxes the data from Write Queue - private Thread demuxThread; - - // The socket - // private Socket nexusSocket_ ; - - // Data Streams which flow the data out - private DataInputStream is_ ; - private DataOutputStream os_ ; - - // links to the outside world - private MT_Bounded_Queue read_q_ ; - private MT_Bounded_Queue write_q_ ; - - Integer port_ ; - String host_ ; - - NexusClientApplet applet_ ; - // Constructor - public connectionHandler(String host,Integer port,NexusClientApplet applet) { - host_ = host ; - port_ = port ; - applet_ = applet ; - } // of constructor - - // This will be called when the "connect/disconnet" button is pressed - - public void execute(Object target, Event evt, Object what) { - // run in a separate thread - new Thread(this).start(); - } - - public synchronized void run() { - - // If not connected -- then connect - if(!applet_.connected) { - - // Initialize the queues now - read_q_ = new MT_Bounded_Queue(QUEUE_SIZE); - write_q_ = new MT_Bounded_Queue(QUEUE_SIZE); - - // Try to connect to the server now - // nexusSocket_ = new Socket(host_,port_.intValue()); - try { - nexusConnector_.connect(nexusStream_, host_, port_.intValue()); - } - catch(SocketException s) { } - catch(IOException i) { } - // Attach Streams to read and write end os socket - os_ = new DataOutputStream(nexusStream_.outputStream()); - is_ = new DataInputStream(nexusStream_.inputStream()); - - // do something now - - // create and start the socket reader first - readerThread = new socketReaderThread(read_q_,is_); - readerThread.start(); - - // now create the writer also -- subclass of consumer - writerThread = new socketWriterThread(write_q_,os_); - writerThread.start(); - // Have to send the init packet to the server - sayHelloToServer(); - - - // Do all the graphics needed and also init the join handlers etc. - applet_.OnConnect(); - - // make sure that when demux is created -- joinHandler is there ... !! - - // Create the demux here -- he'll spawn off the rooms - demuxThread = new nexusDemuxThread(read_q_,applet_.Mapper()); - demuxThread.start(); - - } // of if !connected - - // if connected already then I have to disconnect --- have to - // write code for this - else { - - // first leave all the rooms - for(Enumeration e = applet_.Mapper().keys(); e.hasMoreElements();) { - String name = (String) e.nextElement() ; - applet_.SetRoomName(name); - applet_.nexusJoiner.execute(null,null,LEAVE_STR); - } - // send a quit packet to the server - sayByeToServer(); - - // Have to send a leave for all the rooms and leave all the rooms - - // stop the running threads - readerThread.stop(); - demuxThread.stop(); - - // Again meddle with graphics - applet_.OnDisconnect(); - return ; - } - } // of run - - // This method returns the underlying socket descriptor - public Socket handle() { - return nexusStream_.socket(); - } - - public DataInputStream getinStream() { - return is_ ; - } - - public DataOutputStream getoutStream() { - return os_ ; - } - - public MT_Bounded_Queue reader_q() { - return read_q_ ; - } - - - public MT_Bounded_Queue writer_q() { - if(write_q_ == null) - System.out.println("Sending a null write_q"); - return write_q_ ; - } - - // This method will compose a hello packet and send it off -- cannot run - // this in a separate thread. Has to send this first surely to our TCP - // Connection - - public void sayHelloToServer() { - // hello doesnt have any body - byte[] packetHeader = new byte[PACKET_HEADER_LENGTH] ; - String clientID = new String(NexusClientApplet.myName); - String roomID = new String("ROOT"); - String contentType = new String("INIT"); - String contentLength = new String("0"); - - // Make a proper packet out of it - dataPacket initPacket = new dataPacket(clientID,roomID,contentType,contentLength); - - // enqueue that packet for socketWriter to read - write_q_.nq(initPacket); - - } - - // This method send a Quit command to the server -- to say that it is - // pushing off - public void sayByeToServer() { - byte[] packetHeader = new byte[PACKET_HEADER_LENGTH] ; - String clientID = new String(NexusClientApplet.myName); - String roomID = new String("null"); - String contentType = new String("QUIT"); - String contentLength = new String("0"); - - // Make a proper packet out of it - dataPacket quitPacket = new dataPacket(clientID,roomID,contentType,contentLength); - - // enqueue that packet for socketWriter to read - write_q_.nq(quitPacket); - } // of sayByeToServer - -} // of class - - - - - - - - - - - - - - - - - - - - - diff --git a/java/apps/NexusII/src/consts.java b/java/apps/NexusII/src/consts.java deleted file mode 100644 index 304ec41a41e..00000000000 --- a/java/apps/NexusII/src/consts.java +++ /dev/null @@ -1,40 +0,0 @@ -// package NexusII.client ; - -// An interface for all the public constants shared by clientApplet -// All classes that need to access constants will implement this - -public interface consts { - // Length of each field in the header - public static final int FIELD_LENGTH = 32 ; - - // Total length of header - public static final int PACKET_HEADER_LENGTH = 128; - - // Offset where we can find the data length - public static final int DATA_LEN_OFFSET = 96; - - // Size of Queues where reader and writer work - public static final int QUEUE_SIZE = 20 ; - - // Separator used by tokens in the packet - public static final String SEPARATOR = " " ; - - // End of message - public static final String END_OF_DATA = "\n" ; - - // Useful for debugging -- set to false for release version (demo) -- Aravind - public static final boolean DEBUG = false; - - // Size of hash tables - public static final int HASH_SIZE = 16 ; - - public static final String JOIN_STR = "Join" ; - public static final String LEAVE_STR = "Leave" ; - public static final String LUSERS_STR = "List Users" ; - public static final String LROOMS_STR = "List Rooms" ; - - public static final int SERVER_PORT = 42429 ; - public static final String NEXUS_LOGO = "Nexus_Logo.gif"; -} - - diff --git a/java/apps/NexusII/src/dataPacket.java b/java/apps/NexusII/src/dataPacket.java deleted file mode 100644 index 1bd2dfeb6ab..00000000000 --- a/java/apps/NexusII/src/dataPacket.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:08 sumedh - Added the Nexus II source code files. - -# Revision 1.2 1996/12/07 06:27:38 rajeev -# yaah paranoid backup ... -# -# Revision 1.1 1996/12/06 18:23:45 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:07:53 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:02:24 rajeev -# Initial revision -# - -*/ -// This class encapsulates a dataPacket -// Will encapsulate the byteStream as a characterStream into a single thing -// no packets for now -// package NexusII.networking ; - -//import NexusII.client.* ; - -public class dataPacket implements consts, Cloneable{ - - private String clientName ; - private String roomName ; - private String contentType ; - private String contentLength ; - private String content ; - - // constructor -- will create the data packet - public dataPacket(byte[] header, byte[] body) { - int len = FIELD_LENGTH ; - clientName = new String(header,0,0,len); - roomName = new String(header,0,1*len,len); - contentType = new String(header,0,2*len,len); - contentLength = new String(header,0,3*len,len); - content = new String(body,0); - if(DEBUG) - System.out.println("datapacket: Constructed packet with header " + header + " and body " + body); - } - - // another constructor for length 0 packets - public dataPacket(String client, String room, String type,String len) - { - clientName = new String(client); - roomName = new String(room); - contentType = new String(type); - contentLength = new String(len); - content = new String(); - } - - // another one for some data also - public dataPacket(String client, String room, String type,String len,String data) - { - this(client,room,type,len); - content = new String(data); - } - - // return the data in bytized header and body - public void bytize(byte[] header, byte[] body) - { - // clear the header and body -- fill them with whitespace - String white_space = new String(" "); - - if(DEBUG) { - System.out.println("dataPacket: length is " + new Integer(contentLength.trim()).intValue() + "\n"); - } - - int len = FIELD_LENGTH ; - // copy the header - clientName.getBytes(0,clientName.length(),header,0); - roomName.getBytes(0,roomName.length(),header,len*1); - contentType.getBytes(0,contentType.length(),header,len*2); - contentLength.getBytes(0,contentLength.length(),header,len*3); - - int body_len = (new Integer(contentLength.trim())).intValue(); - // copy the body also - content.getBytes(0,body_len,body,0); - } - - public int contentLength() { - return new Integer(contentLength.trim()).intValue(); - } - - // Returns the destination for the current packet - public String destination(){ - return roomName.trim() ; - } - - public String contentType() { - return contentType.trim() ; - } - - - public String content() { - return content.trim() ; - } - - public String clientName() { - return clientName.trim() ; - } - -} -// of class datapacket - - - - - - - - diff --git a/java/apps/NexusII/src/joinHandler.java b/java/apps/NexusII/src/joinHandler.java deleted file mode 100644 index 3ff071c26ed..00000000000 --- a/java/apps/NexusII/src/joinHandler.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:09 sumedh - Added the Nexus II source code files. - -# Revision 1.1 1996/12/07 06:27:38 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:06:22 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:02:24 rajeev -# Initial revision -# - -*/ - -// This class will handle the event generated when user presses "join/leave" -// button. It will maintain all the state associated with all the rooms -// It'll also create and maintain the rooms -// -- Rajeev Bector 11/26/96 - -// package NexusII.networking ; - -// This is a SINGLETON - - -import java.net.* ; -import java.util.* ; -import java.awt.* ; -import java.io.* ; - - -//import NexusII.client.* ; -//import NexusII.util.* ; -//import NexusII.networking.* ; - -import awtCommand.* ; - -public class joinHandler implements Command,consts { - MT_Bounded_Queue write_q_ ; - Hashtable name_to_q_ ; - Hashtable name_to_handler_ ; - NexusClientApplet applet_ ; - - // This will be called when the "join/leave" button is pressed - public joinHandler(MT_Bounded_Queue writer_q,NexusClientApplet applet) { - write_q_ = writer_q ; - applet_ = applet ; - // init. the Hashtables - name_to_q_ = new Hashtable(HASH_SIZE); - name_to_handler_ = new Hashtable(HASH_SIZE); - - } - - public Hashtable Mapper() { - return name_to_q_ ; - } - - public void execute(Object target, Event evt, Object what) { - - String roomName = applet_.GetRoomName() ; - if(roomName.length()==0) { - return ; - } - - // if it is the join button - if(((String)what).equalsIgnoreCase(JOIN_STR)) { - //if already joined -- return - if(name_to_q_.get(roomName) != null) - return ; - - // room doesnt exist - // Just in case the room name isn't listed - applet_.AddRoomName(roomName); - // create a new queue for the room to use - - MT_Bounded_Queue q_ = new MT_Bounded_Queue(QUEUE_SIZE); - if(DEBUG) { - System.out.println("joinHandler: inserted the queue in hash "); - } - name_to_q_.put(roomName,q_); - roomHandler handler = new roomHandler(roomName,q_,write_q_,applet_); - name_to_handler_.put(roomName,handler); - - // send a request to the server - sayJoinToServer(roomName); - // sendTestPacket(roomName,"URL","http://cumbia.cs.wustl.edu:4242/~sumedh/NexusII/NexusII.gif",q_); - } // of join - - else { - // its a "leave packet" - if(name_to_q_.get(roomName) == null) - return ; - // remove the entry from the queue - name_to_q_.remove(roomName); - - roomHandler handle = (roomHandler) name_to_handler_.get(roomName); - if(DEBUG) - System.out.println("joinHandler:Stopiing the room thread" + roomName); - handle.mystop(); - // handle = null ; - - // remove the entry from the queue - name_to_handler_.remove(roomName); - sayLeaveToServer(roomName); - } // of else - } // of execute - - private void sayJoinToServer(String roomName) { - //if (DEBUG) - // System.out.println("In the say J to server..."); - byte[] packetHeader = new byte[PACKET_HEADER_LENGTH] ; - String clientID = new String(NexusClientApplet.myName); - String roomID = new String("ROOT"); - String contentType = new String("JOIN"); - String contentLength = String.valueOf(roomName.length()); - String content = new String(roomName); - // Make a proper packet out of it - dataPacket joinPacket = new dataPacket(clientID,roomID,contentType,contentLength,content); - - // enqueue that packet for socketWriter to read - write_q_.nq(joinPacket); - } - - private void sayLeaveToServer(String roomName) { - byte[] packetHeader = new byte[PACKET_HEADER_LENGTH] ; - String clientID = new String(NexusClientApplet.myName); - String roomID = new String("ROOT"); - String contentType = new String("LEAVE"); - String contentLength = new String(Integer.toString(roomName.length())); - String content = new String(roomName); - - // Make a proper packet out of it - dataPacket leavePacket = new dataPacket(clientID,roomID,contentType,contentLength,content); - - // enqueue that packet for socketWriter to read - write_q_.nq(leavePacket); - } - - - public void sendTestPacket(String roomName,String type,String content,MT_Bounded_Queue readq) { - byte[] packetHeader = new byte[PACKET_HEADER_LENGTH] ; - String clientID = new String(NexusClientApplet.myName); - String contentLength = new String(Integer.toString(content.length())); - - - // Make a proper packet out of it - dataPacket testPacket = new dataPacket(clientID,roomName,type,contentLength,content); - - // enqueue that packet for socketWriter to read - readq.nq(testPacket); - } - - -} - -// of class - - - - - - - - - - - - - - - - diff --git a/java/apps/NexusII/src/makefile b/java/apps/NexusII/src/makefile deleted file mode 100644 index c3cff521511..00000000000 --- a/java/apps/NexusII/src/makefile +++ /dev/null @@ -1,15 +0,0 @@ -all: client server - -client: ../classes/NexusClientApplet.class - -../classes/NexusClientApplet.class: - javac -d ../classes -depend -g NexusClientApplet.java - -server: ../classes/NexusIIserver.class - -../classes/NexusIIserver.class: - javac -d ../classes -depend -g NexusIIserver.java - -clean: - rm -f ../classes/*.class *~ - diff --git a/java/apps/NexusII/src/nexusDemuxThread.java b/java/apps/NexusII/src/nexusDemuxThread.java deleted file mode 100644 index 96d0fdd06e1..00000000000 --- a/java/apps/NexusII/src/nexusDemuxThread.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:10 sumedh - Added the Nexus II source code files. - -# Revision 1.1 1996/12/07 06:27:38 rajeev -# Initial revision -# -# Revision 1.2 1996/12/05 05:39:47 sumedh -# ok -# -# Revision 1.1 1996/12/02 06:08:20 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:02:24 rajeev -# Initial revision -# - -*/ - -// Will take the packets from the input queue -// Parse the packet -// Call the room handler thread which Aravind will provide - -// Mapper object is the one which returns the room_q reference if you pass -// it the room number. Aravind has to implement this object called roomMapper -// which has an instance called mapper in the Applet context. This will be -// referred by nexusDemuxThread whenever it has anything to put in the room_q - -// package NexusII.networking ; - -//import NexusII.util.* ; -//import NexusII.client.* ; - -import java.util.* ; - -public class nexusDemuxThread extends Thread implements consts { - MT_Bounded_Queue q_ ; - dataPacket packet ; - Hashtable mapper_ ; - - // constructor - public nexusDemuxThread(MT_Bounded_Queue read_q,Hashtable mapper) { - q_ = read_q ; - mapper_ = mapper ; - } - - public void run() { - // run till infinity - for(;;) { - if(DEBUG) { - System.out.println("Demux running ---- "); - } - // take out packets from the queue - // parse to find out which room they belong to - packet = ((dataPacket)q_.dq()); - if(DEBUG) { - System.out.println("Demux got something ---- "); - } - - String roomName = packet.destination().trim(); - if(DEBUG) { - System.out.println("demux: destination is : " + roomName); - } - if(DEBUG) { - System.out.println("Hashtable size is " + new Integer(mapper_.size())); - } - // Get a reference to which queue to put it in - MT_Bounded_Queue room_q = (MT_Bounded_Queue)mapper_.get(roomName); - - // nq the packet on the room q - if(room_q != null) { - room_q.nq(packet); - System.out.println("deMux: I have enqueued it successfully"); - } - else - { - System.out.println("demux: room_q was null: i couldnt do much"); - } - } - } - // of run -} -// of class - - - - - -// 11/24/96 -- Rajeev Bector diff --git a/java/apps/NexusII/src/roomHandler.java b/java/apps/NexusII/src/roomHandler.java deleted file mode 100644 index bd125631b74..00000000000 --- a/java/apps/NexusII/src/roomHandler.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:11 sumedh - Added the Nexus II source code files. - -# Revision 1.4 1996/12/07 06:22:49 rajeev -# taking a backup ! -# -# Revision 1.3 1996/12/06 06:20:07 rajeev -# Changes to include leave handler -# -# Revision 1.2 1996/12/06 04:49:44 rajeev -# working now hopefully ! -# -# Revision 1.1 1996/12/06 03:44:32 rajeev -# Initial revision -# - -*/ - -// per room -import java.awt.* ; -import awtCommand.* ; -import java.io.* ; -import java.net.* ; -//import NexusII.client.* ; -//import NexusII.util.* ; -//import NexusII.networking.*; - -public class roomHandler implements Runnable,consts{ - - String roomName_ ; - MT_Bounded_Queue read_q_ ; - MT_Bounded_Queue write_q_ ; - RoomFrame rf_; - Thread mainThread ; - NexusClientApplet applet_ ; - - // I dont know what to do currently - public roomHandler(String roomName, MT_Bounded_Queue reader_q,MT_Bounded_Queue writer_q,NexusClientApplet applet) { - roomName_ = roomName ; - read_q_ = reader_q ; - write_q_ = writer_q ; - applet_ = applet ; - rf_ = new RoomFrame(write_q_,applet_,roomName_); - // whenever this frame gets the mouse focus, handler will be called - FrameHandler fh_ = new FrameHandler(applet_); - rf_.setGotFocusCommand(fh_); - mainThread = new Thread(this); - mainThread.start(); - } - - - public void mystop() { - // dispose the graphics part here - if(DEBUG) - System.out.println("Roomhandlers stop called \n"); - rf_.hide(); - rf_.dispose(); - // no longer need the roomframe - rf_ = null ; - mainThread.stop(); - } - - public void run() { - if(DEBUG) { - System.out.println("Room receiver running ---- "); - } - while(Thread.currentThread() == mainThread) { - // get the data packet - dataPacket packet = (dataPacket)(read_q_.dq()) ; - if(DEBUG) - System.out.println("Room - I got something\n"); - - // if the packet is of text type -- display it - if(packet.contentType().trim().equalsIgnoreCase("TEXT")) { - rf_.addText(packet.content()); - } - // if the packet is a url address -- pull the image across - // this url has to be an image as of now - if(packet.contentType().equalsIgnoreCase("URL")) { - Image im = null ; - try { - im = applet_.getImage(new URL(packet.content())); - } catch (MalformedURLException i) { - // nothing as of now - } - // display the image - rf_.updateImage(im); - - } - - if (DEBUG) - System.out.println("roomhandler" + roomName_ + " got data"); - } - } - - public String toString() { - return roomName_ ; - } - -} // of class roomHandler - -// is executed when the room frame gets mouse focus - -class FrameHandler implements Command { - NexusClientApplet applet_ ; - public FrameHandler(NexusClientApplet applet) { - applet_ = applet ; - } - - public void execute(Object target, Event evt, Object what) { - if(target instanceof Frame) { - applet_.SetRoomName(((RoomFrame)target).getTitle()); - } - } -} - diff --git a/java/apps/NexusII/src/socketReaderThread.java b/java/apps/NexusII/src/socketReaderThread.java deleted file mode 100644 index 35679c504b4..00000000000 --- a/java/apps/NexusII/src/socketReaderThread.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:11 sumedh - Added the Nexus II source code files. - -# Revision 1.1 1996/12/07 06:27:38 rajeev -# Initial revision -# -# Revision 1.3 1996/12/03 01:35:37 rajeev -# fixed a big bug with respect to trim() -# -# Revision 1.2 1996/12/03 01:01:27 rajeev -# // fixed the bug at line 76 -# -# Revision 1.1 1996/12/02 06:08:56 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:02:24 rajeev -# Initial revision -# - -*/ -// The socketReaderThread is like a Producer who reads from the socket and -// nqs it onto the queue. Thats it ... Big Deal. huh ! - -// This threads task is -// 1. Take things from SocketBuffer. -// 2. Ensure that Full Packets are read -// 3. Put the packet onto the queue - -//package NexusII.networking ; - -// get hold of java classes -//import NexusII.client.* ; -//import NexusII.util.* ; - -import java.io.* ; - - -public class socketReaderThread extends Producer implements Runnable,consts -{ - DataInputStream is_ ; - - // new constructor - // Pass the queue and socketid to the constructor - - public socketReaderThread(MT_Bounded_Queue q, DataInputStream is) { - // call the super constructor - super(q); - is_ = is ; - } - - // This will just override the run method and thats it - // I want to have my own run ! - - public void run() { - // run indefinitely -- i am a daemon anyway - if(DEBUG) { - System.out.println("--- This is socketReaderThread --- \n"); - } - - for(;;) { - - // read header bytes from stream - int field_len = FIELD_LENGTH ; - byte[] packetHeader = new byte[PACKET_HEADER_LENGTH]; - try { - is_.readFully(packetHeader,0,PACKET_HEADER_LENGTH); - } - catch (IOException e) { - // do something here - System.out.println("socketReader: I/O exception in read: I am quitting"); - // what to do here -- right now quit - return ; - } - if(DEBUG){ - System.out.println("socketReader read:" + new String(packetHeader,0)); - } - - // take out the length field from this - String length = new String(packetHeader,0,DATA_LEN_OFFSET,field_len); - - // Read this much more from the socket - if(DEBUG) { - System.out.println("The length of packet is " + length); - } - - Integer Test = new Integer(length.trim()); - int len = Test.intValue(); - if(DEBUG) { - System.out.println("srt: attempting to read " + Test + " bytes "); - } - - byte[] packetBody = new byte[len] ; - try { - if(len != 0) - is_.readFully(packetBody,0,len); - } - catch (IOException e) { - // do something here - System.out.println("socketReader: I/O exception in read: I am quitting"); - // what to do here -- right now quit - return ; - } - - // The header and the body are there now -- so make a packet - dataPacket packet = new dataPacket(packetHeader,packetBody); - if(DEBUG) - System.out.println("srt: Now nq'ing item body " + packet.content() ); - queue_.nq(packet); - if(DEBUG) - System.out.println("srt: Done nq'ing.."); - - // go back to reading the socket now - } - // of for(;;) - } - // of method run -} diff --git a/java/apps/NexusII/src/socketWriterThread.java b/java/apps/NexusII/src/socketWriterThread.java deleted file mode 100644 index 395449b6a53..00000000000 --- a/java/apps/NexusII/src/socketWriterThread.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - $RCSfile$ - $Author$ - - Last Update: $Date$ - $Revision$ - - REVISION HISTORY: - $Log$ - Revision 1.1 1997/01/31 01:11:12 sumedh - Added the Nexus II source code files. - -# Revision 1.1 1996/12/07 06:27:38 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:09:22 rajeev -# Initial revision -# -# Revision 1.1 1996/12/02 06:02:24 rajeev -# Initial revision -# - -*/ -// The socketWriterThread is like a Consumer who reads from the write_q and -// puts it onto the socket. Thats it ... Big Deal. huh ! - -// This threads task is -// 1. Write things to SocketBuffer. -// 2. Ensure that Full Packets are sent -// 3. Read the packet off the queue - -//package NexusII.networking ; - -// get hold of java classes - -import java.io.* ; - -//import NexusII.client.* ; -//import NexusII.util.* ; - -public class socketWriterThread extends Consumer implements Runnable,consts -{ - DataOutputStream os_ ; - - // new constructor - // Pass the queue and outstream to the constructor - - public socketWriterThread(MT_Bounded_Queue q, DataOutputStream os) { - // call the super constructor - super(q); - os_ = os ; - } - - // This will just override the run method and thats it - // I want to have my own run ! - - public void run() { - // run indefinitely -- i am a daemon anyway - if(DEBUG) { - System.out.println("--- This is socketWriterThread --- \n"); - } - boolean bye_sent = false ; - while(!bye_sent) { - - // read the packet from the queue - dataPacket packet = (dataPacket) queue_.dq(); - if(DEBUG){ - System.out.println("socketWriterThread: I got something -- \n"); - } - - // read length bytes from packet - int len = packet.contentLength() ; - if(DEBUG) { - System.out.println("socketWriterThread: length is " + new Integer(len)); - } - - - int field_len = FIELD_LENGTH ; - - // Allocate storage for holding the fields - - byte[] packetHeader = new byte[PACKET_HEADER_LENGTH]; - byte[] packetBody = new byte[len] ; - - // Fill them - packet.bytize(packetHeader,packetBody); - - // put it on the wire now -- - - try { - os_.write(packetHeader,0,PACKET_HEADER_LENGTH); - } - catch (IOException e) { - // do something here - } - if(DEBUG){ - System.out.println("I wrote:" + new String(packetHeader,0)); - } - - try { - os_.write(packetBody,0,len); - } - catch (IOException e) { - // do something here - } - if(DEBUG){ - System.out.println("I wrote:" + new String(packetBody,0)); - } - // this is to handle if the user presses disconnect without leaving the - // room - if(packet.contentType().equalsIgnoreCase("QUIT")) - bye_sent = true ; - // go back to reading the queue now - } - // of for(;;) - } - // of method run - -} diff --git a/java/apps/NexusII/src/url_to_url.java b/java/apps/NexusII/src/url_to_url.java deleted file mode 100644 index 0fe08ab6db3..00000000000 --- a/java/apps/NexusII/src/url_to_url.java +++ /dev/null @@ -1,33 +0,0 @@ -// This method takes in a url and a prefix name and pulls that url across the -// network, stores it in a local file named prefix - -// for now it assumes that the url is an image only ! - -import java.net.* ; -import java.io.* ; -import java.awt.* ; -public class url_to_url { - Image im ; - - public url_to_url(URL url,String prefix) { - try { - im = (Image)url.getContent(); - } catch (IOException i) {} - String www_path = System.getProperty("www-path"); - String home_dir = System.getProperty("user.home"); - String dir = home_dir + www_path ; - System.out.println("web dir is this : " + dir); - - } - - public static void main(String[] argv) { - URL test = null ; - try { - test = new URL("http://www.cs.wustl.edu/~rajeev/images/sand.jpg"); - } catch ( MalformedURLException e) {} - - url_to_url t = new url_to_url(test,"root") ; - - } - -} diff --git a/java/apps/NexusII/start b/java/apps/NexusII/start deleted file mode 100755 index c699c96da60..00000000000 --- a/java/apps/NexusII/start +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/sh - -## This is an example script to launch the server. - -# the mywebaddress variable should point to a URL which is world-readable -# the mywebdir variable should point to the actual pathname of the URL -# which is specified by the mywebaddress variable -# The server needs to have write access to the mywebdir directory. -# Thus, the server saves images into the "mywebdir", and clients -# can access them via the "mywebaddress" URL. - -# the 222222 number is the port number on which the server is to be launched -# the same port number should appear in the html document containing -# the client applet (see start.html for an example) - -# while running the server, the ./classes should be part of the CLASSPATH. -# while running the client, the client classes as well as the awtCommand -# toolkit should be world-readable. (The awtcommand toolkit is included -# in this toolkit, under the classes directory.) - - -umask 022 -java -Dmywebaddress=http://cumbia.cs.wustl.edu/NexusII/tmp/ -Dmywebdir=/project/cumbia/sumedh/web/apache/root/NexusII/tmp/ NexusIIserver 222222 - - - - diff --git a/java/apps/NexusII/start.html b/java/apps/NexusII/start.html deleted file mode 100644 index cd591295b4a..00000000000 --- a/java/apps/NexusII/start.html +++ /dev/null @@ -1,3 +0,0 @@ - - - -- cgit v1.2.1