Output model elements in tabular form with Doc. Composer
Doc. Composer comes with a set of built-in element templates written in XML, and you can also create and edit your own templates. In this article we will show you how to create a template to list out all the use cases in your project, by modifying from one of the default bundled template.
Suppose the project we working on already have use case diagrams plus some use cases, to output all use cases in a single table with Doc. Composer:
- Select Tools > Doc > Composer.
- Select Build Doc from Scratch when prompt for Create New Document Type.
- We use the Use Case List template under use case diagram as the base. Select the use case diagram in Diagram Navigator.
- Right click on the Use Case List template in Template List and select View.
- Click on the template content, then press Ctrl + A to select all content, and press Ctrl + C to copy it.
- Select the project root note.
- Right click on any one of the template, let say Activity Diagram, and select Duplicate.
- Name the template as All Use Cases.
- Click on the template content, then press Ctrl + A to select all content, and press Delete key to remove them.
- Paste the content which copied from Use Case List template into the All Use Cases.
- Now let’s start modify the template to make it fit for report all use cases in the project. First we change the <DiagramBaseInitiationBlock> at the beginning and the end of the template into <ProjectBaseInitiationBlock>.
- Next we insert the condition into ProjectBaseInitiationBlock. We use the HasChildElementChecker to specify the block on work for use cases.
<HasChildElementChecker modelType=”UseCase” flag=”true”>
Remember you have close the checker node at the end of your template. - Create a title section in the template so that it will indicate the model elements we reporting are the use cases.
<Text style=”@heading+”>Use Cases</Text>
<ParagraphBreak/> - Now the modification is done. Before exit template editor we press the Validate button to see is our modifications are correct. The message block in the template editor will show validation was success if there is no error was found.
- Press OK to close the template editor.
- Drag out the All Use Cases template from the Template List, and drop it to the document.
- Now you will have all the use cases in your project showing in a single table, no matter they are in which diagrams or under which package/Model.
Related Know-how |
Related Link |
Leave a Reply
Want to join the discussion?Feel free to contribute!