This tutorial learn to you create HelloWord XML component, which is able to generate a file with Hello $user! content. Template used has user parameter type of String.
You can find next sample into usecases-catalog/Components/HelloWord/HelloWord.akgncpt.xml catalog.
Here Wizard page which we wish obtain :
Here the file which we wish obtain :
Hello word!
Steps of this tutorial are :
In this tutorial, template will be written into Freemarker. See Freemarker Web site for mor einformation about FTL syntax.
Template has user String parameter.
Here Freemarker template helloWord.ftl :
Hello ${user}!
Create helloWord.ftl template file into Templates/ftl/HelloWord/ directory of the MyAkrogenCatalog catalog .
XML component is XML description of Wizard page Eclipse. In this file you can define :
Here XML component which we must use :
<?xml version="1.0" encoding="UTF-8"?> <component> <input> <page title="Akrogen Hello Word" > <description>HelloWord Akrogen component to generate file with content "Hello $user!".</description> <box flex="1" id="" orient="vertical" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <hbox> <label value="User: ($user)" /> <textbox id="user" flex="1" /> </hbox> <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> <hbox> <button type="preview" label="Preview..." /> </hbox> </box> </page> </input> <output> <file> <template uri="/ftl/HelloWord/helloWord.ftl" /> </file> </output> </component>
Create HelloWord.akgncpt.xml XML component file into Components/HelloWord/ directory of the MyAkrogenCatalog catalog.
Here explanation about this XML component :
input/page element describes Wizard page eclipse :
When you write XUL, you must pay attention to :
ouptput element describe outpout behaviour :
Refresh catalog view. HelloWord must appear into the catalog view :
Double click on HelloWord component to open Wizard page.