Interface ITemplateEngine

All Known Implementing Classes:
AbstractTemplateEngine, DefaultTemplateEngine, DocBookEngine, DOCXEngine, HTMLEngine, LaTeXEngine, PPTXEngine, RTFEngine, TextEngine, XLSXEngine, XMLEngine

@OpenApiAll public interface ITemplateEngine
Provides an interface for template engine.
Since:
Jun 11, 2007
  • Method Details

    • createTemplate

      Template createTemplate()
      Creates a new and empty Template for generating report by this engine.
      Returns:
      an instance of Template
      See Also:
    • createTemplate

      Template createTemplate(File input, File output) throws IOException
      Creates a new Template object.
      Parameters:
      input - template file.
      output - output file.
      Returns:
      an instance of Template
      Throws:
      FileNotFoundException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened.
      IOException - If an I/O error occurs
    • getFormatter

      IFormatter getFormatter()
      Returns a formatter that can be used to create the object layout, and formats of state InsertionHandler.
      Returns:
      a formatter
    • getContext

      IContext getContext()
      Return context of this engine.
      Returns:
      a context of engine.
    • addContext

      Object addContext(String name, Object value)
      Adds a name/value pair to the context.
      Parameters:
      name - The name to key the provided value with.
      value - The corresponding value.
      Returns:
      The old object or null if there was no old object.
    • getProperty

      Object getProperty(String key)
      Return an engine Runtime property.
      Parameters:
      key - the property key
      Returns:
      the value in this property list with the specified key value.
      See Also:
    • setProperty

      void setProperty(String key, Object value)
      Set an engine Runtime property.
      Parameters:
      key - the key to be placed into this property list.
      value - the value corresponding to key.
      See Also:
    • getProperties

      Properties getProperties()
      Returns the current properties of engine.
      Returns:
      the engine properties
    • addReferenceInsertionHandler

      void addReferenceInsertionHandler(IReferenceInsertionHandler handler)
      Add a reference insertion event handler to the engine.
      Parameters:
      handler - ReferenceInsertionEventHandler
    • addInvalidReferenceHandler

      void addInvalidReferenceHandler(IInvalidReferenceHandler handler)
      Add an invalid reference event handler to the engine.
      Parameters:
      handler - IInvalidReferenceHandler
    • getInvalidReferenceHandler

      List<IInvalidReferenceHandler> getInvalidReferenceHandler()
      Return a IInvalidReferenceHandler of this engine.
      Returns:
      invalid reference handler for this engine.
    • getReferenceInsertionHandler

      List<IReferenceInsertionHandler> getReferenceInsertionHandler()
      Return a IInvalidReferenceHandler of this engine.
      Returns:
      reference insertion handler for this engine.
    • evaluate

      void evaluate(Template template) throws TemplateException
      Merge a template with current context and rendered stream into the writer.
      Parameters:
      template - Template being evaluated
      Throws:
      ParseErrorException - if a syntax or other error which prevents it from being parsed.
      InitializationEngineException - when engine initialize error
      TemplateException - other error
    • destroy

      void destroy()
      Called by the application or TemplateEngineFactory to inform this engine that it should destroy any resources that it has allocated.
    • abort

      void abort()
      Called by the application to abort current evaluation context.