UModel is able to create sequence diagram models directly from code, or through the UModel API. Please see How to create Sequence Diagrams using the UModelAPI for more information.
The example below shows how to automatically create a sequence diagram by using an existing method. You can, of course, use the same approach on your own code. The method is available in the OrgChart package which was imported using the Project | Import Source Directory command in the tutorial. Please see Round-trip engineering (code - model - code) in the tutorial for more information on importing code.
1.Having imported the code, right-click the main method of the OrgChartTest class, in the Model Tree and select Generate Sequence Diagram... .
This opens the Sequence Diagram Generation dialog box in which you define the generation settings.
2.Select the presentation and layout options, then click OK to generate the diagram. The settings shown above produce the sequence diagram below.
The "Add notes on separate layer" option assigns the code notes to the Code Annotations layer. The code notes are shown in orange.
•You can assign a special color to the non-displayable invocations.
•The maximum invocation depth defines the recursion depth to be used in the diagram.
•The Type names to ignore option allows you to define a comma delimited list of types that should not appear in the sequence diagram when it is generated.
•The Operation names to ignore option allows you define a comma delimited list of operations that should not appear in the generated sequence diagram (initComponents are automatically added as a default). Adding the operation names to the list e.g. "InitComponents" causes the complete operation to be ignored. Prepending a + character to the operation in the list e.g. +InitComponent, causes the operation calls to be shown in the diagram, but without their content.
•The Split into smaller diagrams where appropriate option automatically splits sequence diagrams into smaller sub-diagrams, and automatically generates hyperlinks between them for easy navigation.
Sequence diagrams are automatically updated when you update the complete UModel project. Sequence diagrams are not updated if you update classes, or individual files, externally. You can however change this setting by clicking on the diagram background and clicking the Automatic Update check box.
Clicking the icon of the Automatic Update field, opens the Sequence Diagram Generation dialog box allowing you to change the sequence diagram generation settings.