Let’s start by creating our new "Hello world" template.

HelloWorldCreateCommand.png

This pops up the Template Editor window shown below:

HelloWorldWindowPuces.png

Let’s detail the Template Editor window contents

1.png The template tree
The template tree shows the nodes that build the template. Here there is only one node, which is a special node: the root node . The root node represents the template itself. By default the root node is named "Template", you can rename it directly in the tree using the F2 key. Obviously, in this example we renamed it "HelloWorld". Don’t forget that we should rename any nodes in this tree to indicate their use in no time at all.

2.png The railway
This indicator shows the model navigation context of the selected node as a three elements sequence.

HelloWorldRailWay.png
Here the selected node is the HelloWorld node whose type is "root".

The "current element" is the model element that is passed to the current node when it is executed. Here the input element type is simply Element , the most general metaclass of Modelio. However the root node representing the whole template itself, this value has no real signification except may be that the Document Publisher end-user can indeed select any kind of elements as target for his Document.

The "produced element" kind is the metaclass of the elements produced by the navigation node. Root node is indeed a navigation node as it will loop on the targets elements of the Document being produced and pass these target elements to its children node. This is the definition of a navigation node. Because we set the root node metaclass property to ‘Package’, we are guaranteed that the root node will only pass package instances to its child nodes. This is why the railway indicates ‘Package’ here for the output element metaclass.

3.png The language chooser
This is the language bar, indicating the selected language in the template editor.
When filling production nodes text fields, only the value for the current language is displayed. To translate it in another language, just click the corresponding flag in the language chooser.

4.png The node properties
The template editor displays the properties or parameters of the node currently selected in the template tree. In our example the HelloWorld node being selected, its properties are displayed.
Node properties are specific to each kind of node and are used to configure the node behavior. For the root node, properties like version , creation date are obvious. However, the Template initial entry point property requires some details.
At runtime, the template is executed against some model elements that might be of various kinds (the list of these elements is freely composed by the end-user when creating a Document and no assumption can be made about his choices). By specifying a metaclass in the root node property, we can somewhat "claim" that the template is supposed to be run only on this particular kind of model elements. Here we chose Package, meaning that elements which are not packages in the Document definition list of targets will be ignored by the template. ( Warning: no misunderstanding here! This does not mean that the template will not be able to process elements which are not packages, it only means that the template can only be launched/started on a package. While running, the template can perfectly process the package owned classes, diagrams, and so on).
Action: set the Template initial entry point property value to ‘Package’+ Another node property for the root node is the Template description field. The user can enter a description for the template, which will be made available to the Document Publisher end-user when selecting a particular template. It is recommended to indicate here the purpose of the template, the kind of document it produces and the type of model element it is supposed to be run on.

5.png The main toolbar
These buttons trigger actions on the template itself, like import/export of the template in XML format, configure the template preview, style-sheets, parameters or launch a package to produce the template jar file.