public class CommentCollector extends Object
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_COMMENT |
Constructor and Description |
---|
CommentCollector() |
Modifier and Type | Method and Description |
---|---|
static CommentCollector |
getCommentCollector(ScriptingContext ctx)
Get the comment collector associated with the given context.
|
int |
getSize()
Get number of comments recorded in the comment collection (typically one
comment is one line of text).
|
static String[] |
getSupportedOutputFormatDescriptions()
Get descriptions of the supported output formats such as
"Plain text document (*.txt)" for the "txt" format.The array has the same
order and size as the one returned by
getSupportedOutputFormats() . |
static String[] |
getSupportedOutputFormats()
Get the supported output formats as lower case file extensions, such as
"txt" for plain text format or "docx" for MS Word 2007 XML.
|
boolean |
recordComment(Element element,
ScriptingContext ctx)
Record a comment detected during a script compilation or execution..
|
String |
toHTML(boolean standalone)
Export the comment collection to the HTML format and return it.
|
void |
toHTML(OutputStream out) |
void |
toPlainText(OutputStream out,
String content) |
String |
toString()
Overridden to return the comment collection exported to plain text.
|
void |
toWord(OutputStream out,
String content) |
void |
write(OutputStream out,
String format,
String content)
Write the recorded comments or the customized content in the specified format
to the specified output stream.
|
public static final int TYPE_COMMENT
public static CommentCollector getCommentCollector(ScriptingContext ctx)
ctx
- a valid context. If the argument is null the method will throw
a NullPointerException.public boolean recordComment(Element element, ScriptingContext ctx)
element
- the document element containing the comment.ctx
- a context.public static String[] getSupportedOutputFormats()
public static String[] getSupportedOutputFormatDescriptions()
getSupportedOutputFormats()
.public void write(OutputStream out, String format, String content) throws IOException
out
- an output stream to write to.format
- format (file extension) listed as supported by getSupportedOutputFormats()
.
If the specified format is not supported, the method throws an IllegalArgumentException.content
- optional customized comment text. This allows to write comments
which were first generated through toString()
and then customized by the user,
for example in a text editor in the GUI. If the argument is null, the method
will create the comment text from the recorded comments.IOException
- if writing to the specified output stream fails.public void toPlainText(OutputStream out, String content) throws IOException
IOException
public void toHTML(OutputStream out) throws IOException
IOException
public void toWord(OutputStream out, String content) throws IOException
IOException
public String toString()
public String toHTML(boolean standalone)
standalone
- the value of true creates a complete HTML document
including the 'html' and 'body' tags. The value of false produces HTML
suitable for insertion into another HTML document.public int getSize()