15.07.2013 Views

jgrasp handbook

jgrasp handbook

jgrasp handbook

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5.8 Saving the UML Layout<br />

DRAFT, February 18, 2003, Page 61<br />

When you close a project, change to another project, or simply exit jGRASP, your UML layout is<br />

automatically saved in the project file (.gpj). The next time you start jGRASP, open the project, and open<br />

the UML window, you should find your layout intact.<br />

If the project file is created in the same directory as the .java and .class files, and if you added the source<br />

files with relative paths, then you should be able to ship the files around (e.g., email them to your<br />

instructor).<br />

5.9 Printing the UML Diagram<br />

On UML window menu, click on Print – Print Preview to see show your diagram will look on the printed<br />

page. If okay, click the Print button in the lower left corner of the Print Preview window. Otherwise, if the<br />

diagram is too small or too large, you may want to go back and scale it using the scale factors near the<br />

top right of the UML window, then preview it again.<br />

For details see UML Class Dependency Diagrams in Part 2 - Reference.<br />

Object Workbench NEW in Version 1.6!<br />

5.10 The Object Workbench<br />

Beginning with Version 1.6, jGRASP provides an Object Workbench that works in conjunction with the<br />

UML diagram, as well as the integrated debugger. The workbench allows the user to create instances of<br />

any class in the diagram and place them on the workbench. After an object appears on the workbench,<br />

the user can select it and invoke any of its methods. In addition, the user can select any component of an<br />

object and place the component on the workbench.<br />

The Object Workbench is a useful approach for learning the fundamental concepts of classes and<br />

objects. Advanced users will also find the workbench to be useful when their programs are run in debug<br />

mode from the jGRASP desktop.<br />

To create an object for the workbench, right click on the class in the UML diagram, and then select<br />

Create New Instance. A list of constructors will be displayed in a dialog box. Select one of the<br />

constructors; fill in the parameters if necessary, then click create.<br />

To invoke a method for an object on the workbench, select the object, right click, and then select Invoke<br />

Method. A list of local methods will be displayed in a dialog box; you may display inherited methods by<br />

selecting the appropriate parent. Select one of the methods; fill in the parameters if necessary, then click<br />

create.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!