< Previous | Next >

Lesson 3: Adding template elements and conditions

You can add a range of template elements, queries, and conditions to build a template.
  1. Define a query for the top-level Packages and cast under the model/root element:
    • Select the root query from the Data Source Schema view and click the Cast to Type icon Cast to type icon.

      Defining a query

    • In the Select Type window, select Package and click OK.
    Note: You cannot build queries of the Any Type type. A cast must be defined before using a query. Schema elements that can have more than one type, do not have a type assigned to them. In such cases, you can define which type to use through the Cast to type feature.
  2. Add a Container element from the Palette view in the template.
  3. Drag the newly added model/root(Package) query from the Data Source Schema view into the container element.
  4. Select the container element.
  5. In the Properties view, select the General tab.
  6. In the name field, enter Root Packages.
  7. Drag a paragraph into the container element and add the model/root(Package)/name attribute.

    Name attribute in the paragraph element.

  8. Add the static text heading diagrams for the list of diagrams:
    • Drag a Paragraph element from the Palette view into the container element, after the first paragraph element.
    • Drag a Text element from the Palette view into the second paragraph element.
    • Double-click the Text element and enter Diagrams.
    • Drag a Container element into the first container element, after the two paragraph elements.
    • Drag the model/root(Package)/diagram attribute into the container element.
      Note: To add a specific diagram type, add a cast to that diagram type below the diagram(Diagram) node and use the cast type instead of the generic diagram type.
    • To add a specific diagram:
      • Drag an Image element from the Palette view into the container element.
      • Double-click the image element.
      • In the Set Value for Image Element window, expand model/root(Package)/diagram, and select _image. The selected attribute is added in the Selected data item field.
      • Click OK.

        Set Value for Image Element

    • Drag a Paragraph element into the editor after the image element.
    • Select the paragraph element.
    • In the Properties view, select the General tab.
    • For the name property, enter Diagram caption.
    • Drag a Figure caption element into the paragraph element.

      Adding diagram caption

    • To display the figure caption with the diagram name:
      • In the Properties view, select the Specific tab.
      • For the Field label property, click the Setting field value icon.
      • In the Set Field Label Value window, expand model/root(Package)/diagram, and select Name. The selected attribute is added in the Selected data item field.
      • Click OK.
  9. List the classes from each package:
    • Drag a Paragraph element from the Palette view after the second container element.
    • Drag a Text element into the paragraph element.
    • Double-click the text element and enter Classes. Click OK.
    • Drag a Container element after the paragraph element.
    • Drag the model/root(Package)/diagram/ownedMember(Class) attribute from the Data Source Schema view into the container.
    • Select the container element.
    • In the Properties view, select the General tab.
    • For the name property, enter Class Container.

      Adding a class type cast

    • Add the Class type cast for the ownedMember by clicking the Cast to Type icon icon.
    • Add a Paragraph element into the container element.
    • Drag the model/root(Package)/diagram/ownedMember(Class)/Name attribute into the paragraph element.

      Adding a Package Name

      Note: You can add this text only for the active classes by setting a condition to the text element.
    • To add a text only to the active classes:
      • Add a Text element into the paragraph element.
      • Double-click the text element and enter (Active).
      • Right-click the text element and click Data > Edit Condition.
      • In the Set Condition for Current Element window, expand Attributes, and then select the IsActive attribute. The selected attribute is added to the Left operand field in the right view.
      • For the Operator, select Equals.
      • For the Right Operand, select true.
      • Click Add.
      • Click OK.
  10. Save the document.

Lesson checkpoint

You added elements and conditions to a template.
< Previous | Next >

Feedback