Description

In this assignment, create a non-distributed Message Browser application in Java that utilizes the instructor provided Swing GUI. The Message Browser is a collection of Message objects. You are to create a Message class, that serializes/deserializes to/from a text file containing Json. The user interface provides the ability for browsing messages that are in the collection. In this case, the json file contains sample mail messages addressed to you. Your file should have atleast 4 messages.

The browser's constructor should read in the file initializing the message list (messageListJL) to include each message heading. Your message class should include a constructor to initialize a message object from a JSONObject, and another method to export a message object to a JSONObject. Be sure to include an appropriate initialization file with the solution you submit.

The user interface for client is provided in the example assign2WebDist.jar. It includes and Ant build file that will compile and execute a sample client. It also includes javadocs for the instructor provided MessageGui class. An example project that demonstrates serialziation to/from Json for both C++ and Java is provided in the example groupJson.jar.

Below is a view of the MessageGui. You are free to use this user-interface, or create your own. Should you create your own, you must use Java Swing, and incorporate the same controls and actions defined in this GUI see image.

In summary, create a stand-alone Message Client application, using Java. Your application should initialize a message library from a Json file, and have the ability to select, remove, and add (use the send text button) messages. Future assignments will enhance this solution by providing a Message Server and connecting the client to the server to replace the initialization json file.

Functionality. Here is an explanation of the functionality that your application should provide, together with a description of how users should interact with your GUI control logic.

Your application can assume that all users will only use the GUI as it is designed to be used. That is, you do not need to validate user inputs.

The fields on the right side of the Message Gui are used to compose messages. Message menu items (or buttons) are used to send a message. The Message actions the following:

  • Message List Item Selection - (required functionality) Displays information about the newly selected message in the message list.
  • Delete - (required functionality) Removes the message that is currently selected in the message list.
  • Reply - (required functionality) Switches the right panel fields from display to compose. Swaps the to and from fields, pre-pends Re: to the Subject field and modifies the message content text area to allow new text to be entered before the old message.
  • Reply - (required functionality) Switches the right panel fields from display to compose. Swaps the to and from fields, pre-pends Re: to the Subject field and modifies the message content text area to allow new text to be entered before the old message.
  • Send Cipher - (required in a future assignment, not this one) Uses the appropriate remote method to send a cypher text to the Message Server as indicated by the To field. The cipher text should be handled by both the sender and receiver using password based encryption. You should encrypt/decrypt a string that consists of the From, Subject and message content fields in that order separated by ^ (up-arrow) characters. Up-arrow cannot appear in the from or subject fields.

The Message Library Interface

To make future assignments easier, your solution should include two classes for the underlying application Model: Message, and MessageLibrary. These classes should have constructors for JSONObject, and a method to export and object's state to JSONObject. Your MessageLibrary class should also support the following methods:

// do not implement sendClearText in Assign2.
public boolean sendClearText(Message aMessage, String fromUser);

// do not implement sendCipher in Assign2.
public boolean sendCipher(Message aMessage, String fromUser);

// getMessageFromHeaders returns a string array of message headers being sent to toAUserName.
// Headers returned are of the form: (from user name @ server and message date)
// e.g., a message from J Buffett with header: Jimmy.Buffet Tue 18 Dec 5:32:29 2018
public String[] getMessageFromHeaders(String toAUserName);

// getMessage returns the Message having the corresponding header. Assume headers are unique.
// As above, the header has includes (from user name - server and message date)
public Message getMessage(String header);

// deletes the message having the header (from user name - server and message date)
public boolean deleteMessage(String header, String toAUserName);

Your application's model may implement these methods to receive new messages. As appropriate, add messages to the list. When the user selects the new message from the list, your program should display details of the message in the appropriate fields.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.