$Revision: 616 $
$Date: 2011-05-06 11:11:48 +1000 (Fri, 06 May 2011) $
Due week 11: at 1 minute to 12 midnight (11:59pm) on Sunday 22 May 2011.
Hints and FAQ (available later)
This assignment is to be done individually. You must submit individual work.
You are encouraged to start work in pairs or larger work groups if this works for you: but only to explore initial understanding of the problem and the concepts of the solution. You can work together at the level of sketch diagrams, and verbal explanations. You must not share or work on programming code with any other person. You must not make use of the work of previous students.
The purpose of doing this assignment is to develop your programming skills and understanding of an existing program, and also to help to prepare you for the practical exam. The programming skills include: how to find your way around the Java APIs, how to develop Java coding for algorithms and data structures, how to develop and debug small changes to programs; and how to program and debug GUI controls.
This assignment is worth 15 percent of the course (comp2100, other courses differ): this equates to roughly 15 hours work. Over 2.5 weeks at your expected minimum time of 10-12 hours per course you can plan your activities to have this much effective time, plus an allowance of 50% more (typical overrun time).
This next stage of the Gaga project is to build a graphical
user interface for viewing SVG documents.
A prototype is provided. It is extended from the version provided for assignment 1.
The program uses a Model View Controller architecture with the
display of the SVG image embedded into a window where it is easy to
place control widgets.
The Model is the SVG abstract parse tree, the View is created by a tree visitor
that calculates how to insert text in the correct layout into a
TextPanel.
The prototype has an effectively empty Controller. At present it has
no actions that change the Model.
The base distribution source code is in the SVN repository (see below, Getting Started)
Create Graphic User Interface controls in the control panel for Gaga to
the following specification; and add a new graphic element.
OpenJFileChooser).ZoomQuit
Reversesquare>square.
A square has three attributes:
cx }cy } the coordinates of the centre of the
squareside the length of one side.
Like other elements the square may have other attributes such as fill colour, strokewidth etc.
Display your own error messages in a popup. There should normally be no console output (apart from unavoidable Java system messages).
You must change the usage of Gaga to use no command line arguments (not even the document filename), and switch off reporting of the SVG tree structure. This should be done using a switch in the program source code, not by removing the reporting code altogether, which will remain useful for debugging.
You must create your own solution by programming
the Java yourself, using the Swing components (JPanel, JTextArea,
JButton etc. You are not permitted to use a GUI generator,
designer tool, or helper system such as NetBeans (or any other).
If you use any program code examples from any source (apart from the course lecture and lab notes) you must acknowledge the source in comments in the code. This is important: see the notes on good practice to avoid plagiarism in programs.
Your program will be marked on correctness against testing, and on the quality of the design and implementation. You have two challenges: it is technically difficult to get the details in GUI program to work, and the program design is also difficult, to end up with a program that is well-structured. Plan to rewrite, refactor by moving methods to other modules, and plan time to tidy up the program. The program design and structure is actually the more difficult part of the assignment.
Marks will also be given for good working practice, as shown by your regular use of the SVN repository.
The updated Gaga code for ths assignment is in the Comp2100 Subversion repository
at http://svn.anu.edu.au/SWConstr/gaga/trunk/gaga
This contains the source code for the starting version of the program.
Take time to read and understand the code before you try to modify it. Don't just dive in and start changing things until you understand how they work.
Sample SVG files are in the SWConstr svn repository for Gaga
http://svn.anu.edu.au/SWConstr/gaga/trunk/svgSamples.
The Gaga GUI code is structured as a Model-View-Controller program that displays the buffer image from the Java2DRenderer, with an empty Controller. You will need to modify this structure so that the controls are generated before the input file is processed; you may need to extend the controller to handle the graphic elements; you will need to change the Model code, and make it handle and notify changes to any observers.
Implementing the square element requires adding a class
to the package types, extending the Visitor
interface, and adding a method to each visitor. (Read the
program to see how this ease of making changes
demonstrates good program design: these changes are relatively small
and the modification work is well controlled).
You should work in your new personal SVN repository, at
http://svn.anu.edu.au/SWConstr/ass02/uXXXXXXX
where uXXXXXXX is —you guessed it —your university
ID.gaga at the top level in your repository, namely http://svn.anu.edu.au/SWConstr/ass02/uXXXXXXX/gaga.
A large part of the work in this assignment is finding the information you need in the Java API documentation and the Swing Tutorial. You are not expected to already know how to do all this programming, but you are expected to learn how to look it up. You will be expected to have an elementary idea of how Swing GUIs work, and to be able to look up the information you need, read and understand it and put it into action. Take some time to read the documentation for these features and think about it before you start writing code.
It is impossible to do this kind of programming in a single hit. You will need time to try out ideas, find and read the documentation and tutorials, debug (and this is very hard with GUIs) and tidy up.
If you don't understand something in the requirements, send your questions to comp2100@cs.anu.edu.au with COMP2100 or COMP2500 or COMP6442 in the subject line. I will post some of the answers to the Assignment 2 FAQ and Hints thread in the Wattle forum; please check there before you write to me.
Your submission is the latest version in the repository: to make a late submission (1) commit a change (2) email me. If you commit an updated version after the deadline I will assume that it is a late submission unless you email me otherwise.
Late submissions will be accepted up to one week after the deadline. They will be penalised 20% (6 marks). You must email me if you want to be late.
Copyright © 2010, The Australian National University
$Revision: 616 $ $Date: 2011-05-06 11:11:48 +1000 (Fri, 06 May 2011) $ $Author: cwj $
Feedback & Queries to
comp2100@cs.anu.edu.au