Add Dynamic Content
Dynamic content refers to content that can be added by dragging and dropping items from the Browser window onto the open document. This is a great facility of a Custom Document, because whenever the document is accessed, the item information is automatically refreshed from the model. Any item in the Browser window can be added to the document, including Packages, diagrams, elements and Features (attributes and operations). Multiple items can be dragged at the same time; these would be inserted based on their order in the Browser window.
Great flexibility is provided by allowing you to select a document generation template for each item you add to the document. For example, you might add a Stakeholder Package containing a list of Stakeholder elements, and use a template that lists the Stakeholders in separate paragraphs.
This allows you to create a powerful publication that contains up-to-date selected information from the model in the repository, 'injected' into appropriate places in the document above, below or between Static content, and rendered using user-specified templates.
Adding the Material
Whenever you drag an item from the Browser window into a document, Enterprise Architect displays the 'Add Content to Document' dialog to prompt you to select how to insert and format the item.
You can drag and drop an item into a document as Dynamic content by selecting one of the options in the 'Insert As' field:
- Dynamic Content - the item contents will be copied into the document, rendered according to a selected document generation template: for a model element such as a Package, element or Feature, this is the default option
- Hyperlink - creates a link that a reader can follow to the object or diagram in the Browser window (note, this is for documents read online)
- Image Hyperlink - creates a hyperlink to an image artifact of a diagram, in the model; the image artifact is created as part of this process
- Diagram Image - this inserts the selected diagram as an image in the document
If you are creating a number of links (and, for Dynamic content, using the same template) you can avoid displaying the dialog each time. Create the first link and then press theas you drag each of the subsequent objects onto the document. The links are all of the first-selected type, until you drag an object without pressing the Ctrl key; the dialog displays again and you can change the 'Insert As' option.
Specifying a Template
Whenever you add an item from the Browser window to a document, the 'Add Content to Document' dialog that is displayed also prompts you to select a Document Generation template or Template Fragment from the 'Select a Document Template' list. You would select a template if you have chosen to insert the item as Dynamic content. For example, you might want to display an element's content as a formatted paragraph with a heading and a list of features, or as a labeled table showing the element's Name, Description (Notes) and Status.
The list of templates can be filtered to include only those that are user-defined, or system-provided, or technology-provided, or to show all available templates. You make your selection by clicking on the appropriate radio button under the list.
This image shows an example of items that have been added as Dynamic content and rendered using a template that displays the items in a table showing each item's Name, Priority and Notes.
Generally, you insert Dynamic content items into the Custom Document from the Browser window in sequence. It is, in practice, possible to insert one dynamic item within the section generated by another, but this presents several complications in document generation and maintenance. Therefore, if you do insert one item within another, a warning message displays to makes sure you are aware of it, and to allow you to cancel the insert if it is not intentional.
Keeping Track of Inserted Dynamic Items
As you add Dynamic content to a Custom Document, you will notice that a 'Content' panel displays on the left of the document editor, listing the items that have been inserted as either 'Dynamic Content' or 'Diagram Image', in the order in which they were added to the document. Items added as 'Hyperlinks' or 'Image Hyperlinks' are not included in the panel.) You can manage the added dynamic content from the context menu that displays when you right-click on each of the item names in the panel.
This panel is discussed in the Manage Custom Documents Help topic.
Inserting the Wrong Item
If you find that you have inserted the wrong model object as Dynamic content, you can right-click on it in the 'Content' panel and delete the section. Alternatively, if you inserted the item as a hyperlink (which is not listed in the 'Content' panel) and/or you have only just inserted the item, you can right-click on the text and select the 'Undo' option, which immediately removes the whole item. The Undo option is also available in the Document - Edit ribbon, under the 'Edit' icon in the 'Edit' panel.