Renders a page by combining a theme's chrome with a single template body, using the TextTemplater to process the Velocity template and then running the dynamic component service over the result. Used for the simpler, non-themed page rendering path, for example the blank template used to render PDFs, as opposed to the full VelocityHtmlTemplater used for themed website and admin pages.

Implements: HtmlTemplater


Properties

PropertyReturnsDescription
cssSourcesMap<String,List<String>>The CSS resources pushed onto the current request so far, keyed by media type.
jsSourcesMap<String,List<String>>The JS resources pushed onto the current request so far, keyed by group, with each group's sources in the order they were pushed.
lessSourcesMap<String,List<String>>The LESS resources pushed onto the current request so far, keyed by media type. Populated by pushLess.
webRootStringThe configured web root path used when resolving template paths.

Methods

writePage(String templatePath, Resource aThis, Map<String,String> params, OutputStream out) · writePage(String theme, String templatePath, Resource aThis, Map<String,String> params, OutputStream out) · getCssPaths(FileResource page) · getWebRoot() · getLessSources() · getCombinedPath(List paths) · pushJs(String source) · pushJs(String source, String group) · pushJs(String source, String group, Integer position) · getJsSources() · getJsSources(String group) · getCombinedJsPath(List<String> paths) · getCombinedJsPath(String group) · pushCss(String source, String media) · getCssSources() · getCombinedJsPaths(String group) · getCombinedCssPath(List<String> paths) · getClassName(Object resource) · pushCss(String source) · pushLess(String source, String media, Integer pos) · pushLess(String source, String media)

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

Returns: void

Renders the given resource, resolving the theme to use from the resource itself, for example checking whether it implements CommonResource and finding an appropriate theme from its root folder.

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

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

Returns: void

Generates a templated page with the given theme and template. The theme controls the chrome, ie the menu, header and footer, while the template controls the layout of this specific page, such as a contacts list or a calendar. The rendered body is then passed through the dynamic component service before being written out.

ParameterDescription
themethe theme to render the page's chrome with
templatePaththe template path to render as the page body
aThisthe resource being rendered
paramsrequest parameters made available to the template
outthe stream the rendered page is written to

getCssPaths(FileResource page)

Returns: List<String>

The CSS resource paths required to render the given page. Not implemented for this templater, always returns an empty list.

ParameterDescription
pagethe page to resolve CSS paths for

getWebRoot()

Returns: String

The configured web root path used when resolving template paths.

getLessSources()

Returns: Map<String,List<String>>

The LESS resources pushed onto the current request so far, keyed by media type. Populated by pushLess.

getCombinedPath(List paths)

Returns: String

Munges the given LESS or CSS resource paths into a single combined path that the LESS compilation endpoint can expand back out, with a cache-busting version hash appended.

ParameterDescription
pathsthe resource paths to combine, either plain strings or ComponentHtmlTemplater.SourceAndPosition instances

pushJs(String source)

Returns: String

Registers a JS resource to be included on the current page, for the default group.

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. Duplicate sources within the same group are not added twice.

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

getJsSources()

Returns: Map<String,List<String>>

The JS resources pushed onto the current request so far, keyed by group, with each group's sources in the order they were pushed.

getJsSources(String group)

Returns: List<String>

The JS resource paths pushed onto the current request so far for the given group, in the order they were pushed.

ParameterDescription
groupthe group to look up pushed JS resources for

getCombinedJsPath(List<String> paths)

Returns: String

Munges the given JS resource paths into a single combined path that the JS combine endpoint can expand back out, with a cache-busting version hash appended.

ParameterDescription
pathsthe JS resource paths to combine

getCombinedJsPath(String group)

Returns: String

Munges the JS resources pushed for the given group into a single combined path, with a cache-busting version hash appended.

ParameterDescription
groupthe group whose pushed JS resources are combined

pushCss(String source, String media)

Returns: String

Registers a CSS resource to be included on the current page, for the given media type.

ParameterDescription
sourcethe path of the CSS resource to include
mediathe CSS media attribute to render the resource under, defaults to an empty string if null

getCssSources()

Returns: Map<String,List<String>>

The CSS resources pushed onto the current request so far, keyed by media type.

getCombinedJsPaths(String group)

Returns: List<String>

Munges the JS resources pushed for the given group into one or more combined paths, splitting into multiple combined paths if the munged path would exceed the maximum length.

ParameterDescription
groupthe group whose pushed JS resources are combined

getCombinedCssPath(List<String> paths)

Returns: String

Munges the given CSS resource paths into a single combined path that the CSS combine endpoint can expand back out, with a cache-busting version hash appended.

ParameterDescription
pathsthe CSS resource paths to combine

getClassName(Object resource)

Returns: String

The simple, unqualified class name of the given object, used by templates for example to derive a CSS class from the type of page being rendered.

ParameterDescription
resourcethe object to get the simple class name of

pushCss(String source)

Returns: String

Registers a CSS resource to be included on the current page, with no specific media type.

ParameterDescription
sourcethe path of the CSS resource to include

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.

ParameterDescription
sourcethe path of the LESS resource to include
mediathe CSS media attribute to render the compiled resource under
posthe position within the media group to insert the resource at, may be null to append

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
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.