At this stage, the account-, item-, and user-related classes should be compiled and tested using JUnit,
as the server-side implementation has not yet been completed.
The GUI can be run directly from the editor.
Phase 1 submission - Huy Nguyen, Yuna Lee
This section includes Account.java, AccountService.java, and their related interfaces: UserInfo.java and AccountManager.java.
-
Account.java: A data class that stores user information (username, password, and ratings), implementing the UserInfo interface. It is used by AccountService.java to manage account operations.
-
AccountService.java: This class handles all account-related logic and data persistence, implementing the AccountManager interface. It supports creating, logging in, and deleting accounts. The class is thread-safe (synchronized) and ready for use in a multi-client server environment.
-
AccountTest.java: A test class that verifies all getter and setter methods in Account.java function correctly.
-
AccountServiceTest.java: A test class that confirms the functionality of account creation, login, deletion, duplicate prevention, and data persistence. It uses a test-specific file (test_accounts.txt) to isolate testing from the main account data.
- Item.java: Interface that sets operations for item listing, includes setter and getter methods for name, category and price. It also creates the ability to mark items as sold and create and delete listings.
- Searchable.java: Interface that defines the methods for searching items by name, category, or seller. The ItemsRelated.java class implements this.
- ItemsRelated.java This class implements the Item and Searchable classes. It includes the creation and deletion of items as well as marking items as sold. It also includes searching items by their name, catergory, or seller.
- ItemsRelatedTest.java A test class that confirms the functionality of creating and deleting a listing and marking a listing as sold.
This section includes UserFeatures.java, Itemsrelated.java, and the related interfaces: Payment.java, Messaging.java, TransactionHistory.java, Searchable.java, Item.java, and Confirmation.java.
-
UserFeatures.java: A class that manages user functionalities such as handling balance (add and process payments), messaging (send and receive), listing and marking items as sold, and searching items by name or category. It implements multiple interfaces to support modular behavior: Payment, Messaging, TransactionHistory, Searchable, and Confirmation. The class also supports persistence by allowing user data to be saved to and loaded from a file.
-
Itemsrelated.java: A data class representing an individual item in the marketplace, storing attributes such as name, category, price, and sold status. It provides methods to update item information and to delete a listing.
-
Payment.java: An interface for payment functionality. It defines methods for processing a payment, adding funds to a user’s balance, and retrieving the current balance. Implemented in UserFeatures.java.
-
Messaging.java: An interface that provides methods for sending and receiving messages between users. Helps simulate basic communication functionality. Implemented in UserFeatures.java.
-
TransactionHistory.java: This interface defines a method for retrieving a list of previously sold items, formatted as strings. Used to track a user’s selling history. Implemented in UserFeatures.java.
-
Searchable.java: An interface that defines methods for searching items by name, category, or seller. It is implemented by UserFeatures.java, allowing users to perform searches across their listed items.
-
Confirmation.java: A small utility interface used to return formatted confirmation messages for completed actions. Ensures consistent feedback is given after operations like sending a message or listing an item.
-
Item.java: This interface defines the basic structure and behaviors required for any item listed on the marketplace platform. It provides getter and setter methods for the item’s name, category, and price, and includes status tracking through the isSold() method.
-
RunLocalTest.java: A test class that validates key functionalities of UserFeatures.java and Itemsrelated.java. It tests payment processing, messaging, item listing/searching, item selling, and data persistence. The tests use JUnit and include output capture to verify printed messages.
This section includes GUISample.java
- GUISample.java: handles both buyer and seller flows using Java Swing components.
All features are static methods and are launched based on interactions with previous methods
Buyer methods (currently):
-
openBuyerWindow() – Buyer menu with buttons for login, account creation, and deletion
-
openLoginWindow() – Buyer login form with username and password fields
-
openSignUpWindow() – Buyer sign-up form with email, username, password, and validation
-
openDeleteAccountWindow() – Buyer account deletion (username + password)
Seller Functionality (currently):
-
openSellerWindow() – Seller menu with options for login, account creation, and deletion
-
openSellerLoginWindow() – Login form for sellers
-
openSellerSignUpWindow() – Sign-up form with full validation
-
openSellerFeaturesWindow() – Dashboard menu with access to seller-specific features:
Create listings, Delete listings, View balance, ratings, sold items, and messages
- openCreateListingWindow() – Form for creating a new product listing with image upload
The openCreateListingWindow() method includes functionality for image uploading:
Sellers can click a "Upload Image" button, A JFileChooser dialog opens to browse for image files. Once an image is selected, it is previewed inside the listing creation window using an appropriately scaled ImageIcon
-
openDeleteListingWindow() – Table layout showing listings with image, name, type, quantity, price, and a delete button aligned correctly
-
openListingDeleteConfirmation() – Confirmation dialog to finalize listing deletion
Key components (like menus and listing cards) use a card-style layout with:
-
CompoundBorder: a light gray outer line + inner padding
-
Consistent spacing using EmptyBorder and Insets
Buttons are styled with flat colors to indicate purpose:
-
Blue for actions (e.g., "Log In")
-
Green for positive actions (e.g., "Sign Up")
-
Red for destructive actions (e.g., "Delete")
Fonts are standardized using "SansSerif" with clear hierarchy in sizes
This section includes SearchOperation.java, SellerOperate.java, Seller.java:
- SearchOperation.java: Search Item is a class that could search items in three ways: names, category, and seller. also, a getItemDetails method is included in the class, which could provide details of item as the outcome of search.
- SellerOperate.java: This class include basic operations of a seller, including begin/delete/end/updates the information of an item. Also, seller could view rating.
- Seller.java: basic seller class, which extends from account, but has ability to view items and earns.
- SellerOperationTest.java: the testing program of SellerOperation, including all seller operations (operations on items, and check rate) test.
- SearchOperationTest.java: the testing program of SearchOperation, including all search operations (different way of search) test.
Checking possible problems might caused by server and thread, including thread crush, IO exceptions. Adding sychronized to fix the problem. Variable and function names are unchanged.