To design and implement a limited form of social network application.
This README file has to be submitted under the Documentation of our project.
This document will include the following for each class:
- A detailed description.
- Descriptions of the testing done on that class. For GUI testing, provide step-by-step guidance on the tests performed.
In situation where the user needs to select a line and engage action, the below prompt will appear if they don't
In situation where the user needs to input info for account or profile, something like the below prompt will appear if they input something invalid
Run the program by first running profileServer.java, then profileClient.java. The login GUI should pop up if everything is working. If profileClient.java cannot connect, check the socket id and port numbers.
JTable does not update itself unless the user performs any functionality. Users may need to press the back button to "Refresh" the frame in order to see new changes.
This is a class representing the frame that gives users the option to either edit, or delete their accounts. The above mentioned functions are accessed through the use of buttons.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method sets up the appearance of the frame
- Pressing "Edit Acoount" button will take the user to EditProfileFrame
- Pressing "Back" button will take the user to AccountProfileFrame
- Pressing "Delete Account" button will prompt this message below and delete the profile
A class representing the frame that serves as an intermediary for creation, edition, and deletion of both user account and profile. When the user wants to edit or delete their account, they can click "Account" button and vice versa for their profile.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method sets up the appearance of the frame
- Pressing "Profile" button will take the user to ProfileMenuFrame
- Pressing "Back" button will take the user to UserFrame
- Pressing "Account" button will take the user to AccountMenuFrame
The constructor of AccountMenuFrame which uses two parameters : socket, the socket that connects this local machine with the server, and userId, the userId of the login user.
A class representing the frame to send friend requests to another users, view a list of all the application's users, search a specific user among all the application's users, view the requested friend list and the pending friend list. Three JScrollPane, each contains a JTable. The center one would have a table that contains all users where you can choose users to send friend request. The left one would have a table that record all users which you have sent request to but not get respond. You can choose to resend request. The right one would have a table that contains all users which have sent you a request. You can either accept or deny
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method set up the appearance of the frame
- Selecting "viewProfile" button will take the user to ProfileDisplayFrame of that user
- Pressing "Back" button will take the user to UserFrame
- Pressing "sendFriendRequest" button will make current user appear on the pending list of the requested user, while the requested user will apeear on current user's requested list
- Pressing "accept" button will make accepted user appear on current user's friendlist
- Pressing "deny" button will make the denied user disappear from the pending list
- Pressing "resendRequest" button will make current user reappear on requested user's pending list
Step by step Test
Pending Table
If Deny
If Accept
This prompt comes up
Derek will be added to friend list
The constructor so that socket and the login userId can be passed. Two parameters: socket and userId.
Communicates with the server to get most updated user list
Communicates with the server to get the updated user info in the pending list
Communicates with the server to get the updated user info in the request list
Updates the data by changing the model of all three tables. Resets the rowSorter to make sure the search bar keep working. Then repaints the JFrame addFriendFrame
A class representing the frame to edit the user account details. Users can change their name, email address, and password but not the user ID. All the changed account details must conform to the respective validation rules.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method sets up the appearance of the frame
- Pressing "editAccountButton" button will reset user's account info with input
- Pressing "Back" button will take the user to AccountMenuFrame
Step by step Test
Let's delete Joshua's account
First login in as Joshua, id = joshua, password = Cs180===
Delete successfully !
Using the same userID and password, we can't no longer login as Joshua
Let's edit Leo's account
His account before edit was passowrd: Cs180=== Name: Leo Li email: [email protected]
Edit leo's account info as: password: Cs280=== Name: Leo La email: [email protected]
Now we see the changes as another user
Leo has to login with password Cs280=== instead of Cs180=== from now on
#### Class Documentation ##### public EditAccountFrame(Socket socket, String userId) Constructor The constructor of UserFrame which uses two parameters : socket, the socket that connects this local machine with the server, and userId, the userId of the login user. ##### contentCheck() method Checks inserted information to make sure it doesn't contain forbidden characters.A class representing the frame to edit the details of the user profile. All the changed profile details must conform to the respective validation rules.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method sets up the appearance of the frame
- Pressing "editProfileButton" button will reset user's profile info with input
- Pressing "Back" button will take the user to ProfileMenuFrame
Step by step Test
Test by editing Derek's profile which was blank
Viewing Derek's profile as another user
It's just as how Derek edited it
Let's delete Derek's profile now
Looking at Derek's profile as another user, Derek's profile became blank again
#### Class Documentation ##### public EditProfileFrame(Socket socket, String userId) Constructor The constructor of EditProfileFrame which uses two parameters : socket, the socket that connects this local machine with the server, and userId, the userId of the login user. ##### contentCheck() method Checks inserted information to make sure it doesn't contain forbidden characters and that it isn't empty.A class representing the frame that will appear at the very beginning when the user starts the application. Users will be able to login using their User ID and Password. Note that users need to first register to be able to log in.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method sets up the appearance of the frame
- Pressing "loginButton" button will take the user to UserFrame if login was succesful, if not below
- Pressing "registerButton" button will take the user to RegisterFrame
The constructor of LoginFrame which uses one parameter : socket, the socket that connects this local machine with the server.
A class representing the profile of the registered user.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
public Profile(String phoneNumber, String relationship, String gender, String currentOccupation, String interest, String aboutMe) Constructor
Constructor for the Profile class. Creates a new Profile with the provided data.
Class includes getters and setters for each of the fields.
A class representing the client-side of our application. This class includes the main method and invokes the Login frame of our application when begin.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
The main method of our program. Initializes the hostname with "localhost" and port number with 1112. Starts by invoking a LoginFrame in the Event Dispatch Thread.
A class representing the profile details of the user in a separate frame. Profile details include: Phone Number, Current Occupation, About Me, Interests, Gender, and Relationship Status
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method sets up the appearance of the frame
- Pressing "Back" button will take the user to UserFrame or AddFriendFrame depending the current frame the user's at
public ProfileDisplayFrame(Socket socket, String viewerId, String profileOwnerId, String tracker) Constructor
The constructor of ProfileDisplayFrame which uses four parameters : socket, the socket that connects this local machine with the server, viewerId, the userId of the viewer, profileOwnerId, the userId of the owner of this profile, and tracker, the tracker that tracks the user.
A class representing the frame that gives users the option to either create, edit, or delete their profiles. This class cts as a hub hosting buttons that leads users to other frames that carry out creation, edition, or deletion.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method set up the appearance of the frame
- Pressing "Back" button will take the user to AccountProfileFrame
- Pressing "editProfileButton" button will take the user to EditProfileFrame
- Pressing "deleteProfileButton" button will prompt a comfirmation message, if the user chose yes then its profile info will be reset to blank
Delete empty profile Test Step by step
Jason has an empty profile
Let's delete the empty profile
An error occurred, we can't delete an empty profile
The constructor of EditProfileFrame which uses two parameters : socket, the socket that connects this local machine with the server, and userId, the userId of the login user.
A class representing the backend server-side of our application. All the processing of data, connecting to the client, and file I/O happens here.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
The constructor of ProfileServer which uses one parameter : socket, the socket that connects this computer connect with the server.
Check the username and password to see if the user logs in. Returns true if the user entered username and password are correct, false otherwise.
Returns the Profile that matches with the given userId parameter
Sets the userProfile up with the inserted userId. Return true if setup is successful, false if userId is not found in the database.
Sends out a friend request to the reciever using userId as a guide. Returns "RequestSuccess" if the request was successful; "Already friend!" if in each other 's friendList already; "Already requested!" if requested user is in requester's requested list; "Already being requested!" if the requested user has already sent a request to requester.
Deletes a friend in user's friend's list and removes user from the deleted friend's friends list. Return true if the deletion is successful, false otherwise.
Checks to make sure every phone number registered is unique. Returns true if the phone number is unique, false if it has been used.
Checks if the given parameter userId is unique in the database. Returns true if userId is unique, false otherwise
Accepts the request in pending list, add to each other's friendList, and remove from pending and requested list. Return "AcceptSuccess" if there is an request and are accepted successfully; "No request found" if there are no request; "No such user found" if Ids cannot be found.
Denies the request in pending list and deletes history in pending and requested list. Return "DenySuccess" if there is an request and deny successfully; "No request found" if there are no request; "No such user found" if Ids cannot be found.
Checks if the request has been sent. If not, resend request; if sent, asks the user to be more patient. Return "RequestExisted" if the request is in the user's pending list; "ResendSuccess" if there is no request and the request is resend; "No such user found" if Ids cannot be found.
Starts whenever a new socket is accepted. Creates a printWriter and a bufferedReader. Uses a switch statement to perform different tasks required by the client.
A class representing the frame that allows the users to register for this application. All users must register before being able to login to the application. All the account details must conform to the respective validation rules.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method set up the appearance of the frame
- Pressing "Back" button will take the user to LoginFrame
- Pressing "registerButton" button will save the user's input and create a new User object for it if the inputs are valid, if not below
A class representing the user who will be registering to use our application.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
Creates a User object with the specified parameters. Three empty arraylist and a profile with empty string would be constructed/initialized.
Class also contains getters and setters for fields userId, password, name, email, friendList, and userProfile.
A class representing the frame displaying the friend list of the user in the application. The user is able to see the profile of users in the friend list and delete them from the friend list. Use a JTable to display all your friends and a search bar to find certain friends.
- Tested that the class exists and inherits or implement the correct classes
- Tested that all fields exist, and are of correct type and modifiers
- Tested that all methods exist, and have the correct return type and modifiers
- Two implementation tests to test if each method work with correct input and fails with incorrect input.
This method set up the appearance of the frame
- Pressing "Back" button will take the user to LoginFrame
- Pressing "add" button will take the user to AddFriendFrame
- Pressing "account" button will take the user to AccountProfileFrame
Step by step Test
Search Bar Testing
Before search
After search, the id that matches remains, the rest disappear
Delete Friend Test step by step
Log in as Derek and delete Jason
Jason disappears from friendlist
Derek disappears from Jason's friendlist
The constructor of UserFrame which use two parameters : socket and userId. socket: the socket that connect this computer connect with the server. userId: The userId of the login user
Communicates with the server and get the updated userInfo in the login user's friendList