JMU CS446 - Software Analysis and Design
Help Policies Solutions Study-Aids Syllabus Tools
Programming Assignment 4


1 Purpose

This assignment has two primary purposes. The first is to implement the functionality associated with closing documents, printing documents, and creating new documents in the application framework. The second is to add functionality to the demonstration application, The Big Pixel, that allows users to set the brusj size, set the brush color, edit documents (i.e., add elements), and control the display.

2 Learning Objectives

This assignment will help you learn about (and demonstrate that you have learned about) printing and mouse events.

3 Starting Point

As in the past, you may start with either your solution with the solution that you were given.

4 Documents

The UML class diagram is available as an SVG file at:

The specifications are available as a PDF file at:

The main class (that can be used for integration testing) is available at:

The use case descriptions that explain how the demonstration application must behave are available at:

5 Tasks

For this assignment you must:
  1. Implement all of the interfaces and classes in the class diagram and specifications document.
  2. Write JUnit tests for many of the classes in the class diagram and specifications document.

6 Testing

Your JUnit test suite must cover 75% of all statements and all branches (as measured by EclEmma) in the various classes other than the AbstractEditableReadingWorker, AbstractModalDialog, BackgroundTaskDialog, BigPixelEditor, GridComponent, PrintImage, ComponentPrinter, and DelegatingPrintable classes. (This includes classes from earlier assignments.) Your tests must be in a package named edu.jmu.cs.academics.testing and each test class must include the word "Test" in its name.

7 Submission

You must submit (using Autolab) a .zip file named pa4.zip that contains:
  1. Your implementation of the required interfaces/classes/enums in the appropriate package(s), including those from previous assignments.
  2. JUnit tests for all of your classes/interfaces.

Do not submit the main class and do not submit any data files.

8 Grading

Your submission will be graded as follows:

9 Help

The following help topics may be useful to you.

9.1 GUI Widgets in a Headless Ennvironment

As you know from an earlier assignment, Autolab runs on a server that does not have a graphical display. Hence, any method you invoke that needs to use a graphical display will throw a HeadlessException. Fortunately, you can construct many GUI widgets without any problem (since they don't use a display until they are added to a "window"). In other words, you can construct, for example, a JCheckBox object and use it in a unit test without causing an exception to be thrown on Autolab.

9.2 Invoking actionPerformed() Methods

You can invoke actionPerformed() methods in unit tests (as long as they don't require a display), you just have to be a little careful when you construct the ActionEvent java.awt.event.ActionEvent that is passed to them. In particular, you have to make sure that the IDs are valid (see the documetation for ACTION_FIRST and ACTION_LAST) and increase with each call.

Copyright 2022