OpenTranqueraFramework SourceForge.net Logo
Home
Features
Skin definition
Examples
Processor
Xkins Forms
Velocity
Struts
JSF
Downloads

Xkins definition / Skin Components

Xkins are defined in a XML file. If used in a web application, you must declare this file in XkinsServlet declaration in web.xml file. You can declare multiples xkins-definition files where each file will aggregate to the Skins definition.
If you are not using a web application, you can load skins definition from a xkins-definition file without using a servlet.
You can also use Xkins Struts 1.1 plugin in order to load xkins-definition in Struts 1.1 fashion.

In development, you can enable Xkins autoreload feature. So, when you change a Xkin definition file or a template file, Xkins will be reloaded automatically and XkinsLoadEvent will be fired.

You can define all skin information in xkins-definition file or you can declare a Skin Component and pack all Skin data (templates, image files, CSS files, etc) in a single Skin directory. This is done by providing a definition attribute to the Skin declaration.

For example, a Skin named "invierno" can be declared like this:
<xkins>
   <skin name="invierno" url="/skins/forms/invierno" definition="/definition.xml"/>
</xkins>

and this skin directory would have the following directory structure:

You could pack all skin data in a zip file and distribute as a Skin Component (this structure, css files, definition.xml file containing templates, and image files).

A Skin is defined with the following entities:

Skin: This is the definition of the skin, and can contain elements, constants, templates and paths. All Skin definition can be externalized in a file located in Skin path, so creating a Skin Component. Skin has a path relative to context path, where skin's files should be stored (images, sounds, css, etc.). You can also define a specific template processor to be used in the skin, overriding default behavior. This skin can extend other skin, and can override all its parent's components, fully or partially (you can override template's content or just its elements).

Path: Is contained in a Skin and defines a URI relative to Skin's path. You can also define a path not to be relative to skin's path, for instance, to point to a different URI in your context path. Paths are available to be used by all resources in the Skin and Skin's children and are useful to organize your Skin's file's directories.

Processor: With this tag you can define a specific template processor overriding default one. If you create your own template processor and write template's content with your own "language", you must declare your processor's class name with this tag.

Template: Defines a piece of your application User Interface (snippet). Templates are contained by a Skin and have a content, elements and constants. You can define a specific template processor in a template, overriding default behavior. It is very important to define templates properly to minimize maintenance and improve reusability.

Content: It's included into a template tag and declares the template content. Content is XML CDATA so you can use any type of markup language. You can put HTML in content and use parameters and resources to be interpreted by the template processor. If you use Velocity, this is the place where Velocity templates are defined. You can also put Content in individual files and use the url attribute to point to that file. Content can use elements, constants and parameters to generate dynamic content, but it can also be static to generate static content.

Element: This is a resource like an image, a css, a flash, wav, etc. It can be used by templates or from outside a template environment. Defining elements helps you to organize you skin's files and easily change them without impact over templates. Elements can be defined al Skin level (visibility from all skin's templates) or at Template level (visibility only from the template). Element uses skin's paths and adds a URI for the element. So, element's URI is composed by Skin's URI, Path's URI and element's URI.

Constant: This is the other resource type and, like Element, can be defined al Skin level or template level and can be used from templates or from outside a template. The difference with elements is that constants do not use paths and are intended to be used to declare fixed values like colors, font type, etc. that can be overridden from other skins to change template appearence.



Print version | Download | Powered by SourceForge.net