The Animator

 

The CDE animator allows the user to interactively create and delete component and contract instances, to call methods on those instances,  to trace calls through message sequence diagrams, and to see in tabular format the state of all instances of a given class. These features allow one to quickly test several scenarios and configurations without actually coding a test application.

Like the CDE editor, the animator is divided into five areas: the menu bar, the toolbar, and three panes. The left pane shows an hierarchical view of the current animation project, the right pane contains tabbed windows for the diagrams and tables, and the bottom pane shows any messages issued to the user.  

The Project Pane

The animator project pane works like the one in the CDE editor, only the content differs. The pop-up menu for the project root node has the following commands:

Properties...
This command opens a dialog to input the paths of directories where the class files can be found. Normally, this is just the classes subdirectory of the directory where the animation project file is. However, if the application uses classes shared by different applications, then the directories of those common classes must also be given.
Load Classes...
The same as File->Load Classes...
Reset Project
This command deletes all instances and reloads the class definitions. This is useful if, during animation, a bug was uncovered and subsequently the components and contracts were changed, re-generated, and re-compiled in the CDE editor. With this command it is possible to load the new .class files without having to exit the animator. A confirmation dialog appears before actually resetting the project.
Close Project
The same as File->Close Project.

The project root node may have as children two types of nodes: component class nodes and contract class nodes.

Component Class Node

The pop-up menu for this kind of nodes has three commands:

Population
This command opens a new population window for this class in the right pane, if there is none yet. Population windows are described in the Animation Pane section.
Execute...
This command opens a method execution window for the class. A method execution window allows one to directly execute public class and instance methods of a given class. The first line of the window states the class for which methods can be selected. The second line has a pull-down method to select on which instance the method will be called. It is also possible to select the class itself (option <class>). The third line of the window has a pull-down menu to choose the actual method to be invoked. If the class has been chosen in the menu above, then only constructor methods appear in this menu, otherwise only instance methods appear. Methods are listed in the form Name / NumberOfArguments
The last part of the execution window has one text box or pull down menu for each argument of the selected method. The type of the argument is written on the left of the textbox or menu. The argument name does not appear because it is not stored in .class files. If the argument is of basic type (like numbers and String), then a textbox appears, for the user to introduce the value. Otherwise, a pull-down menu with the known instances of that type appears.  
After having made all selections and input all parameter values, the method may be called by clicking on the "Execute" button. If a constructor method was selected, then the new instance will appear as a child node of the component class node in the project pane and the new instance becomes the default object on which further methods will be invoked. The population window for the class is updated. 
Delete
This command removes the class and all its instances from the project. It automatically closes any population window for this class.
 

A component class node has one child node for each instance (i.e., object of that class) that exists in the animator. Each component instance node is labeled by the string returned by the toString() method. It has one child for each message sent to it from an execution window, beginning with the constructor message. In this way one can quickly see the history of operations performed by the user on any object. Note that any methods called by other methods of other instances do not show up in the project pane. 

The pop-up menu for component instance nodes has three operations:

Execute...
This opens a new method execution window, with this instance selected by default. 
Add to Diagram
This command will add the instance to all open message sequence diagrams. 
Delete Instance
This command removes the object from the project. The population window is updated.

Contract Class Node

Contract class nodes have the same pop-up menu as component class nodes. The difference is in the methods that show in the pull-down menu of the method execution window. The contract class that was generated by the CDE editor for a contract named X has the following methods:

Like for components, each contract class node has one child per instance, and each instance has one child node for each method called. The pop-up menu for contract instance nodes is the same as for component instance nodes.

The Animation Pane

The animation pane may have two kinds of  tabbed windows: population windows to show in a tabular way all current instances of a given class and diagram windows with simplified message sequence diagrams to show the interactions between component and contract instances.

Population Windows

A class population window is a table with a line for each instance of that class. There is one column for each attribute. Each cell shows the value of the attribute in that column, for the instance in that line. The ordering of columns can be changed by dragging them. The width of columns can be changed by dragging the separator lines.

Diagram Windows

A diagram window shows a message sequence chart with all the interactions that occur between the instances added by the user to this diagram. If any of the instances interacts with an instance currently not in the diagram, then the needed instance is automatically added to the diagram. The same happens if the user calls a method on an instance not present in the diagram. 

The animator does not implement the full possibilities of sequence diagrams, in particular nested calls. There is one lifeline for each (component or contract) instance, labeled at the top by the name of the class and the name of the instance, as returned by toString(). Horizontal arrows denote messages sent and received. The arrows are labeled with the message name; arguments are not shown. A diamond at the end of an arrow's shaft indicates that the message was sent by the user from an execution window. 

The actual execution of methods is indicated by small brown boxes. A box indicates that the method was entered, not that it was completed. In other words, it doesn't show all the activation time of the method.

A delete message and method invocation immediately followed by a cross on a lifeline indicates that the corresponding object was deleted. 

At the bottom of the pane there are 8 buttons. The two left-most buttons allow to change the order of the objects in the diagram. For that, first the object has to be selected by clicking on its label at the top. The box and lifeline become red. Now one can use the left and right arrow buttons to swap the selected object with the one on its left or right. The arrows across lifelines are automatically redrawn. To deselect the object, click anywhere on the diagram except object headings. The buttons labeled Up and Down scroll the diagram up or down one event (message or method) at a time, maintaining the labels at the top of diagram always visible. The Top button shows the diagram since its beginning, i.e., it is equivalent to presssing Up until it no longer has effect. The Clear button makes all events disappear from the diagram. The two right-most buttons shrink and grow the diagram. 

The Message Pane

The bottom pane shows any exceptions that arise during the execution of methods on components or contracts.

The File Menu

New Animation project
This submenu has two commands. The first one is "New Animation Project" and opens a file dialog to create a new file holding an animation project. There is no mandatory extension; however, at ATX we use always .apr for animation projects. The project pane is updated to show the root node of the new project. The second command is "Sequence Diagram"  and creates a new, empty diagram window.
Load Classes...
This command opens a dialog to choose which classes should be loaded into the project. The list of classes is obtained from the paths given in the project options. Classes can be selected individually by marking the checkboxes to their left. The buttons at the bottom of the dialog allow to select all classes, to deselect all classes, and to exit the dialog, confirming the choices made. The new classes are added as children of the project root node and the project pane is updated. 
Open Animation Project...
This command allows the user to open, through a file dialog, an already existing animation project. The project pane is updated to show the new project. If the project is already open in the animator, nothing happens.
Close
This command closes the current window in the animation pane.
Close Project
This command closes the current project in the project pane. If the project has been changed, a dialog appears to confirm whether changes are to be saved or not, or if the command is to be cancelled.
Save Animation Project
This command saves the current project, i.e., the one shown in the project pane. Only the project options and the classes belonging to the project are saved. Information about the class instances is not stored on file.
Reopen
This submenu contains a list of recently opened files, divided into two groups: text files and animation projects. This allows to quickly open files on which the user is working. 
Exit
This command closes all currently open projects and exits the animator.

The Help Menu

About
This command shows some information about the animator.

The Toolbar

The only button in the toolbar is a shortcut to File->Close. The button is inactive (i.e., the icon is grayed out) whenever the corresponding command is. When the mouse cursor is left for a while over a button, a tool tip appears: a small text box describing the action associated to the button.