Class DefaultImporterTool
java.lang.Object
java.util.Observable
com.nomagic.magicreport.engine.Tool
com.nomagic.reportwizard.tools.ImportTool
com.nomagic.reportwizard.tools.importer.DefaultImporterTool
- All Implemented Interfaces:
IChildEngine,ITool,IVariable,Serializable,Cloneable,Observer
- Direct Known Subclasses:
DOCXImporterTool
This tool will allow user to import plain text template.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.nomagic.magicreport.engine.ITool
ITool.HTMLString, ITool.RetainedString, ITool.Void -
Field Summary
Fields inherited from class com.nomagic.magicreport.engine.Tool
context, properties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetCanonicalTemplate(String templateFileName) Creates an absolute path from the template file name.protected Stringprotected FilegetTemplateFile(String templateFileName) Creates template file from the template file name.Gets the String content of the imported file.Gets the String content of the import object (may be file or path).Gets the String content of the imported template path.protected booleanCHeck supported engine typeprotected voidsetEngineType(String engineType) protected ITemplateEnginesetTemplateEngine(String fileName) This will only create a new TemplateEngine in the case that the previous instance was of a different kind.protected voidsetupEngine(ITemplateEngine engine) Set up engine.
Add properties and context to engine.Methods inherited from class com.nomagic.reportwizard.tools.ImportTool
fileImporter, getParentEngine, importer, include, include, include, include, includeSection, includeSection, isParentSupportChild, setParentEngine, setupTool, updateMethods inherited from class com.nomagic.magicreport.engine.Tool
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext, setPropertiesMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
-
Constructor Details
-
DefaultImporterTool
Constructor
-
-
Method Details
-
importer
Gets the String content of the import object (may be file or path). This will do all the importTool's work. It is called by both public methods, with the difference that section is null if we want to include the whole file. Else it has a section name and only that subsection will be included.- Parameters:
importedObject- the imported object that may be string of template path or file of template.importedSectionName- if there is a section else this is null- Returns:
- the evaluated and validated output from childTemplate
-
importer
Gets the String content of the imported template path. This will do all the importTool's work. It is called by both public methods, with the difference that section is null if we want to include the whole file. Else it has a section name and only that subsection will be included.- Overrides:
importerin classImportTool- Parameters:
importedTemplateFileName- the path of childTemplate to be evaluatedimportedSectionName- if there is a section else this is null- Returns:
- the evaluated and validated output from childTemplate
-
importer
Gets the String content of the imported file. This will do all the importTool's work. It is called by both public methods, with the difference that section is null if we want to include the whole file. Else it has a section name and only that subsection will be included.- Parameters:
importedFile- the childTemplate file to be evaluatedimportedSectionName- if there is a section else this is null- Returns:
- the evaluated and validated output from childTemplate
-
setTemplateEngine
This will only create a new TemplateEngine in the case that the previous instance was of a different kind. We can safely assume that within a single document all include/includeSection directives will access templates of the same kind. It will set the IValidator in accord with the engine instance.- Parameters:
fileName- the templateFile that determines the engineType- Returns:
- the Template engine
-
setupEngine
Set up engine.
Add properties and context to engine.- Parameters:
engine- current engine
-
getTemplateFile
Creates template file from the template file name.- Parameters:
templateFileName- the child Template path- Returns:
- the template file
- Throws:
IOException
-
getCanonicalTemplate
Creates an absolute path from the template file name.- Parameters:
templateFileName- the child Template path- Returns:
- the absolute Path
- Throws:
IOException- if the canonical file cannot be instantiated.
-
isSupport
CHeck supported engine type- Parameters:
engineType- engine type- Returns:
- true if the specific engine is supported, otherwise; false
-
getEngineType
-
setEngineType
-