Advance Java
School of Science COSC1295 Advanced Programming, S1, 2020 Assignment Part 2: UniLink system - Java FX UI Implementation and Data Persistence Assessment Type: Individual assignment; no group work. Submit online via Canvas → Assignments → Assignment 2. Marks are awarded for meeting requirements as closely as possible according to assignment specifications and the supplied rubric. Clarifications/updates may be made via announcements/relevant discussion forums. Due date: end of Week 13, 23:59pm Sunday 7th June 2020. Late submissions are handled as per usual RMIT regulations - 10% deduction (10 marks) per day. You are only allowed to have 5 late days maximum unless special consideration has been granted. You must demo your assignment via Microsoft Team in Week 14 according to a demo schedule which will be announced later. Weighting: 100 marks (45% of your final semester grade) 1. Overview 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: 1. Enhance your ability to build a Graphical User Interface using JavaFX 2. Practise implementation of various GUI event handlers and handling exceptions 3. Read from and write to a database using Java JDBC technology 4. Incorporate text file handling in your program to import and export data 2. Assessment Criteria 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: · You should aim to provide high cohesion and low coupling as covered in this course. · You should aim for maximum encapsulation and information hiding. · You should take advantage of polymorphism wherever possible when invoking methods upon objects that have been created. · You should rigorously avoid code duplication. · You should comment important sections of your code remembering that clear and readily comprehensible code is preferable to a comment. 3. Learning Outcomes 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. 4. Assessment details General Implementation Requirements · All information displayed to the user and all user interactions must be done via the GUI. · Your GUI must be well structured and well formatted and meet the requirements shown in the following sections. Marks will be deducted for poor GUI designs. · Any user inputs via the GUI should be validated. · Marks will be allocated to proper documentation and coding layout and style. NOTE: To make it faster and easier to build GUI, you are allowed to use JavaFx Scene Builder. https://gluonhq.com/products/scene-builder/ Task Specifications NOTE: Carefully read the following requirements. In addition, regularly follow Canvas assignment discussion board for assignment related clarifications and discussion. Packages and Organisation of Code You must use the following packages to separate your code into sets of related classes and interfaces: · view: contains all your GUI classes. · controller: contains all your listener classes with event handling code. · model: contains the main business logic of your application, all your classes to store and process data (Post, Reply, Event, Sale, Job ...), all exception classes and all database and file handling classes. · main: contains the startup class, i.e. UniLinkGUI.java, which is the main entry point of your application. You can use sub-packages inside the packages shown above. Data Generation 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. Exception Handlings Creating Custom Exception Classes 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. Generating and Handling Exception Objects 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. Using Database For Data Persistence 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 Graphical User Interface (GUI) 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. https://gluonhq.com/products/scene-builder/ Login Window 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: · A text field to allow the user to enter a username to log in. Username requirement is the same as in assignment 1 (for simplicity, no need for password). · Log In button: after entering a valid username, the user clicks this button to log in, this login window will be closed and the main window will appear (see the Main Window section below) This login window must be placed in the centre of the screen. Main Window 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: Menu bar The main window must contain a menu bar with the following two menus: · A menu named Unilink having two menu items: · Developer Information: when user clicks on this menu item, a small window appears in the middle and on top of the main window, showing your student name and student number. User can click a button to close this window and return to the main window. · Quit UniLink: when user clicks on this menu item, your program will stop execution and quit after saving all data to database. Note: if this feature is already supported by default in a JavaFx application, then no need to implement again. You just make sure that when users quit your application, all data is saved to database. · A menu named Data having two menu items: · Export: when user clicks on this menu item, all post and reply data is exported into a single text file · Import: when user clicks on this menu item, he or she can select a text file on your local computer to import post and reply data. (for more information, please see the Using Text Files for Exporting and Importing Data section below) Toolbar The toolbar must allow users to perform the following functionalities: · Create a new post: · you need to include appropriate buttons that user can click on to create new posts of the three types of post (i.e. event, sale and job posts). · When user clicks on one of these buttons to create a new post, your program must display a window containing a form for user to fill in necessary details to create the new event or sale or job post. · Your program must allow the user to browse and select an image from your computer to upload to your program when creating a new post. The image will be saved in the images folder which is a direct sub-folder of your assignment project. · Filtering capabilities: the toolbar must contain the following three drop-down lists to allow the user to filter the list of posts displayed in the centre area in the main window. Details are below: · Filter by type: a drop-down list contains post type, i.e. All, Event, Sale, Job. When user selects an item in the list, the main post list is displayed accordingly. For example, when user selects Event, then only Event posts are shown, when user selects All, then all posts are shown in the list of posts (more details about the list of posts are shown in