FileDocCategorySizeDatePackage
Template.javaAPI DocExample2747Mon Jul 23 13:26:36 BST 2007org.apache.struts2.components.template

Template

public class Template extends Object implements Cloneable
A template.

A template is used as a model for rendering output. This object contains basic common template information

Fields Summary
String
dir
String
theme
String
name
Constructors Summary
public Template(String dir, String theme, String name)
Constructor.

param
dir base folder where the template is stored.
param
theme the theme of the template
param
name the name of the template.

        this.dir = dir;
        this.theme = theme;
        this.name = name;
    
Methods Summary
protected java.lang.Objectclone()

        return super.clone();
    
public java.lang.StringgetDir()

        return dir;
    
public java.lang.StringgetName()

        return name;
    
public java.util.ListgetPossibleTemplates(TemplateEngine engine)

        List list = new ArrayList(3);
        Template template = this;
        String parentTheme;
        list.add(template);
        while ((parentTheme = (String) engine.getThemeProps(template).get("parent")) != null) {
            try {
                template = (Template) template.clone();
                template.theme = parentTheme;
                list.add(template);
            } catch (CloneNotSupportedException e) {
                // do nothing
            }
        }

        return list;
    
public java.lang.StringgetTheme()

        return theme;
    
public java.lang.StringtoString()
Constructs a string in the format /dir/theme/name.

return
a string in the format /dir/theme/name.

        return "/" + dir + "/" + theme + "/" + name;