Class FreeMarkerInlineRenderUtils
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic freemarker.ext.beans.BeansWrappergetBeansWrapper(freemarker.core.Environment env) Get the object wrapper from the FreeMarker environment, as aBeansWrapper.static voidrenderAttrBuild(Component component, Writer out) Render common attributes for a KRAD component.static voidrenderCloseDiv(Writer out) Render a close div tag for a component.static voidrenderCloseGroupWrap(freemarker.core.Environment env, Group group) Render close tags wrapping a group component.static voidrenderCollectionGroup(freemarker.core.Environment env, CollectionGroup group) Render a collection group inline.static voidrenderOpenDiv(Component component, Writer out) Render an open div tag for a component.static voidrenderOpenGroupWrap(freemarker.core.Environment env, Group group) Render open tags wrapping a group component.static voidrenderScript(String script, Component component, String role, Writer out) Render a KRAD script component.static voidrenderStacked(freemarker.core.Environment env, List<? extends Component> items, StackedLayoutManager manager, CollectionGroup container) Render a stacked collection inline.static voidrenderTemplate(freemarker.core.Environment env, Component component, String body, boolean componentUpdate, boolean includeSrc, Map<String, freemarker.template.TemplateModel> tmplParms) Render a KRAD component template inline.static voidrenderTooltip(Component component, Writer out) Render a KRAD tooltip component.static <T> TResolve a FreeMarker environment variable as a Java object.static <T> TResolve a FreeMarker environment variable as a Java object, with type enforcement.static freemarker.template.TemplateModelresolveModel(freemarker.core.Environment env, String name) Resovle a FreeMarker variable as a FreeMarker template model object.
-
Constructor Details
-
FreeMarkerInlineRenderUtils
public FreeMarkerInlineRenderUtils()
-
-
Method Details
-
resolve
Resolve a FreeMarker environment variable as a Java object.- Parameters:
env- The FreeMarker environment.name- The name of the variable.- Returns:
- The FreeMarker variable, resolved as a Java object.
- See Also:
-
resolve
Resolve a FreeMarker environment variable as a Java object, with type enforcement.This method is the preferred means to resolve variables for inline rendering.
- Parameters:
env- The FreeMarker environment.name- The name of the variable.type- The expected type of the variable.- Returns:
- The FreeMarker variable, resolved as a Java object of the given type.
-
getBeansWrapper
public static freemarker.ext.beans.BeansWrapper getBeansWrapper(freemarker.core.Environment env) Get the object wrapper from the FreeMarker environment, as aBeansWrapper.- Parameters:
env- The FreeMarker environment.- Returns:
- The object wrapper from the FreeMarker environment, type-cast as
BeansWrapper.
-
resolveModel
public static freemarker.template.TemplateModel resolveModel(freemarker.core.Environment env, String name) Resovle a FreeMarker variable as a FreeMarker template model object.- Parameters:
env- The FreeMarker environment.name- The name of the variable.- Returns:
- The FreeMarker variable, resolved as a FreeMarker template model object.
- See Also:
-
renderTemplate
public static void renderTemplate(freemarker.core.Environment env, Component component, String body, boolean componentUpdate, boolean includeSrc, Map<String, freemarker.template.TemplateModel> tmplParms) throws freemarker.template.TemplateException, IOExceptionRender a KRAD component template inline.This method originated as template.ftl, and supercedes the previous content of that template.
- Parameters:
env- The FreeMarker environment.component- The component to render a template for.body- The nested body.componentUpdate- True if this is an update, false for full view.includeSrc- True to include the template source in the environment when rendering, false to skip inclusion.tmplParms- Additional parameters to pass to the template macro.- Throws:
freemarker.template.TemplateException- If FreeMarker rendering fails.IOException- If rendering is interrupted due to an I/O error.
-
renderTooltip
Render a KRAD tooltip component.This method originated as template.ftl, and supercedes the previous content of that template.
- Parameters:
component- The component to render a tooltip for.out- The output writer to render to, typically fromEnvironment.getOut().- Throws:
IOException- If rendering is interrupted due to an I/O error.
-
renderScript
public static void renderScript(String script, Component component, String role, Writer out) throws IOException Render a KRAD script component.This method originated as script.ftl, and supercedes the previous content of that template.
- Parameters:
script- The script to render.component- The component the script is related to.out- The output writer to render to, typically fromEnvironment.getOut().- Throws:
IOException- If rendering is interrupted due to an I/O error.
-
renderAttrBuild
Render common attributes for a KRAD component.NOTICE: By KULRICE-10353 this method duplicates, but does not replace, krad/WEB-INF/ftl/lib/attrBuild.ftl. When updating this method, also update that template.
- Parameters:
component- The component to open a render attributes for.out- The output writer to render to, typically fromEnvironment.getOut().- Throws:
IOException- If rendering is interrupted due to an I/O error.
-
renderOpenDiv
Render an open div tag for a component.NOTE: Inline rendering performance is improved by *not* passing continuations for nested body content, so the open div and close div methods are implemented separately. Always call
renderCloseDiv(Writer)after rendering the <div> body related to this open tag.NOTICE: By KULRICE-10353 this method duplicates, but does not replace, krad/WEB-INF/ftp/lib/div.ftl. When updating this method, also update that template.
- Parameters:
component- The component to render a wrapper div for.out- The output writer to render to, typically fromEnvironment.getOut().- Throws:
IOException- If rendering is interrupted due to an I/O error.
-
renderCloseDiv
Render a close div tag for a component.NOTE: Inline rendering performance is improved by *not* passing continuations for nested body content, so the open div and close div methods are implemented separately. Always call this method after rendering the <div> body related to and open tag rendered by
renderOpenDiv(Component, Writer).NOTICE: By KULRICE-10353 this method duplicates, but does not replace, krad/WEB-INF/ftp/lib/div.ftl. When updating this method, also update that template.
- Parameters:
out- The output writer to render to, typically fromEnvironment.getOut().- Throws:
IOException- If rendering is interrupted due to an I/O error.
-
renderOpenGroupWrap
public static void renderOpenGroupWrap(freemarker.core.Environment env, Group group) throws IOException, freemarker.template.TemplateException Render open tags wrapping a group component.NOTE: Inline rendering performance is improved by *not* passing continuations for nested body content, so the open and close methods are implemented separately. Always call
renderCloseGroupWrap(Environment, Group)after rendering the body related to a call torenderOpenGroupWrap(Environment, Group).This method originated as groupWrap.ftl, and supercedes the previous content of that template.
- Parameters:
env- The FreeMarker environment to use for rendering.group- The group to render open wrapper tags for.- Throws:
IOException- If rendering is interrupted due to an I/O error.freemarker.template.TemplateException- If FreeMarker rendering fails.
-
renderCloseGroupWrap
public static void renderCloseGroupWrap(freemarker.core.Environment env, Group group) throws IOException, freemarker.template.TemplateException Render close tags wrapping a group component.NOTE: Inline rendering performance is improved by *not* passing continuations for nested body content, so the open and close methods are implemented separately. Always call
renderCloseGroupWrap(Environment, Group)after rendering the body related to a call torenderOpenGroupWrap(Environment, Group).This method originated as groupWrap.ftl, and supercedes the previous content of that template.
- Parameters:
env- The FreeMarker environment to use for rendering.group- The group to render open wrapper tags for.- Throws:
IOException- If rendering is interrupted due to an I/O error.freemarker.template.TemplateException- If FreeMarker rendering fails.
-
renderCollectionGroup
public static void renderCollectionGroup(freemarker.core.Environment env, CollectionGroup group) throws IOException, freemarker.template.TemplateException Render a collection group inline.This method originated as collectionGroup.ftl, and supercedes the previous content of that template.
- Parameters:
group- The collection group to render.- Throws:
IOException- If rendering is interrupted due to an I/O error.freemarker.template.TemplateException- If FreeMarker rendering fails.
-
renderStacked
public static void renderStacked(freemarker.core.Environment env, List<? extends Component> items, StackedLayoutManager manager, CollectionGroup container) throws IOException, freemarker.template.TemplateException Render a stacked collection inline.This method originated as stacked.ftl, and supercedes the previous content of that template.
- Parameters:
env- The FreeMarker environmentitems- List of items to render in a stacked layoutmanager- Layout manager for the containercontainer- Container to render- Throws:
IOException- If rendering is interrupted due to an I/O error.freemarker.template.TemplateException- If FreeMarker rendering fails.
-