How does the current code work?
At the beginning, it is important to understand some basic things about the code.
Most of the things that will be discussed in this paragraph pertain to the uci.gef directory:
Every figure that is seen in the Editor pane of Argo/UML (Argo) is ultimately a
subclass of Fig.java. When you are adding a new type of figure or action to Argo, you will need to be aware of
the different managers that are running:
- LayerManager: All the mouse clicks go to the current layer.
- ModeManager: There are a variety of modes to manage such as ModePlace, ModeCreate,
ModeModify and ModeSelect.
- SelectionManager: There may be one selection or many that are being edited.
Also, if you are going to be editing the code, then some of the most important
files that you should know about are:
- Editor: From here you can get access to the LayerManager and SelectionManager
as well as push modes onto the ModeManager.
- Globals: This will allow you to get the current Editor, among many other things.
Continuing from here, we can now go talk about how to make some changes in the
rest of Argo/UML.
How are events processed? e.g., mousePressed event?
Let's say that there are multiple figures selected, and you drag them with the
mouse to the other side of the Editor pane, here is what happens as far as the mouse event is concerned. JGraph
calls Editor calls ModeSelect calls ModeModify and the dragging is handled in MousePressed().
How does the diagram get updated when the name of a class changes?
JGraph calls Editor from which the method keyTyped() is called. From this method:
- The RedrawManager is locked
- From Globals the current editor is set.
- Selection Manager is called, and it then clycle through all of the current selections
How does the navigator tree get updated when I add a operation
to a class?
Steps:
- Some Action call addBehavioralFeature on Classifier
- Classifier#addBehavioralFeature calls fireVetoChangeEvent
- The DisplayTextTree is a listener on all currently displayed objects
- The DisplayTextTree get the vetoableChange call
- Since vetoableChange is sent before the model is actually changed, DisplayTextTree
uses invokeLater(updateTree)
- Shortly thereafter (after all user input has been processed) DisplayTextTree's
updateTree process calls reexpand()
- reexpand() forces a the JTree to rebuild itself, which recomputes the children
of the Class node in the tree that changed
- rebuilding the tree looses track of which nodes were expended by the user, so
reexpand() expands them again.
- Swing redraws the JTree after all processing is complete
|