Class FreemarkerNice2Template

java.lang.Object
ch.tocco.nice2.templating.impl.freemarker.FreemarkerNice2Template
All Implemented Interfaces:
TemplateIdentifiers, Nice2Template

public class FreemarkerNice2Template extends Object implements Nice2Template, TemplateIdentifiers
  • Constructor Details

    • FreemarkerNice2Template

      public FreemarkerNice2Template()
  • Method Details

    • getTemplateName

      public String getTemplateName()
    • getTemplate

      public String getTemplate()
    • getTemplateLoaderName

      public String getTemplateLoaderName()
    • isLocalizedTemplateLookup

      public boolean isLocalizedTemplateLookup()
    • getCharset

      public String getCharset()
    • getAttributes

      public Map<String,Object> getAttributes()
    • getDateTimeZone

      public org.joda.time.DateTimeZone getDateTimeZone()
    • setTemplateName

      public void setTemplateName(String templateName)
      Set a name for the template. If you plan on reusing a template name it using this method.
      Specified by:
      setTemplateName in interface Nice2Template
      Parameters:
      templateName - a string identifying the name of the template
    • setTemplate

      public void setTemplate(String template)
      set template for TemplateEngine
      Specified by:
      setTemplate in interface Nice2Template
      Parameters:
      template - String containing the template
    • setTemplateLoaderName

      public void setTemplateLoaderName(String templateLoaderName)
      Specified by:
      setTemplateLoaderName in interface Nice2Template
    • setLocalizedTemplateLookup

      public void setLocalizedTemplateLookup(boolean localizedTemplateLookup)
      Specified by:
      setLocalizedTemplateLookup in interface Nice2Template
    • setBaseData

      public void setBaseData(EntityList baseData)
      Shortcut to write an EntityList to the basedata variable
      Specified by:
      setBaseData in interface Nice2Template
      Parameters:
      baseData - an EntityList containing base data for the template (default is an empty list of base data)
    • setBaseData

      public void setBaseData(Entity baseData)
      Shortcut to write an Entity to the basedata variable
      Specified by:
      setBaseData in interface Nice2Template
      Parameters:
      baseData - an Entity representing the base data for the template (default is no base data)
    • setRecipient

      public void setRecipient(EntityList recipient)
      Shortcut to write an EntityList to the recipient variable
      Specified by:
      setRecipient in interface Nice2Template
      Parameters:
      recipient - an EntityList containing the recipient of the template (default is an empty list of recipient)
    • setRecipient

      public void setRecipient(Entity recipient)
      Shortcut to write an Entity to the recipient variable
      Specified by:
      setRecipient in interface Nice2Template
      Parameters:
      recipient - Entity representing the recipient of the template (default is no recipient)
    • setSingleBase

      public void setSingleBase(Entity singleBase)
      Shortcut to write an Entity to the single base variable
      Specified by:
      setSingleBase in interface Nice2Template
      Parameters:
      singleBase - the singleBase entity
    • setTarget

      public void setTarget(Entity target)
      Shortcut to write an Entity to the target variable
      Specified by:
      setTarget in interface Nice2Template
      Parameters:
      target - the target entity
    • setCharset

      public void setCharset(String charset)
      Specified by:
      setCharset in interface Nice2Template
      Parameters:
      charset - the charset of the template (default is UTF-8)
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Specified by:
      setAttributes in interface Nice2Template
      Parameters:
      attributes - a map containing arbitrary attributes for the report (default is an empty map)
    • setAttribute

      public void setAttribute(String name, Object value)
      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 interface Nice2Template
      Parameters:
      name - the name of the attribute to set
      value - the value to set
    • setDateTimeZone

      public void setDateTimeZone(org.joda.time.DateTimeZone dateTimeZone)
      Specified by:
      setDateTimeZone in interface Nice2Template
      Parameters:
      dateTimeZone - time zone for the template (default is default time zone of project (i18n.timezone.default))
    • setEntityData

      @Deprecated public void setEntityData(String name, Entity entity)
      Deprecated.
      entities can now be inserted in the template model just like any other objects...
      Specified by:
      setEntityData in interface Nice2Template
      See Also:
    • setEntityData

      @Deprecated public void setEntityData(String name, EntityList entityList)
      Deprecated.
      entities can now be inserted in the template model just like any other objects...
      Specified by:
      setEntityData in interface Nice2Template
      See Also:
    • setEntityData

      @Deprecated public void setEntityData(String name, Collection<Entity> entityList)
      Deprecated.
      entities can now be inserted in the template model just like any other objects...
      Specified by:
      setEntityData in interface Nice2Template
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isCompress

      public boolean isCompress()
      Adds freemarker compress directive if true. It will remove new lines and multiple spaces.
      Specified by:
      isCompress in interface Nice2Template
    • setCompress

      public void setCompress(boolean compress)
      Specified by:
      setCompress in interface Nice2Template
    • isHtmlEscape

      public boolean isHtmlEscape()
      Specified by:
      isHtmlEscape in interface Nice2Template
    • setHtmlEscape

      public void setHtmlEscape(boolean htmlEscape)
      Specified by:
      setHtmlEscape in interface Nice2Template