Changes for page Custom Project Templates
Last modified by Bastian Triller on 2009/04/11 21:03
From version 27.1
edited by Mike Schrag
on 2007/10/07 10:11
on 2007/10/07 10:11
Change comment:
There is no comment for this version
To version 30.1
edited by Mike Schrag
on 2007/10/03 16:17
on 2007/10/03 16:17
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -57,10 +57,8 @@ 57 57 58 58 The "name" attribute of the template node overrides the name of the folder the templates are in. For instance, you could have the above template.xml inside a folder named "Template 1" and the template system would consider the name of the template to be "Wonder Application." 59 59 60 -Within a template, you can declare a single "inputs" node that can contain multiple "input" nodes. Each input node corresponds to a variable that will be presented to the user on the second page of the wizard. Each input specifies a "name" attribute, which will become the variable name of the input for later reference in the Velocity templates; and a "type" attribute which can be one of Boolean, String, Package,or Integer. The type value determines the control that will be used to display the input to the user (String = text field, Boolean = checkbox, Integer = spinner,Package=text field, etc). Each input also contains a "question" node, whose value corresponds to the label of the control when displayed to the user. In the above example, the "linkToWonderFrameworks" will display a checkbox to the user with the label "Link to Wonder Frameworks?". Additionally, you can provide a "default" node that defines the default value of the variable. If a default is not specified, the default value will be null for all input types.60 +Within a template, you can declare a single "inputs" node that can contain multiple "input" nodes. Each input node corresponds to a variable that will be presented to the user on the second page of the wizard. Each input specifies a "name" attribute, which will become the variable name of the input for later reference in the Velocity templates; and a "type" attribute which can be one of Boolean, String, or Integer. The type value determines the control that will be used to display the input to the user (String = text field, Boolean = checkbox, Integer = spinner, etc). Each input also contains a "question" node, whose value corresponds to the label of the control when displayed to the user. In the above example, the "linkToWonderFrameworks" will display a checkbox to the user with the label "Link to Wonder Frameworks?". Additionally, you can provide a "default" node that defines the default value of the variable. If a default is not specified, the default value will be null for all input types. 61 61 62 -The package type is slight extension to the String type. For a variable declared as type Package, in addition to having your variable bound, you will also have a variable named "yourvariablename//folder" with replaces dots for slashes. For instance, if your variable is named "basePackage," you will also get a variable named "basePackage//folder." This is useful because you can use template variables in folder names on the filesystem. 63 - 64 64 Finally, the input system supports the declaration of enumerated types. By declaring an "options" node that contains an ordered set of "option" nodes, you can define the possible values that the user can provide. In the above example, the "YourFavoriteColor" input defines three options: Red, Green, and Blue. Each option node has a "name" attribute, which will be the value displayed to the user, and a "value" attribute, which will be the actual backing value of the selection. The value of the option should be of the type specified in the "type" attribute of the input. For instance, if you declare the input type to be "Integer," your option values should be integer values (in quotes). 65 65 66 66 ==== Using Template Inputs ==== ... ... @@ -91,6 +91,4 @@ 91 91 92 92 {{/code}} 93 93 94 -In addition to variables inside of Velocity templates, you can also use template inputs in folder names. For instance, the Wonder Application template has an input named "basePackage" (of type Package), which creates a magic variable named "basePackage//folder" (where the dots are turned into slashes), and the Source folder on the filesystem is named "Wonder Application/Sources/$basePackage//folder". 95 - 96 96 Happy templating!