public class FreeMarkerInlineRenderUtils extends Object
Constructor and Description |
---|
FreeMarkerInlineRenderUtils() |
Modifier and Type | Method and Description |
---|---|
static freemarker.ext.beans.BeansWrapper |
getBeansWrapper(freemarker.core.Environment env)
Get the object wrapper from the FreeMarker environment, as a
BeansWrapper . |
static void |
renderAttrBuild(Component component,
Writer out)
Render common attributes for a KRAD component.
|
static void |
renderCloseDiv(Writer out)
Render a close div tag for a component.
|
static void |
renderCloseGroupWrap(freemarker.core.Environment env,
Group group)
Render close tags wrapping a group component.
|
static void |
renderCollectionGroup(freemarker.core.Environment env,
CollectionGroup group)
Render a collection group inline.
|
static void |
renderOpenDiv(Component component,
Writer out)
Render an open div tag for a component.
|
static void |
renderOpenGroupWrap(freemarker.core.Environment env,
Group group)
Render open tags wrapping a group component.
|
static void |
renderScript(String script,
Component component,
String role,
Writer out)
Render a KRAD script component.
|
static void |
renderStacked(freemarker.core.Environment env,
List<? extends Component> items,
StackedLayoutManager manager,
CollectionGroup container)
Render a stacked collection inline.
|
static void |
renderTemplate(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 void |
renderTooltip(Component component,
Writer out)
Render a KRAD tooltip component.
|
static <T> T |
resolve(freemarker.core.Environment env,
String name)
Resolve a FreeMarker environment variable as a Java object.
|
static <T> T |
resolve(freemarker.core.Environment env,
String name,
Class<T> type)
Resolve a FreeMarker environment variable as a Java object, with type enforcement.
|
static freemarker.template.TemplateModel |
resolveModel(freemarker.core.Environment env,
String name)
Resovle a FreeMarker variable as a FreeMarker template model object.
|
public FreeMarkerInlineRenderUtils()
public static <T> T resolve(freemarker.core.Environment env, String name)
env
- The FreeMarker environment.name
- The name of the variable.for the preferred means to resolve variables for
inline rendering.
public static <T> T resolve(freemarker.core.Environment env, String name, Class<T> type)
This method is the preferred means to resolve variables for inline rendering.
env
- The FreeMarker environment.name
- The name of the variable.type
- The expected type of the variable.public static freemarker.ext.beans.BeansWrapper getBeansWrapper(freemarker.core.Environment env)
BeansWrapper
.env
- The FreeMarker environment.BeansWrapper
.public static freemarker.template.TemplateModel resolveModel(freemarker.core.Environment env, String name)
env
- The FreeMarker environment.name
- The name of the variable.for the preferred means to resolve variables for
inline rendering.
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, IOException
This method originated as template.ftl, and supercedes the previous content of that template.
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.freemarker.template.TemplateException
- If FreeMarker rendering fails.IOException
- If rendering is interrupted due to an I/O error.public static void renderTooltip(Component component, Writer out) throws IOException
This method originated as template.ftl, and supercedes the previous content of that template.
component
- The component to render a tooltip for.out
- The output writer to render to, typically from Environment.getOut()
.IOException
- If rendering is interrupted due to an I/O error.public static void renderScript(String script, Component component, String role, Writer out) throws IOException
This method originated as script.ftl, and supercedes the previous content of that template.
script
- The script to render.component
- The component the script is related to.out
- The output writer to render to, typically from Environment.getOut()
.IOException
- If rendering is interrupted due to an I/O error.public static void renderAttrBuild(Component component, Writer out) throws IOException
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.
component
- The component to open a render attributes for.out
- The output writer to render to, typically from Environment.getOut()
.IOException
- If rendering is interrupted due to an I/O error.public static void renderOpenDiv(Component component, Writer out) throws IOException
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.
component
- The component to render a wrapper div for.out
- The output writer to render to, typically from Environment.getOut()
.IOException
- If rendering is interrupted due to an I/O error.public static void renderCloseDiv(Writer out) throws IOException
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.
out
- The output writer to render to, typically from Environment.getOut()
.IOException
- If rendering is interrupted due to an I/O error.public static void renderOpenGroupWrap(freemarker.core.Environment env, Group group) throws IOException, freemarker.template.TemplateException
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 to
renderOpenGroupWrap(Environment, Group)
.
This method originated as groupWrap.ftl, and supercedes the previous content of that template.
env
- The FreeMarker environment to use for rendering.group
- The group to render open wrapper tags for.IOException
- If rendering is interrupted due to an I/O error.freemarker.template.TemplateException
- If FreeMarker rendering fails.public static void renderCloseGroupWrap(freemarker.core.Environment env, Group group) throws IOException, freemarker.template.TemplateException
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 to
renderOpenGroupWrap(Environment, Group)
.
This method originated as groupWrap.ftl, and supercedes the previous content of that template.
env
- The FreeMarker environment to use for rendering.group
- The group to render open wrapper tags for.IOException
- If rendering is interrupted due to an I/O error.freemarker.template.TemplateException
- If FreeMarker rendering fails.public static void renderCollectionGroup(freemarker.core.Environment env, CollectionGroup group) throws IOException, freemarker.template.TemplateException
This method originated as collectionGroup.ftl, and supercedes the previous content of that template.
group
- The collection group to render.IOException
- If rendering is interrupted due to an I/O error.freemarker.template.TemplateException
- If FreeMarker rendering fails.public static void renderStacked(freemarker.core.Environment env, List<? extends Component> items, StackedLayoutManager manager, CollectionGroup container) throws IOException, freemarker.template.TemplateException
This method originated as stacked.ftl, and supercedes the previous content of that template.
env
- The FreeMarker environmentitems
- List of items to render in a stacked layoutmanager
- Layout manager for the containercontainer
- Container to renderIOException
- If rendering is interrupted due to an I/O error.freemarker.template.TemplateException
- If FreeMarker rendering fails.Copyright © 2005–2014 The Kuali Foundation. All rights reserved.