Package com.nomagic.magicreport.engine
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 Summary
Modifier and TypeMethodDescriptionvoidabort()Called by the application to abort current evaluation context.addContext(String name, Object value) Adds a name/value pair to the context.voidAdd an invalid reference event handler to the engine.voidAdd a reference insertion event handler to the engine.Creates a new and emptyTemplatefor generating report by this engine.createTemplate(File input, File output) Creates a newTemplateobject.voiddestroy()Called by the application orTemplateEngineFactoryto inform this engine that it should destroy any resources that it has allocated.voidMerge a template with current context and rendered stream into the writer.Return context of this engine.Returns a formatter that can be used to create the object layout, and formats of stateInsertionHandler.Return aIInvalidReferenceHandlerof this engine.Returns the current properties of engine.getProperty(String key) Return an engine Runtime property.Return aIInvalidReferenceHandlerof this engine.voidsetProperty(String key, Object value) Set an engine Runtime property.
-
Method Details
-
createTemplate
Template createTemplate()Creates a new and emptyTemplatefor generating report by this engine.- Returns:
- an instance of
Template - See Also:
-
createTemplate
Creates a newTemplateobject.- 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 stateInsertionHandler.- Returns:
- a formatter
-
getContext
IContext getContext()Return context of this engine.- Returns:
- a context of engine.
-
addContext
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
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
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
Add a reference insertion event handler to the engine.- Parameters:
handler- ReferenceInsertionEventHandler
-
addInvalidReferenceHandler
Add an invalid reference event handler to the engine.- Parameters:
handler- IInvalidReferenceHandler
-
getInvalidReferenceHandler
List<IInvalidReferenceHandler> getInvalidReferenceHandler()Return aIInvalidReferenceHandlerof this engine.- Returns:
- invalid reference handler for this engine.
-
getReferenceInsertionHandler
List<IReferenceInsertionHandler> getReferenceInsertionHandler()Return aIInvalidReferenceHandlerof this engine.- Returns:
- reference insertion handler for this engine.
-
evaluate
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 errorTemplateException- other error
-
destroy
void destroy()Called by the application orTemplateEngineFactoryto 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.
-