COSC1295 Advanced Programming, S1, 2020 School of Science RMIT University
You are required to use Java SE and JavaFX to develop a Graphical User Interface (GUI) for the UniLink system created in Assignment 1.
This is an individual assignment. Group work is not allowed.
This assignment is designed to help you:
This assessment will determine your ability to implement Object-Oriented Java code according to a written specification and incorporating specific design patterns. In addition to functional correctness (i.e. getting your code to work) you will also be assessed on code quality. Specifically:
This assessment is relevant to the following Learning Outcomes:
CL01: use the Java programming language in the implementation of small to medium sized application programs that illustrate professionally acceptable coding and performance standards.
CL02: demonstrate knowledge of the basic principles of the object oriented development process and apply this understanding to the analysis and design of solutions for small to medium scale problems.
CLO3: describe and apply basic algorithms and data structures, in particular simple searching and sorting of data stored in data structures and manipulating data.
CLO4: implement basic event-driven programming and graphical user interfaces using Java.
To make it faster and easier to build GUI, you are allowed to use JavaFx Scene Builder.
NOTE: Carefully read the following requirements. In addition, regularly follow Canvas assignment discussion board for assignment related clarifications and discussion.
You must use the following packages to separate your code into sets of related classes and interfaces:
You can use sub-packages inside the packages shown above.
You are require to generate data for 6 posts, including 2 event posts, 2 open sale posts and 2 open job posts. Each event, sale and job post has two replies with responder id of your choice, and reasonable offer values for the sale and job posts.
For this assignment, each post must have a corresponding image, which should have a moderate size (from 100KB to 250KB). You must keep all images in a folder named images which is a direct sub-folder of your assignment project. If a post has no corresponding image, a default image with the phrase "No Image Available" should be used (please see this example).
This data must not be hard-coded into your program. You must store this data in a database in advance and when your program is running, this data must be read from database. See the section Using Database For Data Persistence below for more details.
You are required to create at least three exception classes such as PostNotFoundException, PostClosedException,
InvalidOfferPriceException… or any other custom exception class suitable for your application to represent various exceptional cases that can occur when your program executes. All those custom exception types should allow appropriate error messages to be specified when exception objects are created.
To apply the custom exceptions in your program, you will need to look for areas in your program where you need to handle various cases such as when there is an invalid post id, or when a post is already closed or when there is an invalid user input… Then you should generate appropriate exception objects, throw and catch those exception objects correctly in your code.
All exceptions need to be caught and handled in an appropriate manner. Users should be able to see the error messages encapsulated in exception objects. In a GUI application, error messages must be shown to the users using dialog boxes. Your program must not show exception message in the console.
Every time your program is executed and terminated, data must be read from and save to a database. For this assignment, you must use an embedded HSQLDB (shown in the lecture) or SQLite database. You must keep all database files in a folder named database which is a direct sub-folder of your assignment project.
Your database must contain at least two tables, one table to store post information and another table to store replies information. It's not enough to just simply store the output of the toString methods of a post object or reply object. You must not store binary data directly in database. You need to create tables with multiple columns having appropriate data types (i.e. text and numerical data types) that are suitable for storing data in your application.
NOTE: No need to store images directly in the database. Only image file names should be stored as text in the database. Each image file name corresponds to an image file kept in the images folder which is a direct sub-folder of your assignment project.
For instructions about using HSQLDB with Eclipse, please visit this page https://tinyurl.com/y7hty8tg
All user interaction with the UniLink system must be done via the GUI. Implementation requirements for each component of the GUI are described below:
NOTE: To make it faster and easier to build GUI, you are allowed to use JavaFx Scene Builder.
This login window is the first window to appear when your program is executed. This window will reappear when users log out of the main window (more in Main Window section below).
The login window must contain the following components:
This login window must be placed in the centre of the screen.
See the image below for a suggestion about the components of the main window. For more information, please read the assignment specification carefully. https://drive.google.com/file/d/1_gj9XGLzJPXkYJoqS13RK_rAUD9WLnpi/view?usp=sharing
The main window must have the following components:
The main window must contain a menu bar with the following two menus:
(for more information, please see the Using Text Files for Exporting and Importing Data section below)
The toolbar must allow users to perform the following functionalities:
Centre area of the main window
The user id of the currently logged in user must be displayed at the top of the centre area so we know which user is currently logging in.
The centre area of the main window must contain a scrollable list of posts managed by your program. In this list, each post is displayed as a list item.
Each list item must contain the following information:
Note: post replies must not be displayed in the main window. Post replies must be displayed in the post detail window. Only the creator of a post can view replies to that post.
To display post details in the GUI, you must use JavaFX User Interface Controls such as ImageView, Label, Buttons…, rather than just a text area showing the output of the getPostDetails() method.
See the image below for a suggestion about the components of the post detail window. For more information, please read the assignment specification carefully. https://drive.google.com/file/d/1qAtYKlvrAGm-3_wFz_M7W1leuSX7smTc/view?usp=sharing
Only the creator of a post can open this window to see more details about the post, including all replies to that post. If there is no reply, then the post creator is allowed to edit his or her post details. If there is one or more replies, then the post creator is no longer allowed to edit any post detail.
Edit post details
In this post detail window, all post details are displayed, including a larger image associated with the post. If there is no reply, your program must enable the post creator to edit post details (post id should not be editable) and upload another image which will replace the existing image. After the post creator finishes editing, he or she can click a Save button, and all details will be saved. If there is one or more replies, it means that responders have given replies based on existing details and the post creator is no longer allowed to edit any post details.
The post creator must be able to view all replies to the post in this post detail window
There must be a button to allow the creator to close the post. If a post is closed, it is no longer possible to re-open it.
There must be a Delete button to allow the creator to delete the post. If the creator clicks this button, a confirmation dialog box is displayed.
Back to main window
The post detail window must have a button to allow the post creator to go back to the main window. When the post creator clicks on this button, the post detail window is closed and the main window is reopened.
○ Note: it is acceptable to have some database log messages or JavaFx messages in the Console. But error messages related to your program must be displayed in the GUI.
Your UniLink GUI program must contain Export Data and Import Data menu items in the main menu bar to allow users to:
You are free to choose your own format of the data file, as long as all data can be exported in a single text file and imported from a text file following your own data format.
When the user selects the Export Data menu item, your program should export all data to a single text file named export_data.txt, which will be saved in a folder chosen by the user. (Hint: this feature can be implemented in your GUI program by using the DirectoryChooser class in the javafx.stage package).
When the user selects the Import Data menu item, your GUI program must display a FileChooser window (hint: FileChooser class is located in the javafx.stage package) to allow the user to select a text file with the same format as your exported data file. Your program must be able to read post and reply data from that text file. If a post has no corresponding image, a default image with the phrase "No Image Available" should be used.
NOTE: You don't need to export images. All images will still be kept in the images folder in your assignment project. Only image file names should be exported to the text file.