Class FreemarkerNice2Template
java.lang.Object
ch.tocco.nice2.templating.impl.freemarker.FreemarkerNice2Template
- All Implemented Interfaces:
TemplateIdentifiers
,Nice2Template
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.templating.api.freemarker.directives.TemplateIdentifiers
TemplateIdentifiers.Scope
-
Field Summary
Fields inherited from interface ch.tocco.nice2.templating.api.freemarker.directives.TemplateIdentifiers
BASEDATA_VAR, DELIMITER_PARAM, ENTITY_PARAM, INLINE_TEMPLATE, KEY, LIMIT_PARAM, LINE_END_PARAM, LINE_START_PARAM, NAME_PARAM, PATH_PARAM, PATHS_PARAM, PATTERN_PARAM, RECIPIENT_VAR, SCOPE_PARAM, SENDER_VAR, SINGLE_BASE_VAR, TARGET_VAR, VALUE_PARAM
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.joda.time.DateTimeZone
boolean
Adds freemarker compress directive if true.boolean
boolean
void
setAttribute
(String name, Object value) Insert a value into the template's model.void
setAttributes
(Map<String, Object> attributes) void
setBaseData
(Entity baseData) Shortcut to write an Entity to the basedata variablevoid
setBaseData
(EntityList baseData) Shortcut to write an EntityList to the basedata variablevoid
setCharset
(String charset) void
setCompress
(boolean compress) void
setDateTimeZone
(org.joda.time.DateTimeZone dateTimeZone) void
setEntityData
(String name, Entity entity) Deprecated.entities can now be inserted in the template model just like any other objects...void
setEntityData
(String name, EntityList entityList) Deprecated.entities can now be inserted in the template model just like any other objects...void
setEntityData
(String name, Collection<Entity> entityList) Deprecated.entities can now be inserted in the template model just like any other objects...void
setHtmlEscape
(boolean htmlEscape) void
setLocalizedTemplateLookup
(boolean localizedTemplateLookup) void
setRecipient
(Entity recipient) Shortcut to write an Entity to the recipient variablevoid
setRecipient
(EntityList recipient) Shortcut to write an EntityList to the recipient variablevoid
setSingleBase
(Entity singleBase) Shortcut to write an Entity to the single base variablevoid
Shortcut to write an Entity to the target variablevoid
setTemplate
(String template) set template for TemplateEnginevoid
setTemplateLoaderName
(String templateLoaderName) void
setTemplateName
(String templateName) Set a name for the template.toString()
-
Constructor Details
-
FreemarkerNice2Template
public FreemarkerNice2Template()
-
-
Method Details
-
getTemplateName
-
getTemplate
-
getTemplateLoaderName
-
isLocalizedTemplateLookup
public boolean isLocalizedTemplateLookup() -
getCharset
-
getAttributes
-
getDateTimeZone
public org.joda.time.DateTimeZone getDateTimeZone() -
setTemplateName
Set a name for the template. If you plan on reusing a template name it using this method.- Specified by:
setTemplateName
in interfaceNice2Template
- Parameters:
templateName
- a string identifying the name of the template
-
setTemplate
set template for TemplateEngine- Specified by:
setTemplate
in interfaceNice2Template
- Parameters:
template
- String containing the template
-
setTemplateLoaderName
- Specified by:
setTemplateLoaderName
in interfaceNice2Template
-
setLocalizedTemplateLookup
public void setLocalizedTemplateLookup(boolean localizedTemplateLookup) - Specified by:
setLocalizedTemplateLookup
in interfaceNice2Template
-
setBaseData
Shortcut to write an EntityList to the basedata variable- Specified by:
setBaseData
in interfaceNice2Template
- Parameters:
baseData
- an EntityList containing base data for the template (default is an empty list of base data)
-
setBaseData
Shortcut to write an Entity to the basedata variable- Specified by:
setBaseData
in interfaceNice2Template
- Parameters:
baseData
- an Entity representing the base data for the template (default is no base data)
-
setRecipient
Shortcut to write an EntityList to the recipient variable- Specified by:
setRecipient
in interfaceNice2Template
- Parameters:
recipient
- an EntityList containing the recipient of the template (default is an empty list of recipient)
-
setRecipient
Shortcut to write an Entity to the recipient variable- Specified by:
setRecipient
in interfaceNice2Template
- Parameters:
recipient
- Entity representing the recipient of the template (default is no recipient)
-
setSingleBase
Shortcut to write an Entity to the single base variable- Specified by:
setSingleBase
in interfaceNice2Template
- Parameters:
singleBase
- the singleBase entity
-
setTarget
Shortcut to write an Entity to the target variable- Specified by:
setTarget
in interfaceNice2Template
- Parameters:
target
- the target entity
-
setCharset
- Specified by:
setCharset
in interfaceNice2Template
- Parameters:
charset
- the charset of the template (default is UTF-8)
-
setAttributes
- Specified by:
setAttributes
in interfaceNice2Template
- Parameters:
attributes
- a map containing arbitrary attributes for the report (default is an empty map)
-
setAttribute
Description copied from interface:Nice2Template
Insert a value into the template's model. Any object can be inserted into the model using this method.- Specified by:
setAttribute
in interfaceNice2Template
- Parameters:
name
- the name of the attribute to setvalue
- the value to set
-
setDateTimeZone
public void setDateTimeZone(org.joda.time.DateTimeZone dateTimeZone) - Specified by:
setDateTimeZone
in interfaceNice2Template
- Parameters:
dateTimeZone
- time zone for the template (default is default time zone of project (i18n.timezone.default))
-
setEntityData
Deprecated.entities can now be inserted in the template model just like any other objects...- Specified by:
setEntityData
in interfaceNice2Template
- See Also:
-
setEntityData
Deprecated.entities can now be inserted in the template model just like any other objects...- Specified by:
setEntityData
in interfaceNice2Template
- See Also:
-
setEntityData
Deprecated.entities can now be inserted in the template model just like any other objects...- Specified by:
setEntityData
in interfaceNice2Template
- See Also:
-
toString
-
isCompress
public boolean isCompress()Adds freemarker compress directive if true. It will remove new lines and multiple spaces.- Specified by:
isCompress
in interfaceNice2Template
-
setCompress
public void setCompress(boolean compress) - Specified by:
setCompress
in interfaceNice2Template
-
isHtmlEscape
public boolean isHtmlEscape()- Specified by:
isHtmlEscape
in interfaceNice2Template
-
setHtmlEscape
public void setHtmlEscape(boolean htmlEscape) - Specified by:
setHtmlEscape
in interfaceNice2Template
-