OpenTranqueraFramework Logo
Skin definition
Xkins Forms

Velocity template processor

This processor is the recomended processor for HTML generation.

This processor is 100% faster than Xkins Template Reference implementation.

Velocity receives properties as Velocity properties, and xkins resources as properties, but with res_ prefix. For example, a xkin resource called "back" is seen by Velocity as $res_back. Also receives objects req, res, app and session just like VelocityServlet does.

VelocityTemplateProcessor implemente TemplateProcessor and uses a XkinsVelocityLoader that extends ResourceLoader.

You can change this implementation or use other ResourceLoader.
you can use xkins to organize your templates and use Xkins capabilities for managing multiples Skins.

For example, you can define a Skin as follows:

	<skin name="skin1" url="/skins/skin1">
		<processor type="net.sf.opentranquera.xkins.core.processor.VelocityTemplateProcessor"/>
		<element name="back" path="backgrounds" url="/back.gif"/>
		<constant name="tipoLetra" value="Tahoma"/>
		<constant name="colorLetra" value="#BBAABB"/>

		<template name="page1">
			<content url="/page1.vm"/>
		<template name="page2">
			<content url="/page2.vm"/>
		<template name="page3">
			<content url="/page3.vm"/>
		<template name="page4">
			<content url="/page4.vm"/>
	<skin name="skin2" url="/skins/skin2" extends="skin1">
		<processor type="net.sf.opentranquera.xkins.processor.core.VelocityTemplateProcessor"/>
		<element name="back" path="backgrounds" url="/back2.gif"/>

In this example you declare 4 templates (page1... page4) that are Velocity templates externalized in *.vm files.
This files can use Skin resources (with $res_ patterns) and skin2 extends skin1 and overwrites back element.

What can be done is to extend VelocityServlet to use XkinProcessor for dispatch this VelocityTemplates and use Xkins capabilities.

Print version | Download | Powered by