org.apache.wicket.util.template
Class TextTemplateHeaderContributor

java.lang.Object
  extended by org.apache.wicket.behavior.AbstractBehavior
      extended by org.apache.wicket.behavior.AbstractHeaderContributor
          extended by org.apache.wicket.behavior.StringHeaderContributor
              extended by org.apache.wicket.util.template.TextTemplateHeaderContributor
All Implemented Interfaces:
java.io.Serializable, IBehavior, IClusterable, IHeaderContributor

public class TextTemplateHeaderContributor
extends StringHeaderContributor

A header contributor that will contribute the contents of the given template interpolated with the provided Map of variables.

Since:
1.2.6
Author:
Eelco Hillenius
See Also:
Serialized Form

Constructor Summary
protected TextTemplateHeaderContributor(TextTemplate template, IModel variablesModel)
          Constructor.
 
Method Summary
static TextTemplateHeaderContributor forCss(java.lang.Class clazz, java.lang.String fileName, IModel variablesModel)
          Retrieves a CSS header contributor that will load the template from the given file name relative to (or in the same package as) the provided clazz argument.
static TextTemplateHeaderContributor forCss(TextTemplate template, IModel variablesModel)
          Retrieves a CSS header contributor based on the given TextTemplate.
static TextTemplateHeaderContributor forJavaScript(java.lang.Class clazz, java.lang.String fileName, IModel variablesModel)
          Retrieves a JavaScript header contributor that will load the template from the given file name relative to (or in the same package as) the provided clazz argument.
static TextTemplateHeaderContributor forJavaScript(TextTemplate template, IModel variablesModel)
          Retrieves a JavaScript header contributor based on the given TextTemplate.
 
Methods inherited from class org.apache.wicket.behavior.StringHeaderContributor
detach, getHeaderContributors, toString
 
Methods inherited from class org.apache.wicket.behavior.AbstractHeaderContributor
renderHead
 
Methods inherited from class org.apache.wicket.behavior.AbstractBehavior
afterRender, beforeRender, bind, cleanup, detachModel, exception, getStatelessHint, isEnabled, isTemporary, onComponentTag, onException, onRendered, rendered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextTemplateHeaderContributor

protected TextTemplateHeaderContributor(TextTemplate template,
                                        IModel variablesModel)
Constructor.

Parameters:
template - the TextTemplate with the contribution
variablesModel - optional IModel for variable substitution
Method Detail

forCss

public static TextTemplateHeaderContributor forCss(TextTemplate template,
                                                   IModel variablesModel)
Retrieves a CSS header contributor based on the given TextTemplate. The template will be interpolated with the given variables. The content will be written as the body of a script/tag pair.

Parameters:
template - the TextTemplate that is the base for the contribution
variablesModel - the variables to interpolate
Returns:
the TextTemplateHeaderContributor instance

forCss

public static TextTemplateHeaderContributor forCss(java.lang.Class clazz,
                                                   java.lang.String fileName,
                                                   IModel variablesModel)
Retrieves a CSS header contributor that will load the template from the given file name relative to (or in the same package as) the provided clazz argument. The template will be interpolated with the given variables. The content will be written as the body of a script/tag pair.

Parameters:
clazz - the Class to be used for retrieving the classloader for loading the packaged template.
fileName - the name of the file, relative to the clazz position
variablesModel - the variables to interpolate
Returns:
the TextTemplateHeaderContributor instance

forJavaScript

public static TextTemplateHeaderContributor forJavaScript(TextTemplate template,
                                                          IModel variablesModel)
Retrieves a JavaScript header contributor based on the given TextTemplate. The template will be interpolated with the given variables. The content will be written as the body of a script/tag pair.

Parameters:
template - the TextTemplate that is the base for the contribution
variablesModel - the variables to interpolate
Returns:
the TextTemplateHeaderContributor instance

forJavaScript

public static TextTemplateHeaderContributor forJavaScript(java.lang.Class clazz,
                                                          java.lang.String fileName,
                                                          IModel variablesModel)
Retrieves a JavaScript header contributor that will load the template from the given file name relative to (or in the same package as) the provided clazz argument. The template will be interpolated with the given variables. The content will be written as the body of a script/tag pair.

Parameters:
clazz - the Class to be used for retrieving the classloader for loading the packaged template.
fileName - the name of the file, relative to the clazz position
variablesModel - the variables to interpolate
Returns:
the TextTemplateHeaderContributor instance


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.