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 TemplateIdentifiers
TemplateIdentifiers.Scope -
Field Summary
Fields inherited from interface 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.joda.time.DateTimeZonebooleanAdds freemarker compress directive if true.booleanbooleanvoidsetAttribute(String name, Object value) Insert a value into the template's model.voidsetAttributes(Map<String, Object> attributes) voidsetBaseData(Entity baseData) Shortcut to write an Entity to the basedata variablevoidsetBaseData(EntityList baseData) Shortcut to write an EntityList to the basedata variablevoidsetCharset(String charset) voidsetCompress(boolean compress) voidsetDateTimeZone(org.joda.time.DateTimeZone dateTimeZone) voidsetEntityData(String name, Entity entity) Deprecated.entities can now be inserted in the template model just like any other objects...voidsetEntityData(String name, EntityList entityList) Deprecated.entities can now be inserted in the template model just like any other objects...voidsetEntityData(String name, Collection<Entity> entityList) Deprecated.entities can now be inserted in the template model just like any other objects...voidsetHtmlEscape(boolean htmlEscape) voidsetLocalizedTemplateLookup(boolean localizedTemplateLookup) voidsetRecipient(Entity recipient) Shortcut to write an Entity to the recipient variablevoidsetRecipient(EntityList recipient) Shortcut to write an EntityList to the recipient variablevoidsetSingleBase(Entity singleBase) Shortcut to write an Entity to the single base variablevoidShortcut to write an Entity to the target variablevoidsetTemplate(String template) set template for TemplateEnginevoidsetTemplateLoaderName(String templateLoaderName) voidsetTemplateName(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:
setTemplateNamein interfaceNice2Template- Parameters:
templateName- a string identifying the name of the template
-
setTemplate
set template for TemplateEngine- Specified by:
setTemplatein interfaceNice2Template- Parameters:
template- String containing the template
-
setTemplateLoaderName
- Specified by:
setTemplateLoaderNamein interfaceNice2Template
-
setLocalizedTemplateLookup
public void setLocalizedTemplateLookup(boolean localizedTemplateLookup) - Specified by:
setLocalizedTemplateLookupin interfaceNice2Template
-
setBaseData
Shortcut to write an EntityList to the basedata variable- Specified by:
setBaseDatain 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:
setBaseDatain 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:
setRecipientin 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:
setRecipientin 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:
setSingleBasein interfaceNice2Template- Parameters:
singleBase- the singleBase entity
-
setTarget
Shortcut to write an Entity to the target variable- Specified by:
setTargetin interfaceNice2Template- Parameters:
target- the target entity
-
setCharset
- Specified by:
setCharsetin interfaceNice2Template- Parameters:
charset- the charset of the template (default is UTF-8)
-
setAttributes
- Specified by:
setAttributesin interfaceNice2Template- Parameters:
attributes- a map containing arbitrary attributes for the report (default is an empty map)
-
setAttribute
Description copied from interface:Nice2TemplateInsert a value into the template's model. Any object can be inserted into the model using this method.- Specified by:
setAttributein 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:
setDateTimeZonein 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:
setEntityDatain interfaceNice2Template- See Also:
-
setEntityData
Deprecated.entities can now be inserted in the template model just like any other objects...- Specified by:
setEntityDatain interfaceNice2Template- See Also:
-
setEntityData
Deprecated.entities can now be inserted in the template model just like any other objects...- Specified by:
setEntityDatain interfaceNice2Template- See Also:
-
toString
-
isCompress
public boolean isCompress()Adds freemarker compress directive if true. It will remove new lines and multiple spaces.- Specified by:
isCompressin interfaceNice2Template
-
setCompress
public void setCompress(boolean compress) - Specified by:
setCompressin interfaceNice2Template
-
isHtmlEscape
public boolean isHtmlEscape()- Specified by:
isHtmlEscapein interfaceNice2Template
-
setHtmlEscape
public void setHtmlEscape(boolean htmlEscape) - Specified by:
setHtmlEscapein interfaceNice2Template
-