public interface Listener extends LinkListener, ImageListener
XDOM object. That object has
a AbstractBlock.traverse(Listener) method that accepts a Listener object. For each
Block element found in the document its
Block.traverse(org.xwiki.rendering.listener.Listener) method is called leading to the generation of events from this
interface.
Here's an example of usage:
<code> XDOM dom = parser.parse(source); MyListener listener = new MyListener(...); dom.traverse(listener); // At this stage all events have been sent to MyListener. </code>
| Modifier and Type | Field and Description |
|---|---|
static Map<String,String> |
EMPTY_PARAMETERS
To use when there is no parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginDefinitionDescription()
Start of a definition list description.
|
void |
beginDefinitionList(Map<String,String> parameters)
Start of a definition list.
|
void |
beginDefinitionTerm()
Start of a definition list term.
|
void |
beginDocument(MetaData metaData)
Start of the document.
|
void |
beginFormat(Format format,
Map<String,String> parameters)
End of a text formatting block.
|
void |
beginGroup(Map<String,String> parameters)
Start a group of elements.
|
void |
beginHeader(HeaderLevel level,
String id,
Map<String,String> parameters)
Start of a header.
|
void |
beginList(ListType listType,
Map<String,String> parameters)
Start of a list.
|
void |
beginListItem()
Start of a list item.
|
void |
beginMacroMarker(String name,
Map<String,String> macroParameters,
String content,
boolean isInline)
Start of marker containing a macro definition.
|
void |
beginMetaData(MetaData metadata)
Start of MetaData (eg saving source from where the content is coming from).
|
void |
beginParagraph(Map<String,String> parameters)
Start of a paragraph.
|
void |
beginQuotation(Map<String,String> parameters)
Start of a quotation.
|
void |
beginQuotationLine()
Start of a quotation line.
|
void |
beginSection(Map<String,String> parameters)
Start of a section.
|
void |
beginTable(Map<String,String> parameters)
Start of a table.
|
void |
beginTableCell(Map<String,String> parameters)
Start of a table cell.
|
void |
beginTableHeadCell(Map<String,String> parameters)
Start of a table head cell.
|
void |
beginTableRow(Map<String,String> parameters)
Start of a table row.
|
void |
endDefinitionDescription()
End of a definition list description.
|
void |
endDefinitionList(Map<String,String> parameters)
End of a definition list.
|
void |
endDefinitionTerm()
End of a definition list term.
|
void |
endDocument(MetaData metaData)
End of the document.
|
void |
endFormat(Format format,
Map<String,String> parameters)
End of a text formatting block.
|
void |
endGroup(Map<String,String> parameters)
End of the group.
|
void |
endHeader(HeaderLevel level,
String id,
Map<String,String> parameters)
End of a header.
|
void |
endList(ListType listType,
Map<String,String> parameters)
End of a list.
|
void |
endListItem()
End of a list item.
|
void |
endMacroMarker(String name,
Map<String,String> macroParameters,
String content,
boolean isInline)
End of marker containing a macro definition.
|
void |
endMetaData(MetaData metadata)
End of MetaData.
|
void |
endParagraph(Map<String,String> parameters)
End of a paragraph.
|
void |
endQuotation(Map<String,String> parameters)
End of a quotation.
|
void |
endQuotationLine()
End of a quotation line.
|
void |
endSection(Map<String,String> parameters)
End of a section.
|
void |
endTable(Map<String,String> parameters)
End of a table.
|
void |
endTableCell(Map<String,String> parameters)
End of a table cell.
|
void |
endTableHeadCell(Map<String,String> parameters)
End of a table head cell.
|
void |
endTableRow(Map<String,String> parameters)
End of a table row.
|
void |
onEmptyLines(int count)
Represents an empty line between 2 standalone Blocks.
|
void |
onHorizontalLine(Map<String,String> parameters)
Represents an horizontal line.
|
void |
onId(String name)
A reference/location in a page.
|
void |
onMacro(String id,
Map<String,String> macroParameters,
String content,
boolean isInline)
A Macro.
|
void |
onNewLine()
A new line or line break (it's up to the renderers to decide if it should be outputted as a new line or as a line
break in the given syntax).
|
void |
onRawText(String rawContent,
Syntax syntax)
Some text to inject directly into the listener output without parsing it.
|
void |
onSpace()
A space.
|
void |
onSpecialSymbol(char symbol)
A special symbol (
*, <, >, =, quote, etc). |
void |
onVerbatim(String protectedString,
boolean isInline,
Map<String,String> parameters)
A portion of text.
|
void |
onWord(String word)
A word.
|
beginLink, endLinkonImagevoid beginDocument(@Name(value="metadata")
MetaData metaData)
metaData - the meta data to associate to the following events, see MetaDatavoid endDocument(@Name(value="metadata")
MetaData metaData)
metaData - the meta data associated with the previous events, see MetaDatavoid beginMetaData(@Name(value="metadata")
MetaData metadata)
metadata - the metadatavoid endMetaData(@Name(value="metadata")
MetaData metadata)
metadata - the metadatavoid beginGroup(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters. Example: style="background-color: blue"void endGroup(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters. Example: style="background-color: blue"void beginFormat(@Default(value="NONE") @Name(value="format")
Format format,
@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
format - the formatting type (bold, italic, etc)parameters - a generic list of parameters. Example: style="background-color: blue"Formatvoid endFormat(@Default(value="NONE") @Name(value="format")
Format format,
@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
format - the formatting type (bold, italic, etc)parameters - a generic list of parameters. Example: style="background-color: blue"Formatvoid beginParagraph(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters. Example: style="background-color: blue"void endParagraph(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters. Example: style="background-color: blue"void beginList(@Default(value="BULLETED") @Name(value="type")
ListType listType,
@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
listType - the type of list (bulleted, numbered, etc)parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"ListTypevoid beginDefinitionList(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"void endList(@Default(value="BULLETED") @Name(value="type")
ListType listType,
@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
listType - the type of list (bulleted, numbered, etc)parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"ListTypevoid endDefinitionList(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"void beginListItem()
void beginDefinitionTerm()
void beginDefinitionDescription()
void endListItem()
void endDefinitionTerm()
void endDefinitionDescription()
void beginTable(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the table.void beginTableRow(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the table row.void beginTableCell(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the table cell.void beginTableHeadCell(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the table head cell.void endTable(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the table.void endTableRow(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the table row.void endTableCell(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the table cell.void endTableHeadCell(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the table head cell.void beginSection(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters. Example: style="background-color: blue"HeaderLevelvoid endSection(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters. Example: style="background-color: blue"HeaderLevelvoid beginHeader(@Default(value="1") @Name(value="level")
HeaderLevel level,
@Name(value="id")
String id,
@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
level - the header level (1, 2, 3, etc)id - the header unique identifierparameters - a generic list of parameters. Example: style="background-color: blue"HeaderLevelvoid endHeader(@Default(value="1") @Name(value="level")
HeaderLevel level,
@Name(value="id")
String id,
@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
level - the header level (1, 2, 3, etc)id - the header unique identifierparameters - a generic list of parameters. Example: style="background-color: blue"HeaderLevelvoid beginMacroMarker(@Name(value="name")
String name,
@Default(value="") @Name(value="parameters")
Map<String,String> macroParameters,
@Name(value="content")
String content,
@Name(value="inline")
boolean isInline)
name - the macro namemacroParameters - the macro parameterscontent - the macro contentisInline - if true the macro is located in a inline content (like paragraph, etc.)onMacro(String, java.util.Map, String, boolean)void endMacroMarker(@Name(value="name")
String name,
@Default(value="") @Name(value="parameters")
Map<String,String> macroParameters,
@Name(value="content")
String content,
@Name(value="inline")
boolean isInline)
name - the macro namemacroParameters - the macro parameterscontent - the macro contentisInline - if true the macro is located in a inline content (like paragraph, etc.)beginMacroMarker(String, java.util.Map, String, boolean)void beginQuotation(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the quotation. Example: "style"/"background-color: blue"void endQuotation(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters for the quotation. Example: "style"/"background-color: blue"void beginQuotationLine()
void endQuotationLine()
void onNewLine()
void onMacro(@Name(value="id")
String id,
@Default(value="") @Name(value="parameters")
Map<String,String> macroParameters,
@Name(value="content")
String content,
@Name(value="inline")
boolean isInline)
id - the macro id (eg "toc" for the TOC macro)macroParameters - the macro parameterscontent - the macro contentisInline - if true the macro is located in a inline content (like paragraph, etc.)void onWord(@Name(value="word")
String word)
word - the word encounteredvoid onSpace()
void onSpecialSymbol(@Name(value="symbol")
char symbol)
*, <, >, =, quote, etc). Any non alpha numeric character is a
special symbol.symbol - the symbol encounteredvoid onId(@Name(value="name")
String name)
name - the location name.void onHorizontalLine(@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
parameters - a generic list of parameters. Example: style="background-color: blue"void onEmptyLines(@Default(value="1") @Name(value="count")
int count)
count - the number of empty lines between 2 standalone Blocksvoid onVerbatim(@Name(value="content")
String protectedString,
@Name(value="inline")
boolean isInline,
@Default(value="") @Name(value="parameters")
Map<String,String> parameters)
protectedString - the string to protected from renderingisInline - if true the text content is located in a inline content (like paragraph, etc.)parameters - a generic list of parameters. Example: style="background-color: blue"void onRawText(@Name(value="content")
String rawContent,
@Name(value="syntax")
Syntax syntax)
rawContent - the text to injectsyntax - the syntax in which the text is written. This is useful so that listener implementations can decide
whether they can handle direct inject for that syntaxCopyright © 2004–2016 XWiki. All rights reserved.