Commit 74ed38ef authored by mohammad.salama's avatar mohammad.salama

Enhancing GUI

parent a0b67fd8
......@@ -6,8 +6,6 @@
<component name="ChangeListManager">
<list default="true" id="71bec43c-ef6e-431f-a77c-2b7f124f5fea" name="Changes" comment="printing Done">
<change beforePath="$PROJECT_DIR$/../ChatServer/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatServer/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatServer/src/main/java/IClientChat.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatServer/src/main/java/IClientChat.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatServer/src/main/java/IServerChat.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatServer/src/main/java/IServerChat.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatServer/src/main/java/ServerChatImp.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatServer/src/main/java/ServerChatImp.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
......@@ -37,16 +35,16 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"UI_DESIGNER_EDITOR_MODE.PaletteManager.WIDTH": "132",
"last_opened_file_path": "D:/HIAST/FIY/FS/Distributed Systems/Lab/3/HW/ChatClient"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;UI_DESIGNER_EDITOR_MODE.PaletteManager.WIDTH&quot;: &quot;132&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/HIAST/FIY/FS/Distributed Systems/Lab/3/HW/ChatClient&quot;
}
}]]></component>
<component name="RunManager" selected="Application.Client1">
}</component>
<component name="RunManager" selected="Application.Client3">
<configuration name="Client1" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="ChatClient" />
<module name="ChatClient" />
......
......@@ -33,7 +33,7 @@ public class ClientChatImp extends UnicastRemoteObject implements IClientChat
//System.out.println(Message);
// this.myChatsAndRooms.receiveMsg(Message , roomName , this);
System.out.println("RECEIVING");
this.messagesInChat.get(roomName).receiveMsg(Message);
if (this.messagesInChat.containsKey(roomName)) this.messagesInChat.get(roomName).receiveMsg(Message);
///System.out.println(Message + " in Room : " + roomName);
return Message;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="CreatingChatRoom">
<grid id="27dc6" binding="CreateChatRoom" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="CreateChatRoom" layout-manager="GridLayoutManager" row-count="3" 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>
<xy x="20" y="20" width="500" height="400"/>
......@@ -26,6 +26,14 @@
<text value="Create"/>
</properties>
</component>
<component id="ed18f" class="javax.swing.JButton" binding="GoMain">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Return to main page"/>
</properties>
</component>
</children>
</grid>
</form>
import org.example.Main;
import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.rmi.MarshalledObject;
import java.rmi.RemoteException;
public class CreatingChatRoom extends JFrame {
private JPanel CreateChatRoom;
private JTextField ChatRoomName;
private JButton submit;
private JButton GoMain;
public CreatingChatRoom(ClientChatImp clientChatImp) {
setSize(600 , 600);
......@@ -53,6 +51,17 @@ public class CreatingChatRoom extends JFrame {
}
}
});
GoMain.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
try {
doit(clientChatImp);
} catch (RemoteException ex) {
throw new RuntimeException(ex);
}
}
});
}
public void doit(ClientChatImp clientChatImp) throws RemoteException {
MainPanel myChatRooms = new MainPanel(clientChatImp);
......
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="DeletingChatRoom">
<grid id="27dc6" binding="DeletingChatRoom" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="DeletingChatRoom" layout-manager="GridLayoutManager" row-count="3" 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>
<xy x="20" y="20" width="500" height="400"/>
......@@ -26,6 +26,14 @@
<text value="Delete Room"/>
</properties>
</component>
<component id="30e68" class="javax.swing.JButton" binding="GoMain">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Return to main page"/>
</properties>
</component>
</children>
</grid>
</form>
......@@ -7,6 +7,7 @@ public class DeletingChatRoom extends JFrame{
private JTextField ChatRoomName;
private JPanel DeletingChatRoom;
private JButton Delete;
private JButton GoMain;
public DeletingChatRoom(ClientChatImp clientChatImp)
{
......@@ -51,6 +52,17 @@ public class DeletingChatRoom extends JFrame{
}
}
});
GoMain.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
try {
doit(clientChatImp);
} catch (RemoteException ex) {
throw new RuntimeException(ex);
}
}
});
}
public void doit(ClientChatImp clientChatImp) throws RemoteException {
MainPanel mainPanel = new MainPanel(clientChatImp);
......
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="JoiningChatRoom">
<grid id="27dc6" binding="JoiningChatRoom" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="JoiningChatRoom" layout-manager="GridLayoutManager" row-count="3" 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>
<xy x="20" y="20" width="500" height="400"/>
......@@ -26,6 +26,14 @@
<text value="Join Room"/>
</properties>
</component>
<component id="ebcb9" class="javax.swing.JButton" binding="GoMain">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Return to main page"/>
</properties>
</component>
</children>
</grid>
</form>
......@@ -7,6 +7,7 @@ public class JoiningChatRoom extends JFrame{
private JPanel JoiningChatRoom;
private JTextField ChatRoomName;
private JButton Join;
private JButton GoMain;
public JoiningChatRoom(ClientChatImp clientChatImp)
{
......@@ -51,6 +52,17 @@ public class JoiningChatRoom extends JFrame{
}
}
});
GoMain.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
try {
goBack(clientChatImp);
} catch (RemoteException ex) {
throw new RuntimeException(ex);
}
}
});
}
public void goBack(ClientChatImp clientChatImp) throws RemoteException {
MainPanel mainPanel = new MainPanel(clientChatImp);
......
......@@ -32,7 +32,7 @@ public class LogIN extends JFrame{
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
boolean can = (Password.getText().isEmpty());
if (!can)
if (can)
{
//UserName.setText("Cannot Be Empty");
Password.setText("Cannot Be Empty");
......
......@@ -5,21 +5,15 @@
</component>
<component name="ChangeListManager">
<list default="true" id="23a09f69-45e8-4607-a94c-253a284a386d" name="Changes" comment="ChatServiceFirst5">
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/LogIN.form" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/LogIN.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/LogOut.form" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/LogOut.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/MainPanel.form" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/MainPanel.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/MessagesInChat.form" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/MessagesInChat.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/MyChatRooms.form" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/MyChatRooms.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/ChatClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/ChatClient.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/ClientChatImp.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/ClientChatImp.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/IClientChat.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/IClientChat.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/IServerChat.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/IServerChat.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/CreatingChatRoom.form" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/CreatingChatRoom.form" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/CreatingChatRoom.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/CreatingChatRoom.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/DeletingChatRoom.form" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/DeletingChatRoom.form" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/DeletingChatRoom.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/DeletingChatRoom.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/JoiningChatRoom.form" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/JoiningChatRoom.form" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/JoiningChatRoom.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/JoiningChatRoom.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../ChatClient/src/main/java/LogIN.java" beforeDir="false" afterPath="$PROJECT_DIR$/../ChatClient/src/main/java/LogIN.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......
......@@ -59,6 +59,10 @@ public class ServerChatImp extends UnicastRemoteObject implements IServerChat
&& ChatRoomsOwners.get(roomName).equals(iClientChat))
{
ChatRoomsOfUser.get(iClientChat).remove(roomName);
for (IClientChat iClientChat1 : ChatRoomMembers.get(roomName))
{
ChatRoomsOfUser.get(iClientChat1).remove(roomName);
}
ChatRoomMembers.remove(roomName);
ChatRoomMessages.remove(roomName);
System.out.println("Deleted");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment