Interface IFreeMarkerTemplateService

    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void addAutoImport​(java.lang.String strNamespace, java.lang.String strFile)
      Add an auto import file
      void addAutoInclude​(java.lang.String strFile)
      Add an auto include file
      void addPluginAutoImport​(java.lang.String strNamespace, java.lang.String strFileName)
      Adds an import file brought by a plugin.
      void addPluginAutoInclude​(java.lang.String strFileName)
      Adds a macro file (like the main commons.html) brought by a plugin.
      void addPluginMacros​(java.lang.String strFileName)
      Deprecated.
      java.lang.String getAbsolutePathFromRelativePath​(java.lang.String strPath)
      Get the absolute path from relative path
      java.util.Map<java.lang.String,​java.lang.String> getAutoImports()
      Get the list of auto imports files
      java.util.List<java.lang.String> getAutoIncludes()
      Get the list of auto includes files
      java.lang.String getDefaultPattern​(java.util.Locale locale)
      Get the default date pattern
      void init​(java.lang.String strTemplatePath)
      Initializes the service with the templates's path
      void init​(java.lang.String strTemplatePath, boolean bAcceptIncompatibleImprovements)
      Initializes the service with the templates's path
      HtmlTemplate loadTemplate​(java.lang.String strPath, java.lang.String strTemplate)
      Load a template
      HtmlTemplate loadTemplate​(java.lang.String strPath, java.lang.String strTemplate, java.util.Locale locale, java.lang.Object rootMap)
      Load a template and process a model
      HtmlTemplate loadTemplateFromStringFtl​(java.lang.String strTemplateName, java.lang.String strTemplateData, java.util.Locale locale, java.lang.Object rootMap, boolean bResetCacheTemplate)
      Load a template from a String and process a model.
      HtmlTemplate loadTemplateFromStringFtl​(java.lang.String strTemplateData, java.util.Locale locale, java.lang.Object rootMap)
      Load a template from a String and process a model.
      void removeAutoImport​(java.lang.String strNamespace)
      Remove an auto import file
      void removeAutoInclude​(java.lang.String strFile)
      Remove an auto include file
      void resetCache()
      Reset the cache
      void resetConfiguration()
      Clears the configuration cache
      void setSharedVariable​(java.lang.String name, java.lang.Object obj)
      Add a shared variable into every template
      void setTemplateUpdateDelay​(int nTemplateUpdateDelay)
      Set the template update delay
    • Method Detail

      • getAbsolutePathFromRelativePath

        java.lang.String getAbsolutePathFromRelativePath​(java.lang.String strPath)
        Get the absolute path from relative path
        Parameters:
        strPath - the path
        Returns:
        the absolute path from relative path
      • getDefaultPattern

        java.lang.String getDefaultPattern​(java.util.Locale locale)
        Get the default date pattern
        Parameters:
        locale - the locale
        Returns:
        the default date pattern
      • setTemplateUpdateDelay

        void setTemplateUpdateDelay​(int nTemplateUpdateDelay)
        Set the template update delay
        Parameters:
        nTemplateUpdateDelay - the template update delay
      • addPluginMacros

        @Deprecated
        void addPluginMacros​(java.lang.String strFileName)
        Deprecated.
        Adds a macro file (like the main commons.html) brought by a plugin. This file will be included for every template (autoinclude).
        Parameters:
        strFileName - the filename
      • addPluginAutoInclude

        void addPluginAutoInclude​(java.lang.String strFileName)
        Adds a macro file (like the main commons.html) brought by a plugin. This file will be included for every template (auto-include).
        Parameters:
        strFileName - the filename
      • addPluginAutoImport

        void addPluginAutoImport​(java.lang.String strNamespace,
                                 java.lang.String strFileName)
        Adds an import file brought by a plugin. This file will be imported for every template (auto-import).
        Parameters:
        strNamespace - The namespace corresponding to the import file
        strFileName - the filename
      • setSharedVariable

        void setSharedVariable​(java.lang.String name,
                               java.lang.Object obj)
        Add a shared variable into every template
        Parameters:
        name - name of the shared variable
        obj - value
      • init

        void init​(java.lang.String strTemplatePath)
        Initializes the service with the templates's path
        Parameters:
        strTemplatePath - The template path
      • init

        void init​(java.lang.String strTemplatePath,
                  boolean bAcceptIncompatibleImprovements)
        Initializes the service with the templates's path
        Parameters:
        strTemplatePath - The template path
        bAcceptIncompatibleImprovements - Use Freemarker new features or stay backward compatible
      • loadTemplate

        HtmlTemplate loadTemplate​(java.lang.String strPath,
                                  java.lang.String strTemplate)
        Load a template
        Parameters:
        strPath - the root path
        strTemplate - the path of the template from the root path
        Returns:
        the html template
      • loadTemplate

        HtmlTemplate loadTemplate​(java.lang.String strPath,
                                  java.lang.String strTemplate,
                                  java.util.Locale locale,
                                  java.lang.Object rootMap)
        Load a template and process a model
        Parameters:
        strPath - the root path
        strTemplate - the path of the template from the root path
        locale - The locale
        rootMap - the model root
        Returns:
        the processed html template
      • loadTemplateFromStringFtl

        HtmlTemplate loadTemplateFromStringFtl​(java.lang.String strTemplateData,
                                               java.util.Locale locale,
                                               java.lang.Object rootMap)
        Load a template from a String and process a model. the template data is stored in the StringTemplateLoader of freemarker. the template key is generate by a hash of the template data.
        Parameters:
        strTemplateData - The template as a string
        locale - The Locale
        rootMap - the model root
        Returns:
        the processed html template
      • loadTemplateFromStringFtl

        HtmlTemplate loadTemplateFromStringFtl​(java.lang.String strTemplateName,
                                               java.lang.String strTemplateData,
                                               java.util.Locale locale,
                                               java.lang.Object rootMap,
                                               boolean bResetCacheTemplate)
        Load a template from a String and process a model. the template data is stored in the StringTemplateLoader of freemarker using strTemplateName as key
        Parameters:
        strTemplateName - the key of the template put in the StringTemplateLoader. The template name must be a Fully qualified name (skin.plugins.myplugin.manage_my_objects)
        strTemplateData - The template as a string
        locale - The Locale
        rootMap - the model root
        bResetCacheTemplate - force the update of the template data stored in the StringTemplateLoader
        Returns:
        the processed html template
      • resetConfiguration

        void resetConfiguration()
        Clears the configuration cache
      • resetCache

        void resetCache()
        Reset the cache
      • getAutoIncludes

        java.util.List<java.lang.String> getAutoIncludes()
        Get the list of auto includes files
        Returns:
        The list or null if no configuration is available
      • addAutoInclude

        void addAutoInclude​(java.lang.String strFile)
        Add an auto include file
        Parameters:
        strFile - The file to add
      • removeAutoInclude

        void removeAutoInclude​(java.lang.String strFile)
        Remove an auto include file
        Parameters:
        strFile - The file to remove
      • getAutoImports

        java.util.Map<java.lang.String,​java.lang.String> getAutoImports()
        Get the list of auto imports files
        Returns:
        The list or null if no configuration is available
      • addAutoImport

        void addAutoImport​(java.lang.String strNamespace,
                           java.lang.String strFile)
        Add an auto import file
        Parameters:
        strNamespace - The namespace corresponding to the import file
        strFile - The file to add
      • removeAutoImport

        void removeAutoImport​(java.lang.String strNamespace)
        Remove an auto import file
        Parameters:
        strNamespace - The namespace corresponding to the import file to remove