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.
Create Graphic User Interface controls in the control panel for Gaga to the following specification; and add a new graphic element.
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.
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).
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.