<#-- ======================== Start of Main() Code Generation ============= --> <#compress> <#-- remove superfluous white-space --> <#recurse doc> <#-- Strart recursively processing the document --> <#macro pise> <#-- A macro name matched with the label of the node in the doc--> <#-- when this node is found execute the following commands--> <#assign command = .node.command?default("")> <#recurse .node.parameters> <#-- Permit to recursively process the nodes, FreeMaker will look for a macro that matches the label of the node in the doc. In this case it will find 'parameters' --> <#-- ======================== End of Main() Code Generation ============= --> <#-- ======================== Macros ============= --> <#macro parameters><#recurse> <#macro parameter> <#-- set defaults to the list of default values in node --> <#assign defaults =.node.attributes.vdef.value> <#-- skip parameter when "ishidden" is "1" --> <#if .node.@ishidden[0]?exists && .node.@ishidden[0]?contains("1")><#return> <#if .node.@issimple[0]?exists && .node.@issimple[0]?contains("1")><#return> <#-- skip parameter when "isinput" is "1" --> <#if .node.@isinput[0]?exists && .node.@isinput[0]?contains("1")><#return> <#-- change "-" to "_" since Java does not recognize '-' as valid name change " " to "_" since space is not allowed in a Java varname add "_" to name to avoid using common methods names as parent class --> <#assign name = .node.name[0]?default("")> <#assign name = name?replace("[ |-]","_","r")+"_"> <#assign prompt = .node.attributes.prompt[0]?default("")> <#-- process prompt: make a href link if there is comment --> <#-- (simply replace (-xxx) with xxx)) --> <#-- replace the entire string if (-xxx) is not found --> <#if (.node.attributes.comment?size >= 1 )> <#if prompt?contains("(-"+.node.name+")")> <#assign prompt = prompt?replace("(-"+.node.name+")", "(-${.node.name})")> <#else> <#assign prompt = "${prompt}"> <#-- process parameter node according to its attribute "type" --> <#switch .node.@type> <#case "Paragraph">
<#assign p= .node.paragraph>

${p.prompt}

<#recurse .node.paragraph.parameters> <#-- recursive process child parameters --> <#break> <#case "OutFile"> <#case "Results"> <#break> <#case "Label">

${name}

<#break> <#case "Float"> <#case "Integer"> <#case "String"> ${prompt} <#if .node.@ismandatory[0]?exists && !.node.attributes.precond?is_node> * <#if .node.@ismandatory[0]?exists && .node.attributes.precond?is_node> + <#-- VALUE="${.node.attributes.vdef.value[0]?default("")}"/> is not needed since the default value are going to be assigned through the action class -->
<#break> <#case "Sequence"> <#case "InFile"> ${prompt} <#if .node.@ismandatory[0]?exists && !.node.attributes.precond?is_node> * <#if .node.@ismandatory[0]?exists && .node.attributes.precond?is_node> + <@compress single_line=true>
<#break> <#case "Switch"> ${prompt} <#if .node.@ismandatory[0]?exists && !.node.attributes.precond?is_node> * <#if .node.@ismandatory[0]?exists && .node.attributes.precond?is_node> + <#-- <#if defaults?seq_contains("1")>selected="TRUE"/> is not needed since the default value are going to be assigned through the action class -->
<#break> <#case "List"> ${prompt} <#if .node.@ismandatory[0]?exists && !.node.attributes.precond?is_node> * <#if .node.@ismandatory[0]?exists && .node.attributes.precond?is_node> + <#visit .node.attributes.vlist>
<#break> <#case "Excl"> ${prompt} <#if .node.@ismandatory[0]?exists && !.node.attributes.precond?is_node> * <#if .node.@ismandatory[0]?exists && .node.attributes.precond?is_node> + <#-- determine number of values in options --> <#assign size=.node.attributes.vlist.value?size> <#if size gt 3> <#-- make it a drop down list --> <#if .node.attributes.vlist?is_node> <#visit .node.attributes.vlist> <#else> <#-- make it a radio button if fewer than 3 in vlist --> <#-- add [default] radio button if ismandatory is not present --> <#-- [default] has value="vdef" if defined, other value="" --> <#-- set value to vdef.value if there is one, otherwise, set it to "" --> list="${r"#{"} <#if ! .node.@ismandatory[0]?exists> '': '[Not Mandatory]', <#assign size = .node.attributes.vlist.value?size> <#list .node.attributes.vlist.value as value> '${value}':'${.node.attributes.vlist.label[value_index]}' <#if .node.attributes.vlist.value?seq_index_of(value) lt (size-1)>, }" onclick="resolveParameters()"/>
<#break> <#default> <#break> <#-- make a drop down list from vlist;if type is "List", make it multiple --> <#-- set default value(s) to --> <#macro vlist> <#assign name = .node?parent?parent.name> <#assign name = name?replace("[ |-]","_","r")+"_"> <@compress single_line=true> multiple="true" <#else> <#if (! .node?parent?parent.@ismandatory[0]?exists) > headerKey='' headerValue='' list="${r"#{"} <#assign size = .node.value?size> <#list .node.value as value>'${.node.value[value_index]}':'${.node.label[value_index]}' <#if .node.value?seq_index_of(value) lt (size-1)>, }" onchange="resolveParameters()"/>