diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ce254ddccfe1c115f88755fd22e770cc707a5315..173f8e26087ec002f010adef660faf397d67d480 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ChangeListManager"> - <list default="true" id="7d248efa-573c-4847-b942-df9b4c49b118" name="Default Changelist" comment="" /> + <list default="true" id="7d248efa-573c-4847-b942-df9b4c49b118" name="Default Changelist" comment=""> + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/GUI/ChatScreen$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/GUI/ChatScreen$1.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/GUI/ChatScreen.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/GUI/ChatScreen.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/GUI/DrawingArea$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/GUI/DrawingArea$1.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/GUI/DrawingArea.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/GUI/DrawingArea.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/client/ChatUpdate.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/client/ChatUpdate.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/client/DrawingUpdate.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/client/DrawingUpdate.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/remote/IDrawingController.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/remote/IDrawingController.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/remote/IDrawingUpdate.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/remote/IDrawingUpdate.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/out/production/infinitymonkeys/server/DrawingController.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/infinitymonkeys/server/DrawingController.class" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/GUI/ChatScreen.form" beforeDir="false" afterPath="$PROJECT_DIR$/src/GUI/ChatScreen.form" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/GUI/ChatScreen.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GUI/ChatScreen.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/GUI/DrawingArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GUI/DrawingArea.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/client/ChatUpdate.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/client/ChatUpdate.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/client/DrawingUpdate.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/client/DrawingUpdate.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/remote/IDrawingController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/remote/IDrawingController.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/remote/IDrawingUpdate.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/remote/IDrawingUpdate.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/server/DrawingController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/server/DrawingController.java" afterDir="false" /> + </list> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> @@ -90,8 +109,8 @@ </list> <recent_temporary> <list> - <item itemvalue="Application.Client" /> <item itemvalue="Application.Server" /> + <item itemvalue="Application.Client" /> </list> </recent_temporary> </component> @@ -108,7 +127,8 @@ <workItem from="1571815157364" duration="1039000" /> <workItem from="1571816646909" duration="820000" /> <workItem from="1571818565591" duration="60000" /> - <workItem from="1571818658517" duration="13772000" /> + <workItem from="1571818658517" duration="14801000" /> + <workItem from="1571890808152" duration="6817000" /> </task> <task id="LOCAL-00001" summary="jj"> <created>1571821705525</created> diff --git a/out/production/infinitymonkeys/GUI/ChatScreen$1.class b/out/production/infinitymonkeys/GUI/ChatScreen$1.class index eceaff279a128c359ebcb7c8f89cec6b3d83a9e7..8461a7cc6cc33f074d11922901d9b8bf95f28ebf 100644 Binary files a/out/production/infinitymonkeys/GUI/ChatScreen$1.class and b/out/production/infinitymonkeys/GUI/ChatScreen$1.class differ diff --git a/out/production/infinitymonkeys/GUI/ChatScreen.class b/out/production/infinitymonkeys/GUI/ChatScreen.class index 7cd31eeec5f863b8a5cc3cde1938f47145ce075b..c3e8af93fdc7ad1265732cef6e4fb96669830866 100644 Binary files a/out/production/infinitymonkeys/GUI/ChatScreen.class and b/out/production/infinitymonkeys/GUI/ChatScreen.class differ diff --git a/out/production/infinitymonkeys/GUI/DrawingArea$1.class b/out/production/infinitymonkeys/GUI/DrawingArea$1.class index b0b6ced309df67c585262b5d7319efb40f28c19e..87146eee5f81dc6e1f67cf958d25d13c142d6190 100644 Binary files a/out/production/infinitymonkeys/GUI/DrawingArea$1.class and b/out/production/infinitymonkeys/GUI/DrawingArea$1.class differ diff --git a/out/production/infinitymonkeys/GUI/DrawingArea.class b/out/production/infinitymonkeys/GUI/DrawingArea.class index 8f66a7753ac8696ff07d04167778e21eef2c029b..fc15084a93287aa216ab72cefabbf5dc09a90851 100644 Binary files a/out/production/infinitymonkeys/GUI/DrawingArea.class and b/out/production/infinitymonkeys/GUI/DrawingArea.class differ diff --git a/out/production/infinitymonkeys/client/ChatUpdate.class b/out/production/infinitymonkeys/client/ChatUpdate.class index a744ba30c58b4856957d67ba89872ac0f378c60c..ee07cffea239793d2817a346c2d881483e820855 100644 Binary files a/out/production/infinitymonkeys/client/ChatUpdate.class and b/out/production/infinitymonkeys/client/ChatUpdate.class differ diff --git a/out/production/infinitymonkeys/client/DrawingUpdate.class b/out/production/infinitymonkeys/client/DrawingUpdate.class index 8e57b9dfaa70a5599502a2b8f80a0df8c68771ea..b9783607ece05565c32f2322ee54b0ccd2433c8e 100644 Binary files a/out/production/infinitymonkeys/client/DrawingUpdate.class and b/out/production/infinitymonkeys/client/DrawingUpdate.class differ diff --git a/out/production/infinitymonkeys/remote/IDrawingController.class b/out/production/infinitymonkeys/remote/IDrawingController.class index 428c6a7f30a57b1c8f31314a1e3e3320ff5c2ee3..d9499ee047ea5e8c51fa56cf7214dc66297d48f5 100644 Binary files a/out/production/infinitymonkeys/remote/IDrawingController.class and b/out/production/infinitymonkeys/remote/IDrawingController.class differ diff --git a/out/production/infinitymonkeys/remote/IDrawingUpdate.class b/out/production/infinitymonkeys/remote/IDrawingUpdate.class index c87eedd773afa0eb339b4384e3912c5d1b60c3bd..325ea2bfdb58dcd9c46fcc8154dd7813c1273038 100644 Binary files a/out/production/infinitymonkeys/remote/IDrawingUpdate.class and b/out/production/infinitymonkeys/remote/IDrawingUpdate.class differ diff --git a/out/production/infinitymonkeys/server/DrawingController.class b/out/production/infinitymonkeys/server/DrawingController.class index 76fe57c3e3a88cdc108af4a06a4266a714cd96fb..5c96d1b716ef926fcaa98beeeb0fd9c8000d43e8 100644 Binary files a/out/production/infinitymonkeys/server/DrawingController.class and b/out/production/infinitymonkeys/server/DrawingController.class differ diff --git a/src/GUI/ChatScreen.form b/src/GUI/ChatScreen.form index 8628672c8b03ba53bb54ae10847a29458c98b80e..e3f201d3c90e8b4e4b755e5dcea6839b10f3df7a 100644 --- a/src/GUI/ChatScreen.form +++ b/src/GUI/ChatScreen.form @@ -20,7 +20,7 @@ <properties/> <border type="none"/> <children> - <grid id="bad73" binding="myAreaPanel" layout-manager="GridLayoutManager" row-count="11" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <grid id="bad73" binding="myAreaPanel" layout-manager="GridLayoutManager" row-count="10" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <margin top="0" left="0" bottom="0" right="0"/> <constraints> <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"> @@ -41,7 +41,7 @@ </component> <vspacer id="38e19"> <constraints> - <grid row="9" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> + <grid row="8" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> </constraints> </vspacer> <component id="98bbe" class="javax.swing.JLabel" binding="yourNameLabel"> @@ -110,7 +110,7 @@ </component> <vspacer id="e9e96"> <constraints> - <grid row="10" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> + <grid row="9" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> </constraints> </vspacer> <component id="deaed" class="javax.swing.JButton" binding="exitThisRoomButton" default-binding="true"> @@ -121,6 +121,24 @@ <text value="Exit This Room"/> </properties> </component> + <grid id="e92cc" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <margin top="0" left="0" bottom="0" right="0"/> + <constraints> + <grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + </constraints> + <properties/> + <border type="none" title="Drawing Users"/> + <children> + <component id="9aa9f" class="javax.swing.JList" binding="list1" default-binding="true"> + <constraints> + <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="2" anchor="0" fill="3" indent="0" use-parent-layout="false"> + <preferred-size width="150" height="50"/> + </grid> + </constraints> + <properties/> + </component> + </children> + </grid> </children> </grid> <grid id="5d886" binding="chatPanel" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> diff --git a/src/GUI/ChatScreen.java b/src/GUI/ChatScreen.java index f07d9ab2557e164ece2dfa7e694febce9a150b13..ef18c62657b4de328d10fcef95faeddde271b028 100644 --- a/src/GUI/ChatScreen.java +++ b/src/GUI/ChatScreen.java @@ -32,6 +32,13 @@ public class ChatScreen { private JPanel managersPanel; private JPanel chatPanel; private JButton exitThisRoomButton; + private JList list1; + + public JTextArea getActiveDrawingUserBox() { + return activeDrawingUserBox; + } + + private JTextArea activeDrawingUserBox; private JFrame frame; public Client getClient() { diff --git a/src/GUI/DrawingArea.java b/src/GUI/DrawingArea.java index 9e80b51cf1442d9f9abde67e9a4a0421a89f932e..15104c82a1e21dd19828885aef8caf32201eab14 100644 --- a/src/GUI/DrawingArea.java +++ b/src/GUI/DrawingArea.java @@ -67,6 +67,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis addMouseMotionListener(this); } + public Shape getDrawing() { return drawing; } @@ -309,6 +310,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis try { drawingController.broadcastDrawing(client.getUserName(), drawing, currentMode.toString(), shapeColor, strokeSize); + drawingController.broadcastDrawingUser(client.getUserName()); } catch (RemoteException ex) { ex.printStackTrace(); } @@ -390,6 +392,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis repaint(); try { drawingController.broadcastDraggingDrawing(client.getUserName(), drawing, currentMode.toString(), shapeColor, strokeSize); + } catch (RemoteException ex) { ex.printStackTrace(); } diff --git a/src/client/ChatUpdate.java b/src/client/ChatUpdate.java index 9447ca5c1f29f9122f1bfdb2eacdc0d538c2995a..45dbd81e9a6cce4ba4dea633d9cdf52e72862fe8 100644 --- a/src/client/ChatUpdate.java +++ b/src/client/ChatUpdate.java @@ -40,6 +40,7 @@ public class ChatUpdate extends UnicastRemoteObject implements IChatUpdate, Seri return true; } + @Override public boolean notifyUserLogin(String fromClient) throws RemoteException { client.getApplicationMain().getChatScreen().getChatDisplayBox().append(fromClient + " has joined the room.\n"); diff --git a/src/client/DrawingUpdate.java b/src/client/DrawingUpdate.java index 43883b2e581f3067691b42ca1d22592a42b8be66..fdbe735452495e39d97ceef892e2d6fb3217ee5d 100644 --- a/src/client/DrawingUpdate.java +++ b/src/client/DrawingUpdate.java @@ -20,6 +20,10 @@ public class DrawingUpdate extends UnicastRemoteObject implements IDrawingUpdate this.client = client; } + public void notifyUserIsDrawing(String fromClient){ + client.getApplicationMain().getChatScreen().getActiveDrawingUserBox().append(fromClient); + } + @Override public boolean notifyTextDrawing(String fromClient, String text, Font font, Point startPoint) throws RemoteException { Graphics2D g2 = client.getApplicationMain().getPaintGUI().getDrawingArea().getG2(); diff --git a/src/remote/IDrawingController.java b/src/remote/IDrawingController.java index 635c490c49e86dd5ee1bee1ed89ca997de08308c..26641bb6320b699a2ff6b6433ad3e60317b2f473 100644 --- a/src/remote/IDrawingController.java +++ b/src/remote/IDrawingController.java @@ -24,6 +24,7 @@ public interface IDrawingController extends Remote { boolean broadcastDrawing(String fromClient, Shape drawing, String mode, Color color, int strokeSize) throws RemoteException; boolean broadcastDraggingDrawing(String fromClient, Shape drawing, String mode, Color color, int strokeSize) throws RemoteException; boolean broadcastClearCanvas(String fromClient) throws RemoteException; + void broadcastDrawingUser (String fromClient) throws RemoteException; ArrayList<Shape> getShapeList() throws RemoteException; ArrayList<Color> getColorList() throws RemoteException; diff --git a/src/remote/IDrawingUpdate.java b/src/remote/IDrawingUpdate.java index 02f17f1e685503799e74e2ca9f3f7d26bdff404d..08347bc0b645269adb3a80c1da1a277f9a39b85d 100644 --- a/src/remote/IDrawingUpdate.java +++ b/src/remote/IDrawingUpdate.java @@ -11,4 +11,5 @@ public interface IDrawingUpdate extends Remote, Serializable { boolean notifyDraggingDrawing(String fromClient, Shape drawing, String mode, Color color, int strokeSize) throws RemoteException; boolean notifyCanvasClearance(String fromClient) throws RemoteException; boolean receiveImage(byte[] rawImage) throws RemoteException; + public void notifyUserIsDrawing(String fromClient) throws RemoteException; } diff --git a/src/server/DrawingController.java b/src/server/DrawingController.java index 15baa53dedd5ef6836f1936bf6786c04fb379df1..1019114a94b2decbc06fe3ebbe0b2248f181cada 100644 --- a/src/server/DrawingController.java +++ b/src/server/DrawingController.java @@ -2,6 +2,7 @@ package server; import GUI.SerializableImage; import client.Client; +import remote.IChatUpdate; import remote.IDrawingController; import remote.IDrawingUpdate; @@ -212,6 +213,16 @@ public class DrawingController extends UnicastRemoteObject implements IDrawingCo return serializableImage; } + public void broadcastDrawingUser (String fromClient) throws RemoteException { + System.out.println("Current client is drawing: " + fromClient); + IDrawingUpdate client; + for (User u: server.users){ + client = u.getIDrawingUpdate(); + client.notifyUserIsDrawing(fromClient); + } + + } + public void getImage(String fromClient) throws RemoteException { // if (serializableImage.getImage().) ByteArrayOutputStream baos = new ByteArrayOutputStream();