Graphical user interfaces
For this assignment, you will build a graphical user interface to attach to the electronic store model that you have developed over the previous two assignments. You can use your own model classes from the previous assignment, or you can download the model classes included within the zip file on the assignment page and incorporate those into your IntelliJ project as a starting point. You should ensure you understand the Model/View/Controller paradigm before beginning the assignment. Your assignment must maintain a separation between the GUI and the underlying electronic store model. You must also continue to apply the principles of OOP, such as encapsulation. A recording showing a demonstration of how the GUI should work is included on the assignment page.
1. The GUI
An example of what the graphical user interface window should include is given in the picture below. The code for this view should be created in a class called ElectronicStoreView. You should make the GUI window non-resizable. The ratio of the window width/height should be approximately 2:1 (e.g., 800 wide, 400 high). It does not have to look exactly as the picture but should closely match.
2. When the Application Starts
Create a class called ElectronicStoreApp, which will represent the controller component of your program. This class should extend from the JavaFX Application class. When the application starts, your controller should create an instance of ElectronicStore, as well as an instance of your view defined in part 1. To create the ElectronicStore instance, you must use the static createStore() method from the ElectronicStore.java file included on the assignment page and save the returned ElectronicStore instance in a variable within the ElectronicStoreApp. If you are using your own code as a base, you can copy/paste the createStore() method from the example. The ElectronicStore instance will represent the model that the GUI application will interact with.
When the application starts, the window title must include the name of the store. The ‘Add to Cart’, ‘Remove from Cart’, and ‘Complete Sale’ buttons should initially be disabled. The ‘# Sales’, ‘Revenue’, and “$ / Sale” TextFields should be initialized to default values representing the starting state of an electronic store. The store stock ListView should display all the items currently in stock within the electronic store model. The most popular items ListView should show 3 products that exist in the store’s stock. At this point, all products will have an equal popularity since no sales have taken place. The image below shows an example of what the initial window should look like:
3. Event Handling
You must add event handling to the ElectronicStoreApp class to meet the requirements outlined below.
Most Popular Items:
1) When the ‘Reset Store’ button is clicked, the model should be reset to its initial state (i.e., the electronic store model should be recreated). The GUI should also update to show the reset state of the store.
For solution, connect with our online Professionals.