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.
| Parameter | Description |
|---|---|
templatePath | the template path to render |
aThis | the resource being rendered, used to resolve which theme applies |
params | request parameters to pass through to the underlying templater |
out | the 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.
| Parameter | Description |
|---|---|
themeName | the name of the theme to render with |
templatePath | the template path to render |
aThis | the resource being rendered |
params | request parameters to pass through to the underlying templater |
out | the 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.
| Parameter | Description |
|---|---|
page | the page to resolve CSS paths for |
findTemplater(Resource aThis)
Returns: HtmlTemplater
Resolves the HtmlTemplater of the theme that applies to the given resource.
| Parameter | Description |
|---|---|
aThis | the 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.
| Parameter | Description |
|---|---|
source | the 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.
| Parameter | Description |
|---|---|
source | the path of the JS resource to include |
group | the 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.
| Parameter | Description |
|---|---|
source | the path of the JS resource to include |
group | the group the resource is added to, groups are typically rendered together |
position | the 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.
| Parameter | Description |
|---|---|
source | the path of the CSS resource to include |
media | the 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.
| Parameter | Description |
|---|---|
source | the 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.
| Parameter | Description |
|---|---|
source | the path of the LESS resource to include |
media | the 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.
| Parameter | Description |
|---|---|
source | the path of the LESS resource to include |
media | the CSS media attribute to render the compiled resource under |
pos | the position to insert the resource at, may be null to append |