Lesson 3: Add UML diagrams to the report design
This lesson shows how to add UML diagrams to a BIRT report
design file.
Procedure
To add UML diagrams:
- To continue designing, click the Layout tab in the report design editor.
- Add a title for a section for use-case diagrams to the
report:
- In the Palette, click Label and drag the cursor into the report design editor below the row["documentation"] box.
- In the label box, type Use Case Diagrams.
- Create a style for the label to specify a font and border, and to add a page break before the label. You use the Page Break page in the New Style window to add page breaks.
- Create a data set:
- In the Data Explorer view, expand Data Sets.
- Right-click Package Diagrams; then click Copy. Right-click again; then click Paste.
- Right-click Package Diagrams1; then click Rename and change the name to Use Case Diagrams.
- In the Data Explorer view, right-click Use Case Diagrams; then click Edit.
- In the Edit Data Set window, click Row Mapping.
- Delete the contents of the Expression field.
- In the Expression field, press
Ctrl+Space to display a list of XPath functions, and double-click oclQuery. Note: The XPath language is used to express queries for both the rows and columns of each UML model data set. You can write expressions that navigate the structure of the model because the XPath parser understands EMF-based models. For example, you can create a data set of all the UML actors in the model using //Actor, even though in the XML document for the model no node named "Actor" exists.
- In the Edit Data Set window, in the left pane under Browse, click the down arrow; then click the entry for Sample Business Model.emx, which displays the model structure hierarchy.
- In the model structure hierarchy, click Sample Use Case Diagram.
- In the Expression field, confirm that inputXPath is selected in the oclQuery expression, and click the right-arrow (>) button for the Expression field. The input XPath is now getDiagrams(Model).
- Change getDiagrams(Model) to getDiagrams(//*).
- In the XPath expression, replace inputOCLQuery with self.type = 'Usecase'. The XPath expression now reads: oclQuery(getDiagrams(//*),"self.type = 'Usecase'").
- Click OK.
- Add the use case diagram names and images:
- Add a table to display the use case diagrams: In the Palette, click Table and drag the cursor into the report design editor.
- In the Insert Table window, set Number of columns to 1 and set Number of details to 2.
- In the Data Set field, select Use Case Diagrams and click OK.
- Right-click the Table icon and define a new style for the table that specifies a top padding of 12 points.
- In the Data Explorer view, expand Use Case Diagrams and drag name onto the first Detail Row in the table.
- Delete the name label that was automatically added to the Header Row above the Detail Row.
- In a new style for the row that contains the name, specify the font style.
- In the Palette (not the Data Explorer view), click Image and drag the cursor into the second Detail Row in the table.
- In the Edit Image Item window, click Dynamic image and click Select Image Data.
- In the Select Data Binding window, select the check box for image and click OK.
- Click Insert.
- Right-click the row icon for the row with the image; then define a new style, using the Text Block page to center the image. You might have to click the row to display the row icon.
- Save the report design file.
- In the report design editor, click the Preview tab. The English version of the report should
look similar to the following figure:
Results
Now go on to add stereotype data to the report.
Feedback