@OpenApiAll public class RTFEngine extends DefaultTemplateEngine implements StyledDocument
velocityContext
context, isAborted, preProcessFile, processFile, properties
Constructor and Description |
---|
RTFEngine()
Create instance of engine.
|
Modifier and Type | Method and Description |
---|---|
int |
addColor(java.awt.Color color)
Appends the specified color to the document's color table.
|
int |
addFont(java.awt.Font font)
Appends the specified font to the document's font table.
|
int |
addList(List list)
Appends the specified list item to the document's style table.
|
int |
addObject(java.lang.Object object)
Appends object content into the document.
|
int |
addStyle(javax.swing.text.Style style)
Appends the specified style to the document's style table.
|
protected java.lang.String |
createComment(java.lang.String message)
Return a formatted comment from given message.
|
protected ParseErrorException |
createParseErrorWrapper(ParseErrorException parseError,
java.io.Reader source)
Create a ParseErrorException from the message.
|
protected void |
handleForPage(Template template,
java.lang.StringBuffer inProcessBuffer)
Handle the #forpage directive.
|
protected void |
handleForRow(Template template,
java.lang.StringBuffer inProcessBuffer)
Handle the #forrow directive.
|
protected void |
handleSectionBegin(Template template,
java.lang.StringBuffer inProcessBuffer)
Handle the #sectionBegin directive.
|
protected int |
lineCount(java.lang.String content)
Count number of line from given content string.
|
protected void |
postProcess(Template template)
Perform a post-processing after the template has been evaluated.
|
protected void |
preProcess(Template template)
Perform a pre-processing before evaluate the template.
|
protected TemplateException |
processVelocityException(Template template,
org.apache.velocity.exception.ParseErrorException e)
Call this method to process an Velocity exception and return in new format.
|
void |
setProperty(java.lang.String key,
java.lang.Object value)
Set an engine Runtime property.
|
protected void |
translate(Template template,
java.lang.StringBuffer inProcessBuffer)
Translate the RTF document into valid VTL document.
|
abort, checkFileNotFoundException, createTemplate, createTemplate, createTemplate, destroy, getClassLoader, getFormatter, handleImport, handleIncludeSection, isNoSpaceException, process, process, processException, processVelocityException, setClassLoader, setFormatter, setLatestLocation, setLocation, trimTrailSpace
addContext, addInvalidReferenceHandler, addObserver, addReferenceInsertionHandler, evaluate, evaluate, getConcurrentToolException, getContext, getCurrentRuntimeInstance, getInvalidReferenceHandler, getProcessSize, getProperties, getProperty, getReferenceInsertionHandler, isMemoryMode, notifyObservers, observers, setConcurrentToolException, setContext, setCurrentRuntimeInstance
public void setProperty(java.lang.String key, java.lang.Object value)
setProperty
in interface ITemplateEngine
setProperty
in class DefaultTemplateEngine
key
- the key to be placed into this property list.value
- the value corresponding to key.ITemplateEngine.getProperty(String)
protected int lineCount(java.lang.String content)
lineCount
in class DefaultTemplateEngine
content
- the input stringprotected void translate(Template template, java.lang.StringBuffer inProcessBuffer) throws ParseErrorException, java.io.IOException
translate
in class DefaultTemplateEngine
template
- templateinProcessBuffer
- in process bufferParseErrorException
- if a syntax or other error which prevents it from being parsed.java.io.IOException
- if IO Error occurs while reading template.DefaultTemplateEngine.translate(com.nomagic.magicreport.Template,
java.lang.StringBuffer)
protected void handleForPage(Template template, java.lang.StringBuffer inProcessBuffer) throws ParseErrorException
handleForPage
in class DefaultTemplateEngine
template
- Template source.inProcessBuffer
- in process buffer.ParseErrorException
- when error while translation, or syntax not recognized.protected void handleForRow(Template template, java.lang.StringBuffer inProcessBuffer) throws ParseErrorException
handleForRow
in class DefaultTemplateEngine
template
- Template source.inProcessBuffer
- in process buffer.ParseErrorException
- when error while translation, or syntax not recognized.protected void handleSectionBegin(Template template, java.lang.StringBuffer inProcessBuffer) throws ParseErrorException
handleSectionBegin
in class DefaultTemplateEngine
template
- Template source.inProcessBuffer
- in process buffer.ParseErrorException
- when error while translation, or syntax not recognized.protected java.lang.String createComment(java.lang.String message)
createComment
in class DefaultTemplateEngine
message
- message to put in document commentprotected TemplateException processVelocityException(Template template, org.apache.velocity.exception.ParseErrorException e)
DefaultTemplateEngine.processVelocityException(Template, org.apache.velocity.exception.ParseErrorException)
to return exception with valid RTF line count.processVelocityException
in class DefaultTemplateEngine
template
- Templatee
- Velocity exceptionprotected ParseErrorException createParseErrorWrapper(ParseErrorException parseError, java.io.Reader source)
parseError
- root causesource
- source templateprotected void preProcess(Template template) throws TemplateException
preProcess
in class DefaultTemplateEngine
template
- template before evaluated.ParseErrorException
- if a syntax or other error which prevents it from being
parsed.InitializationEngineException
- error while initializing engineTemplateException
- other error while processing the templateAbstractTemplateEngine.preProcess(com.nomagic.magicreport.Template)
protected void postProcess(Template template) throws TemplateException
postProcess
in class DefaultTemplateEngine
template
- template after evaluated.ParseErrorException
- if a syntax or other error which prevents it from being
parsed.InitializationEngineException
- error while initializing engineTemplateException
- other error while processing the templateAbstractTemplateEngine.postProcess(com.nomagic.magicreport.Template)
public int addColor(java.awt.Color color)
addColor
in interface StyledDocument
color
- specified color.public int addFont(java.awt.Font font)
addFont
in interface StyledDocument
font
- specified font.public int addList(List list)
addList
in interface StyledDocument
list
- type of listpublic int addStyle(javax.swing.text.Style style)
addStyle
in interface StyledDocument
style
- a style. Reproduce from StyleContext.NamedStylepublic int addObject(java.lang.Object object)
addObject
in interface StyledDocument
object
- adding objectCopyright © 2010 - No Magic Asia