File generation

File generation is done with template (Freemarker, velocity, XSL,...). File generation require to :

  • define into input/page element 2 textbox XUL with ID :
    • outputBaseDir which must contain value of output base dir of the file to generate.
    • outputFileName which must contain value of file name to generate.
  • define file element which is linked with template to use.

Akrogen merge input parameters of the component with template. It generate file by using values of XUL textbox outputBaseDir et outputFileName. File content is the result of this merge.

file

To generate file with template path_of_myTemplate, output must contain :

<file>
  <template uri="path_of_myTemplate" />
</file>

Here component sample which define 2 XUL textbox outputBaseDir et outputFileName and file element :

For instance :

<?xml version="1.0" encoding="UTF-8"?>
<component>
  <input>
    <page title="Akrogen Hello Word" >
        <box flex="1" id="" orient="vertical"
             xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
          ...
          <hbox>
            <label value="Output base dir:" />
            <textbox id="outputBaseDir" flex="1" />
            <button type="folder" target="outputBaseDir" label="Browse..." />
          </hbox>
          <hbox>
            <label value="Output file name:" />
            <textbox id="outputFileName" flex="1" />
          </hbox>       
        </box>                  
    </page>
  </input>
  <output>
    <file>
      <template uri="/ftl/HelloWord/helloWord.ftl" />
    </file>
  </output>
</component>