Dispatching implementation of HtmlTemplater that delegates every call to the HtmlTemplater of the current or a named theme, resolved via ThemeManager. Registered as the templater used to render pages and push JS, CSS and LESS resources so that each root folder is rendered with the templater its active theme provides, without callers needing to know which theme is active.

Implements: HtmlTemplater


Methods

writePage(String templatePath, Resource aThis, Map<String,String> params, OutputStream out) · writePage(String themeName, String templatePath, Resource aThis, Map<String,String> params, OutputStream out) · getCssPaths(FileResource page) · findTemplater(Resource aThis) · pushJs(String source) · pushJs(String source, String group) · pushJs(String source, String group, Integer position) · pushCss(String source, String media) · pushCss(String source) · pushLess(String source, String media) · pushLess(String source, String media, Integer pos)

writePage(String templatePath, Resource aThis, Map<String,String> params, OutputStream out)

Returns: void

Renders the given resource using the theme resolved from it, by delegating to that theme's HtmlTemplater.

ParameterDescription
templatePaththe template path to render
aThisthe resource being rendered, used to resolve which theme applies
paramsrequest parameters to pass through to the underlying templater
outthe stream the rendered page is written to

writePage(String themeName, String templatePath, Resource aThis, Map<String,String> params, OutputStream out)

Returns: void

Renders the given resource using the named theme, by delegating to that theme's HtmlTemplater.

ParameterDescription
themeNamethe name of the theme to render with
templatePaththe template path to render
aThisthe resource being rendered
paramsrequest parameters to pass through to the underlying templater
outthe stream the rendered page is written to

getCssPaths(FileResource page)

Returns: List<String>

The CSS resource paths required to render the given page, resolved from the templater of the theme that applies to it.

ParameterDescription
pagethe page to resolve CSS paths for

findTemplater(Resource aThis)

Returns: HtmlTemplater

Resolves the HtmlTemplater of the theme that applies to the given resource.

ParameterDescription
aThisthe resource to resolve a theme and templater for

pushJs(String source)

Returns: String

Registers a JS resource to be included on the current page, for the default group, delegating to the templater of the theme active for the current root folder.

ParameterDescription
sourcethe path of the JS resource to include

pushJs(String source, String group)

Returns: String

Registers a JS resource to be included on the current page, for the given group, with no explicit position.

ParameterDescription
sourcethe path of the JS resource to include
groupthe group the resource is added to, groups are typically rendered together

pushJs(String source, String group, Integer position)

Returns: String

Registers a JS resource to be included on the current page, for the given group and position. Caches the resolved templater on the current request so repeated calls do not re-resolve the active theme.

ParameterDescription
sourcethe path of the JS resource to include
groupthe group the resource is added to, groups are typically rendered together
positionthe position within the group to insert the resource at, may be null to append

pushCss(String source, String media)

Returns: String

Registers a CSS resource to be included on the current page, for the given media type. Caches the resolved templater on the current request so repeated calls do not re-resolve the active theme.

ParameterDescription
sourcethe path of the CSS resource to include
mediathe CSS media attribute to render the resource under, for example "all" or "print"

pushCss(String source)

Returns: String

Registers a CSS resource to be included on the current page, with no specific media type, delegating to the templater of the theme active for the current root folder.

ParameterDescription
sourcethe path of the CSS resource to include

pushLess(String source, String media)

Returns: String

Registers a LESS resource to be included on the current page, for the given media type, with no explicit position.

ParameterDescription
sourcethe path of the LESS resource to include
mediathe CSS media attribute to render the compiled resource under

pushLess(String source, String media, Integer pos)

Returns: String

Registers a LESS resource to be included on the current page, for the given media type and position, delegating to the templater of the theme active for the current root folder.

ParameterDescription
sourcethe path of the LESS resource to include
mediathe CSS media attribute to render the compiled resource under
posthe position to insert the resource at, may be null to append
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.