wicket.extensions.util.resource
Class TextTemplateHeaderContributor

java.lang.Object
  extended bywicket.behavior.AbstractBehavior
      extended bywicket.behavior.AbstractHeaderContributor
          extended bywicket.behavior.StringHeaderContributor
              extended bywicket.extensions.util.resource.TextTemplateHeaderContributor
All Implemented Interfaces:
wicket.behavior.IBehavior, wicket.markup.html.IHeaderContributor, java.io.Serializable

public class TextTemplateHeaderContributor
extends wicket.behavior.StringHeaderContributor

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

Author:
Eelco Hillenius
See Also:
Serialized Form

Constructor Summary
protected TextTemplateHeaderContributor(TextTemplate template, wicket.model.IModel variablesModel)
          Construct.
 
Method Summary
static TextTemplateHeaderContributor forCss(java.lang.Class clazz, java.lang.String fileName, wicket.model.IModel variablesModel)
          Gets a css header contributor that will load the template from the given file name relative to (/in the same package as) the provided clazz argument.
static TextTemplateHeaderContributor forCss(TextTemplate template, wicket.model.IModel variablesModel)
          Gets a css header contributor based on the given text template.
static TextTemplateHeaderContributor forJavaScript(java.lang.Class clazz, java.lang.String fileName, wicket.model.IModel variablesModel)
          Gets a javascript header contributor that will load the template from the given file name relative to (/in the same package as) the provided clazz argument.
static TextTemplateHeaderContributor forJavaScript(TextTemplate template, wicket.model.IModel variablesModel)
          Gets a javascript header contributor based on the given text template.
 
Methods inherited from class wicket.behavior.StringHeaderContributor
detachModel, getHeaderContributors, toString
 
Methods inherited from class wicket.behavior.AbstractHeaderContributor
cleanup, renderHead
 
Methods inherited from class wicket.behavior.AbstractBehavior
bind, exception, 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,
                                        wicket.model.IModel variablesModel)
Construct.

Parameters:
template - The template with the contribution
variablesModel - Optional model for variable substitution
Method Detail

forCss

public static TextTemplateHeaderContributor forCss(TextTemplate template,
                                                   wicket.model.IModel variablesModel)
Gets a css header contributor based on the given text template. 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 text template that is the base for the contribution
variablesModel - The variables to interpolate
Returns:
The header contributor instance

forCss

public static TextTemplateHeaderContributor forCss(java.lang.Class clazz,
                                                   java.lang.String fileName,
                                                   wicket.model.IModel variablesModel)
Gets a css header contributor that will load the template from the given file name relative to (/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 header contributor instance

forJavaScript

public static TextTemplateHeaderContributor forJavaScript(TextTemplate template,
                                                          wicket.model.IModel variablesModel)
Gets a javascript header contributor based on the given text template. 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 text template that is the base for the contribution
variablesModel - The variables to interpolate
Returns:
The header contributor instance

forJavaScript

public static TextTemplateHeaderContributor forJavaScript(java.lang.Class clazz,
                                                          java.lang.String fileName,
                                                          wicket.model.IModel variablesModel)
Gets a javascript header contributor that will load the template from the given file name relative to (/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 header contributor instance


Copyright © 2004-2008 Wicket developers. All Rights Reserved.