Customize your Genero Web Client application / Customize the User Interface with Templates and Snippets |
Once you have customized a snippet, you then need to make the snippet available.
<?xml version="1.0" encoding="UTF-8"?> <APPLICATION Parent="defaultgwc"> <EXECUTION> <PATH>/home/srcdir/app1</PATH> <MODULE>app1</MODULE> </EXECUTION> <OUTPUT> <MAP Id="DUA_HTML5"> <THEME> <SNIPPET Id="Image">/home/srcdir/app1/Snippets/HTML5_Image.xhtml</SNIPPET> </THEME> </MAP> <MAP Id="DUA_AJAX> <THEME> <SNIPPET Id="Image">/home/srcdir/app1/Snippets/AJAX_Image.xhtml</SNIPPET> </THEME> </MAP> </OUTPUT> </APPLICATION>
To have your customized snippet apply across all of your applications using a specific theme, you want it to be part of the defined set for the application theme.
You have three options.
... <WEB_APPLICATION_THEME_COMPONENT Id="cpn.theme.html5.gwc"> ... <SNIPPET Id="RadioGroup">$(res.path.tpl.html5)/RadioGroup.xhtml</SNIPPET> <!--Replacing SNIPPET Id="Image">$(res.path.tpl.html5)/Image.xhtml</SNIPPET--> <SNIPPET Id="Image">/home/srcdir/app1/Snippets/HTML5_Image.xhtml</SNIPPET> <SNIPPET Id="StaticLabel">$(res.path.tpl.html5)/StaticLabel.xhtml</SNIPPET> ... </WEB_APPLICATION_THEME_COMPONENT> ... <WEB_APPLICATION_THEME_COMPONENT Id="cpn.theme.ajax.gwc"> ... <SNIPPET Id="RadioGroup">$(res.path.tpl.ajax)/RadioGroup.xhtml</SNIPPET> <!--Replacing SNIPPET Id="Image">$(res.path.tpl.ajax)/Image.xhtml</SNIPPET--> <SNIPPET Id="Image">/home/srcdir/app1/Snippets/AJAX_Image.xhtml</SNIPPET> <SNIPPET Id="StaticLabel">$(res.path.tpl.ajax)/Label.xhtml</SNIPPET> ... </WEB_APPLICATION_THEME_COMPONENT> ...
... <WEB_APPLICATION_THEME_COMPONENT Id="cpn.theme.html5.gwc"> ... <SNIPPET Id="RadioGroup">$(res.path.tpl.html5)/RadioGroup.xhtml</SNIPPET> <SNIPPET Id="Image">$(res.path.tpl.html5)/Image.xhtml</SNIPPET> <SNIPPET Id="StaticLabel">$(res.path.tpl.html5)/StaticLabel.xhtml</SNIPPET> ... </WEB_APPLICATION_THEME_COMPONENT> <WEB_APPLICATION_THEME_COMPONENT Id="cpn.theme.myhtml5.gwc"> ... <SNIPPET Id="RadioGroup">$(res.path.tpl.html5)/RadioGroup.xhtml</SNIPPET> <SNIPPET Id="Image">/home/srcdir/app1/Snippets/HTML5_Image.xhtml</SNIPPET> <SNIPPET Id="StaticLabel">$(res.path.tpl.html5)/StaticLabel.xhtml</SNIPPET> ... </WEB_APPLICATION_THEME_COMPONENT>
If you choose option 1 or 2, you will need to modify the Genero Application Server configuration file with each upgrade. If you choose option 3, you will have to replace the relevant snippet files with your custom snippet files with each upgrade.
Instead of changing the snippet for all the widgets of the same type. You can use a style to customize an instance of the widget.
EDIT main1 = formonly.main1, STYLE="FileUpload";
<SNIPPET Id="Edit" Style="FileUpload">$(res.path.tpl.html5)/FileUpload.xhtml </SNIPPET>
The main1 EDIT uses the FileUpload.xhtml snippet other edit widgets uses the default snippet Edit.xhtml.